From 9931f819980dfba09d1459ab2013d9de3b592b7c Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Tue, 7 Apr 2026 19:19:03 +0200 Subject: [PATCH] Update Docker storage configuration and revoke token task --- .../playbooks/system/system_docker.yml | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/ansible/arcodange/factory/playbooks/system/system_docker.yml b/ansible/arcodange/factory/playbooks/system/system_docker.yml index 8d70e68..adcb0fe 100644 --- a/ansible/arcodange/factory/playbooks/system/system_docker.yml +++ b/ansible/arcodange/factory/playbooks/system/system_docker.yml @@ -40,11 +40,7 @@ register: docker_config_raw ignore_errors: yes changed_when: false - when: ansible.facts.stat.exists - vars: - ansible_facts: - stat: - exists: "{{ (ansible.builtin.stat.path='/etc/docker/daemon.json').stat.exists }}" + when: (ansible.builtin.stat.path='/etc/docker/daemon.json').stat.exists - name: Initialiser la variable de config Docker ansible.builtin.set_fact: @@ -66,6 +62,33 @@ } }, 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 ansible.builtin.copy: dest: /etc/docker/daemon.json