.
This commit is contained in:
@@ -11,7 +11,10 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Check if agent container exists
|
- name: Check if agent container exists
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv: ["bash", "-lc", "docker ps -a --format '{{.Names}}' | grep -x '{{ agent_container_name }}'"]
|
argv:
|
||||||
|
- bash
|
||||||
|
- -lc
|
||||||
|
- "docker ps -a --format '{{ \"{{\" }}.Names{{ \"}}\" }}' | grep -x '{{ agent_container_name }}'"
|
||||||
register: agent_exists
|
register: agent_exists
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
@@ -23,13 +26,19 @@
|
|||||||
|
|
||||||
- name: Read current agent image
|
- name: Read current agent image
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv: ["bash", "-lc", "docker inspect -f '{{.Config.Image}}' {{ agent_container_name }}"]
|
argv:
|
||||||
|
- bash
|
||||||
|
- -lc
|
||||||
|
- "docker inspect -f '{{ \"{{\" }}.Config.Image{{ \"}}\" }}' {{ agent_container_name }}"
|
||||||
register: agent_image
|
register: agent_image
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Pull latest image tag for current agent image
|
- name: Pull latest image tag for current agent image
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv: ["bash", "-lc", "docker pull {{ agent_image.stdout | trim }}"]
|
argv:
|
||||||
|
- bash
|
||||||
|
- -lc
|
||||||
|
- "docker pull {{ agent_image.stdout | trim }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|
||||||
- name: Recreate agent container with standard Portainer Agent args
|
- name: Recreate agent container with standard Portainer Agent args
|
||||||
|
|||||||
Reference in New Issue
Block a user