manala / ansible-role-docker

[READ-ONLY] Ansible role dealing with the setup of Docker

Home Page:https://galaxy.ansible.com/manala/docker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Docker Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup of Docker.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.docker

Using ansible galaxy requirements file:

- src: manala.docker

Role Handlers

Name Type Description
docker restart Service Restart Docker service

Role Variables

Definition

Name Default Type Description
manala_docker_install_packages ~ Array Dependency packages to install
manala_docker_install_packages_default ['docker-ce'] Array Default dependency packages to install
manala_docker_applications_dir '/usr/local/bin' String Applications dir path
manala_docker_applications_template 'applications/_default.j2' String Applications default template path
manala_docker_applications [] Array Applications
manala_docker_containers [] Array Containers
manala_docker_config_daemon_file '/etc/docker/daemon.json' String Daemon configuration file path
manala_docker_config_daemon_template 'config_daemon/empty.j2' String Daemon configuration default template path
manala_docker_config_daemon ~ Array Daemon configuration
manala_docker.update false Boolean Update images

Configuration example

Daemon config using dict parameters:

manala_docker_config_daemon:
  storage-driver: vfs

Daemon config using template:

manala_docker_config_daemon_template: my/docker/daemon.json.j2
manala_docker_config_daemon:
  foo: bar

Daemon config using raw content:

manala_docker_config_daemon: |
  {
      storage-driver: vfs
  }

Daemon config using dict's array parameters (deprecated):

manala_docker_config_daemon:
  - storage-driver: vfs
manala_docker_applications:
  - hello-world
  - application: npm
    image: node
    command: npm
    tag: alpine
  - application: foo
    template: docker/foo.j2

manala_docker_containers:
  - name: postgres
    image: postgres:9.6
    state: started
    restart_policy: unless-stopped
    env:
      POSTGRES_USER: foo
      POSTGRES_PASSWORD: bar
      POSTGRES_DB: baz
  - name: memcached
    image: memcached:alpine
    state: started
    restart_policy: unless-stopped
  - name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.13
    state: started
    restart_policy: unless-stopped
    memory: 1g
    ulimits:
      - memlock:-1:-1 # <type>:<soft>:<hard>
  # Ignore container
  - name: ignore.conf
    image: centos
    state: ignore
  # Flatten containers
  - "{{ my_custom_containers_array }}"

Flags

Update images

manala_docker:
  update: true

# Can also be set across manala roles
manala:
  update: true

Example playbook

- hosts: servers
  roles:
    - role: manala.docker

Licence

MIT

Author information

Manala (http://www.manala.io/)

About

[READ-ONLY] Ansible role dealing with the setup of Docker

https://galaxy.ansible.com/manala/docker/


Languages

Language:Makefile 56.6%Language:Jinja 19.8%Language:Python 16.5%Language:Shell 7.1%