Git Product home page Git Product logo

ansible-role-docker's Introduction

ansible-role-docker

Build Status

Manage Docker conatiners natively or using systemd.

Requirements

Tested with CentOS 7, Ubuntu 16.04 and Project Atomic. Docker needs to be installed.

Role Variables

container_state: started

See Ansible Docker module documentation at http://docs.ansible.com/ansible/docker_module.html.

container_privileged: false

Run the container with privileged permissions.

container_run_as_service: false

If false then the role will run the container natively using the docker command. If true then the role will create a unit file in /etc/systemd/system/ and run the service from systemd.

container_pause_seconds: 1

Time to pause after starting the container in case the container needs a few seconds to get up and running.

Dependencies

None

Example Playbook

- name: Create two docker containers
  hosts: docker-native

  vars:
    - container_state: reloaded
    - container_privileged: true
    - docker_containers:
        - name: ubuntu-container
          image: kevincoakley/ubuntu16.04-systemd
          expose:
            - "8080"
          ports:
            - "2200:22"
            - "8081:8080"
          volumes:
            - "/sys/fs/cgroup:/sys/fs/cgroup"
        - name: centos-container
          image: kevincoakley/centos7-systemd
          expose:
            - "8080"
          ports:
            - "2222:22"
            - "8082:8080"
          volumes:
            - "/sys/fs/cgroup:/sys/fs/cgroup"

  roles:
    - ansible-role-docker

  tags:
    - docker-start


- name: Create two docker containers using systemd
  hosts: docker-systemd

  vars:
    - docker_mocker: true
    - container_run_as_service: true
    - container_privileged: true
    - docker_containers:
        - name: ubuntu-container
          image: kevincoakley/ubuntu16.04-systemd
          expose:
            - "8080"
          ports:
            - "2200:22"
            - "8081:8080"
          volumes:
            - "/sys/fs/cgroup:/sys/fs/cgroup"
          ulimits:
            - "nofile=40000:40000"
        - name: centos-container
          image: kevincoakley/centos7-systemd
          expose:
            - "8080"
          ports:
            - "2222:22"
            - "8082:8080"
          volumes:
            - "/sys/fs/cgroup:/sys/fs/cgroup"

  roles:
    - ansible-role-docker

  tags:
    - docker-systemd

License

BSD

Author Information

Kevin Coakley (https://github.com/kevincoakley)

ansible-role-docker's People

Contributors

kevincoakley avatar

Watchers

 avatar

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.