From 5d9da643d6db122767ea5ca962a8ef0fd61685d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 19 Oct 2016 22:02:26 +0200 Subject: [PATCH] add engine/admin/ansible/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- _data/toc.yaml | 2 ++ engine/admin/ansible.md | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 engine/admin/ansible.md diff --git a/_data/toc.yaml b/_data/toc.yaml index abd8b8564b..e1179efa2b 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -167,6 +167,8 @@ toc: title: Splunk logging driver - path: /engine/admin/dsc/ title: PowerShell DSC Usage + - path: /engine/admin/ansible/ + title: Using Ansible - path: /engine/admin/chef/ title: Using Chef - path: /engine/admin/puppet/ diff --git a/engine/admin/ansible.md b/engine/admin/ansible.md new file mode 100644 index 0000000000..1fd7fdcba0 --- /dev/null +++ b/engine/admin/ansible.md @@ -0,0 +1,67 @@ +--- +description: Installation and using Docker via Ansible +keywords: +- ansible, installation, usage, docker, documentation +title: Using Ansible +--- + +# Using Ansible + +> **Note**: +> Please note this is a community contributed installation path. + +## Requirements + +To use this guide you'll need a working installation of +[Ansible](https://www.ansible.com/) version 2.1.0 or later. + +Requirements on the host that will execute the module: + +``` +python >= 2.6 +docker-py >= 1.7.0 +Docker API >= 1.20 +``` + +## Installation + +The `docker_container` module is a core module, and will ship with +Ansible by default. + +## Usage + +Task example that pulls the latest version of the `nginx` image and +runs a container. Bind address and ports are in the example defined +as [a variable](https://docs.ansible.com/ansible/playbooks_variables.html). + +``` +--- +- name: nginx container + docker: + name: nginx + image: nginx + state: reloaded + ports: + - "{{ nginx_bind_address }}:{{ nginx_port }}:{{ nginx_port }}" + cap_drop: all + cap_add: + - setgid + - setuid + pull: always + restart_policy: on-failure + restart_policy_retry: 3 + volumes: + - /some/nginx.conf:/etc/nginx/nginx.conf:ro + tags: + - docker_container + - nginx +... +``` + +## Documentation + +The documentation for the `ansible_container` module is present at +[docs.ansible.com](https://docs.ansible.com/ansible/docker_container_module.html). + +Documentation covering Docker images, networks and services is also present +at [docs.ansible.com](https://docs.ansible.com/ansible/list_of_cloud_modules.html#docker).