homelab/roles/upgrade/tasks/main.yml
Kris Lamoureux f1917f6a40
Playbook to upgrade containers
Moved Ansible host requirements to 'ansible' role and created role
'upgrade' and playbook to help with upgrading containers.
2019-12-14 23:24:49 -05:00

39 lines
995 B
YAML

- name: Download new Traefik container
docker_image:
name: "traefik:{{ traefik_version }}"
source: pull
register: new_traefik
- name: Download new WordPress container
docker_image:
name: "wordpress:{{ wordpress_version }}"
source: pull
register: new_wordpress
- name: Download new MariaDB container
docker_image:
name: "mariadb:{{ mariadb_version }}"
source: pull
register: new_mariadb
- name: Stop and remove old Traefik container
docker_container:
name: "{{ traefik_name }}"
image: "traefik:{{ traefik_version }}"
state: absent
when: new_traefik.changed
- name: Stop and remove old WordPress container
docker_container:
name: "{{ wordpress_name }}"
image: "wordpress:{{ wordpress_version }}"
state: absent
when: new_wordpress.changed
- name: Stop and remove old MariaDB container
docker_container:
name: "{{ mariadb_name }}"
image: "mariadb:{{ mariadb_version }}"
state: absent
when: new_mariadb.changed