-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathdocker.yml
81 lines (79 loc) · 2.81 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
- name: HAProxy - create a Docker network
community.docker.docker_network:
name: "{{ haproxy_docker_network_name }}"
state: present
- name: HAProxy - run a Docker container
community.docker.docker_container:
# common settings
name: "{{ haproxy_docker_name }}"
hostname: "{{ inventory_hostname }}"
image: "{{ haproxy_docker_image }}"
container_default_behavior: compatibility
keep_volumes: false
privileged: false
pull: "{{ haproxy_docker_pull }}"
recreate: "{{ haproxy_docker_recreate }}"
restart_policy: unless-stopped
state: started
tls: true
tty: false
sysctls: "{{ haproxy_docker_sysctls }}"
ulimits: "{{ haproxy_docker_ulimits }}"
# network settings
network_mode: "{{ haproxy_docker_network_mode | default('default') }}"
networks:
- name: "{{ haproxy_docker_network_name }}"
aliases:
- "{{ inventory_hostname }}"
networks_cli_compatible: true
ports: "{{ haproxy_docker_ports }}"
comparisons:
networks: strict
# persistent volumes
volumes: "{{ haproxy_docker_volumes | default([haproxy_config + ':/usr/local/etc/haproxy/haproxy.cfg:ro']) }}"
# runtime settings
etc_hosts: >
{
"{{ inventory_hostname }}": "127.0.0.1"
}
# if variable also present in env, then the env value will override
# env_file: "{{ docker_persistent_path }}/ig/docker_ig.env"
when: ansible_version.full is version('2.10.0', '>=')
# TODO: keep docker_container module support for Ansible < 2.10
- name: HAProxy - run a Docker container (old style)
community.docker.docker_container:
# common settings
name: "{{ haproxy_docker_name }}"
hostname: "{{ inventory_hostname }}"
image: "{{ haproxy_docker_image }}"
container_default_behavior: compatibility
keep_volumes: false
privileged: false
pull: "{{ haproxy_docker_pull }}"
recreate: "{{ haproxy_docker_recreate }}"
restart_policy: unless-stopped
state: started
tls: true
tty: false
sysctls: "{{ haproxy_docker_sysctls }}"
ulimits: "{{ haproxy_docker_ulimits }}"
# network settings
network_mode: "{{ haproxy_docker_network_mode | default('default') }}"
networks:
- name: "{{ haproxy_docker_network_name }}"
aliases:
- "{{ inventory_hostname }}"
networks_cli_compatible: true
ports: "{{ haproxy_docker_ports }}"
purge_networks: true
# persistent volumes
volumes: "{{ haproxy_docker_volumes | default([haproxy_config + ':/usr/local/etc/haproxy/haproxy.cfg:ro']) }}"
# runtime settings
etc_hosts: >
{
"{{ inventory_hostname }}": "127.0.0.1"
}
# if variable also present in env, then the env value will override
# env_file: "{{ docker_persistent_path }}/ig/docker_ig.env"
when: ansible_version.full is version('2.10.0', '<')