Coder Social home page Coder Social logo

hadret / ansible-role-containers Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 1.0 36 KB

Ansible Role - Containers

Home Page: https://galaxy.ansible.com/hadret/containers

License: MIT License

ansible role containers docker registries servers management infrastructure ubuntu debian

ansible-role-containers's Introduction

Ansible Role: Containers

CI

An Ansible role that spins up an array of Docker containers on Linux. It can additionally handle arrays of Docker registries and networks.

Requirements

Docker needs to be in place in order for this role to work. Additionally, python module docker is also needed (i.e. Docker SDK for Python).

Role Variables

All available variables are arrays (containers, networks and registries). They are empty by default but you can find one example for each in defaults/main.yml.

Dependencies

The following roles are not a hard dependencies, hence they are not mentioned in the meta/main.yml file. Reason for that geerlingguy.docker and geerlingguy.pip is to just ensure that the Docker daemon and Docker Python SDK is present (as both of these are hard dependencies).

Example Playbook

- hosts: all

vars:
  pip_package: python-pip
  pip_install_packages:
    - name: docker

  networks:
    - name: network-1

  containers:
    - name: hello-1
      image: "hello-world"
      state: started
      restart_policy: always
      networks:
        - name: network-1
    - name: hello-2
      image: "hello-world"
      state: started
      restart_policy: always
      networks:
        - name: network-1

roles:
  - geerlingguy.pip
  - geerlingguy.docker
  - hadret.containers

Credits

All of the molecule tests and CI configuration are based on work of geerlingguy.

License

MIT

Author Information

This role was somewhat assembled in 2019 by Filip Chabik.

ansible-role-containers's People

Contributors

hadret avatar virtualroot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lianghuiyuan

ansible-role-containers's Issues

Update docs with docker python module dependency

It needs to be stated clearer in the README.md/docs that docker python module is required for this role to operate. Without it no containers are going to be rolled out as there's no python handlers on the receiving end ๐Ÿคท๐Ÿปโ€โ™‚๏ธ

Tests are broken

New tests I introduced recently, for whatever reason, fail in CI pipelines -- on both GitLab and Travis:

    TASK [ansible-role-containers : setup the network(s)] **************************
    changed: [instance] => (item={'name': 'network-1'})
    
    TASK [ansible-role-containers : include_tasks] *********************************
    included: /home/gitlab-runner/builds/1dhPYUvK/0/hadret/ansible-role-containers/tasks/containers.yml for instance
    
    TASK [ansible-role-containers : deploy the container(s)] ***********************
    failed: [instance] (item={'name': 'hello-1', 'image': 'hello-world', 'state': 'started', 'restart_policy': 'always', 'networks': [{'name': 'network-1'}]}) => {"ansible_loop_var": "item", "changed": false, "item": {"image": "hello-world", "name": "hello-1", "networks": [{"name": "network-1"}], "restart_policy": "always", "state": "started"}, "msg": "Error creating container: 500 Server Error: Internal Server Error (\"error creating aufs mount to /var/lib/docker/aufs/mnt/b340d708451a880816c0b3921defdee2a30ce16a381fc7003cea2fae2d1eb465-init: mount target=/var/lib/docker/aufs/mnt/b340d708451a880816c0b3921defdee2a30ce16a381fc7003cea2fae2d1eb465-init data=br:/var/lib/docker/aufs/diff/b340d708451a880816c0b3921defdee2a30ce16a381fc7003cea2fae2d1eb465-init=rw:/var/lib/docker/aufs/diff/a158599c2b550f556906d5e506b38cf144321fd2738567eaec08139d66155556=ro+wh,dio,xino=/dev/shm/aufs.xino: invalid argument\")"}
    failed: [instance] (item={'name': 'hello-2', 'image': 'hello-world', 'state': 'started', 'restart_policy': 'always', 'networks': [{'name': 'network-1'}]}) => {"ansible_loop_var": "item", "changed": false, "item": {"image": "hello-world", "name": "hello-2", "networks": [{"name": "network-1"}], "restart_policy": "always", "state": "started"}, "msg": "Error creating container: 500 Server Error: Internal Server Error (\"error creating aufs mount to /var/lib/docker/aufs/mnt/040af0f7950b7089d51468b7d3542418e0b82e05f8d28dd9401214e083518945-init: mount target=/var/lib/docker/aufs/mnt/040af0f7950b7089d51468b7d3542418e0b82e05f8d28dd9401214e083518945-init data=br:/var/lib/docker/aufs/diff/040af0f7950b7089d51468b7d3542418e0b82e05f8d28dd9401214e083518945-init=rw:/var/lib/docker/aufs/diff/a158599c2b550f556906d5e506b38cf144321fd2738567eaec08139d66155556=ro+wh,dio,xino=/dev/shm/aufs.xino: invalid argument\")"}

I have no idea why those tests are working just fine locally (via Docker Desktop for Mac) ๐Ÿคทโ€โ™‚ I'm going to keep this issue for tracking and will revert the tests until I (or somebody else) find a solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.