Update Docker storage configuration and revoke token task
This commit is contained in:
@@ -40,11 +40,7 @@
|
|||||||
register: docker_config_raw
|
register: docker_config_raw
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: ansible.facts.stat.exists
|
when: (ansible.builtin.stat.path='/etc/docker/daemon.json').stat.exists
|
||||||
vars:
|
|
||||||
ansible_facts:
|
|
||||||
stat:
|
|
||||||
exists: "{{ (ansible.builtin.stat.path='/etc/docker/daemon.json').stat.exists }}"
|
|
||||||
|
|
||||||
- name: Initialiser la variable de config Docker
|
- name: Initialiser la variable de config Docker
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
@@ -66,6 +62,33 @@
|
|||||||
}
|
}
|
||||||
}, recursive=True) }}
|
}, recursive=True) }}
|
||||||
|
|
||||||
|
- name: Ensure Docker storage directory exists on external disk
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /mnt/arcodange/docker
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
owner: root
|
||||||
|
group: docker
|
||||||
|
when: ansible_facts.mounts | selectattr('mount', 'equalto', '/mnt/arcodange') | list | length > 0
|
||||||
|
|
||||||
|
- name: Configure Docker to use external storage
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
docker_config: >
|
||||||
|
{{ docker_config | combine({
|
||||||
|
'data-root': '/mnt/arcodange/docker',
|
||||||
|
'storage-driver': 'overlay2'
|
||||||
|
}, recursive=True) }}
|
||||||
|
when: ansible_facts.mounts | selectattr('mount', 'equalto', '/mnt/arcodange') | list | length > 0
|
||||||
|
|
||||||
|
- name: Ensure docker_config is a dictionary
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
docker_config: >
|
||||||
|
{% if docker_config is mapping %}
|
||||||
|
{{ docker_config }}
|
||||||
|
{% else %}
|
||||||
|
{}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
- name: Écrire la configuration mise à jour
|
- name: Écrire la configuration mise à jour
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/docker/daemon.json
|
dest: /etc/docker/daemon.json
|
||||||
|
|||||||
Reference in New Issue
Block a user