infrastructure/ansible/plays/docker.yaml

42 lines
1.3 KiB
YAML

- name: Migrate to docker compose v2
hosts: all
become: true
become_user: root
pre_tasks:
- name: Find deployed projects
ansible.builtin.find:
paths: /home/core/compose
recurse: no
file_type: directory
register: find_challenges
- name: Register Projects Fact
ansible.builtin.set_fact:
deployed_challenges: "{{ find_challenges.files | map(attribute='path') | map('basename') }}"
- name: Undeploy
include_tasks: undeploy.yaml
loop: "{{ deployed_challenges | mandatory }}"
loop_control:
loop_var: item
label: "{{ item }}"
tasks:
- name: Install Repo
copy:
dest: /etc/yum.repos.d/docker-ce.repo
src: docker.repo
owner: root
group: root
mode: '0644'
- name: Remove legacy versions
command: "rpm-ostree override remove --reboot docker containerd runc"
async: true
poll: 0
ignore_errors: true
- name: Wait for host
ansible.builtin.wait_for_connection:
delay: 90
- name: Install new docker versions
command: "rpm-ostree install -A -y --idempotent docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin"
- name: Redeploy
ansible.builtin.import_playbook: ../playbook.yaml