first commit
This commit is contained in:
28
k3s/ansible/common/update-docker.yml
Normal file
28
k3s/ansible/common/update-docker.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# command: ansible-playbook -i config/<target manifest>.ini common/update-docker.yml
|
||||
---
|
||||
- name: Update Docker only on hosts where it is installed
|
||||
hosts: all
|
||||
become: true
|
||||
become_method: sudo
|
||||
|
||||
tasks:
|
||||
- name: Check if Docker is installed
|
||||
ansible.builtin.command: docker --version
|
||||
register: docker_check
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Update Docker packages if installed
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
state: latest
|
||||
update_cache: yes
|
||||
when: docker_check.rc == 0
|
||||
|
||||
- name: Debug message if Docker is not installed
|
||||
ansible.builtin.debug:
|
||||
msg: "Docker is not installed on this host. Skipping update."
|
||||
when: docker_check.rc != 0
|
||||
Reference in New Issue
Block a user