From 8e54340c9efba630c4903a47394853ca5b5a3c69 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 24 Oct 2024 10:22:59 -0600 Subject: [PATCH] Add handler so the glance container gets restarted every time the glance config file is changed --- roles/docker/handlers/main.yml | 7 +++++++ roles/docker/tasks/glance.yml | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 roles/docker/handlers/main.yml diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml new file mode 100644 index 0000000..3a5a230 --- /dev/null +++ b/roles/docker/handlers/main.yml @@ -0,0 +1,7 @@ +# roles/docker/handlers/main.yml +- name: restart glance + community.docker.docker_compose_v2: + project_src: /opt/stacks/glance + files: + - compose.yml + state: restarted \ No newline at end of file diff --git a/roles/docker/tasks/glance.yml b/roles/docker/tasks/glance.yml index 2a3538a..e980896 100644 --- a/roles/docker/tasks/glance.yml +++ b/roles/docker/tasks/glance.yml @@ -1,6 +1,6 @@ - name: make glance directories ansible.builtin.file: - path: "{{ item}}" + path: "{{ item }}" state: directory loop: - /opt/stacks/glance @@ -10,17 +10,18 @@ src: glance-compose.yml.j2 dest: /opt/stacks/glance/compose.yml owner: root - mode: 644 + mode: '0644' - name: Template out the config file ansible.builtin.template: src: glance.yml.j2 dest: /opt/stacks/glance/glance.yml owner: root - mode: 644 + mode: '0644' + notify: restart glance - name: deploy glances stack community.docker.docker_compose_v2: project_src: /opt/stacks/glance files: - - compose.yml \ No newline at end of file + - compose.yml \ No newline at end of file