Code cleanup.

This commit is contained in:
Andrea Dell'Amico 2022-05-21 19:22:06 +02:00
parent b7557c74e2
commit 593d02c6e2
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 27 additions and 23 deletions

View File

@ -1,11 +1,11 @@
---
docker_install: True
docker_install: true
# Swarm
docker_swarm: False
docker_swarm_manager: False
docker_swarm: false
docker_swarm_manager: false
docker_swarm_manager_availability: 'drain'
docker_swarm_manager_advertise_address: '{{ ansible_default_ipv4.address }}'
docker_swarm_node: False
docker_swarm_node: false
docker_swarm_node_availability: 'active'
docker_swarm_node_advertise_address: '{{ ansible_default_ipv4.address }}'
docker_swarm_worker_hostname: '{{ ansible_fqdn }}'
@ -16,27 +16,27 @@ docker_swarm_allowed_hosts:
docker_swarm_manager_main_node_hostname: localhost
docker_swarm_manager_main_node_address: 127.0.0.1
# Set this on one of the masters
docker_swarm_manager_main_node: False
docker_swarm_manager_main_node: false
docker_run_as_docker_user: True
docker_run_as_docker_user: true
docker_user_home: /home/docker
docker_defaults_file: /etc/default/docker
docker_enable_tcp_socket: False
docker_enable_tcp_socket: false
docker_tcp_socket_port: 2375
docker_tls_api: True
docker_tls_native_tls: True
docker_tls_api: true
docker_tls_native_tls: true
# Set the following to the your ca and certificates path if native_tls is False
docker_tls_ca: '/var/lib/docker/swarm/certificates/swarm-root-ca.crt'
docker_tls_cert: '/var/lib/docker/swarm/certificates/swarm-node.crt'
docker_tls_key: '/var/lib/docker/swarm/certificates/swarm-node.key'
#
docker_tls_verify_clients: True
docker_enable_api_port: True
docker_tls_verify_clients: true
docker_enable_api_port: true
docker_api_port: 2376
docker_tcp_socket_host: 127.0.0.1
docker_log_to_journal: True
docker_daemon_debug: False
docker_prometheus_metrics: True
docker_log_to_journal: true
docker_daemon_debug: false
docker_prometheus_metrics: true
docker_prometheus_host: 127.0.0.1
docker_prometheus_metrics_port: 9323
@ -48,4 +48,3 @@ docker_prometheus_metrics_port: 9323
docker_label_state_mode: merge
docker_node_labels: []
# - { key: 'key_name', value: 'label_value' }

View File

@ -5,39 +5,44 @@
template: src=docker-default.j2 dest={{ docker_defaults_file }} owner=root group=root mode=0644
when: ansible_service_mgr != 'systemd'
notify: Restart docker
tags: [ 'docker', 'docker_conf' ]
tags: ['docker', 'docker_conf']
- name: Install the Docker daemon config
template: src=daemon.json.j2 dest=/etc/docker/daemon.json owner=root group=root mode=0644
notify: Restart docker
tags: [ 'docker', 'docker_conf' ]
tags: ['docker', 'docker_conf']
- name: Create the docker service systemd directory
file: dest=/etc/systemd/system/docker.service.d state=directory mode=0755
when: ansible_service_mgr == 'systemd'
tags: [ 'docker', 'docker_systemd', 'docker_conf' ]
tags: ['docker', 'docker_systemd', 'docker_conf']
- name: Install the Docker additional systemd unit
template: src=docker-systemd-override.conf.j2 dest=/etc/systemd/system/docker.service.d/override.conf owner=root group=root mode=0644
template:
src: docker-systemd-override.conf.j2
dest: /etc/systemd/system/docker.service.d/override.conf
owner: root
group: root
mode: 0644
when: ansible_service_mgr == 'systemd'
notify: Restart docker
register: reload_systemd
tags: [ 'docker', 'docker_systemd', 'docker_conf' ]
tags: ['docker', 'docker_systemd', 'docker_conf']
- name: systemd reload
command: systemctl daemon-reload
when: reload_systemd is defined and reload_systemd is changed
tags: [ 'docker', 'docker_systemd', 'docker_conf' ]
tags: ['docker', 'docker_systemd', 'docker_conf']
- name: Ensure that the service is started and enabled
service: name=docker state=started enabled=yes
when: docker_install
tags: docker
tags: [docker]
- block:
- name: Remove the docker user
user: name=docker state=absent
when: not docker_install
tags: docker
tags: [docker]