ansible-development-environ.../roles/update/tasks/main.yml

97 lines
2.2 KiB
YAML

---
# tasks file for update
- name: import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: yes
delegate_to: localhost
- name: configure apk
block:
- name: update cache (apk)
community.general.apk:
update_cache: yes
changed_when: no
- name: update all software (apk)
community.general.apk:
upgrade: yes
notify:
- reboot
when:
- ansible_pkg_mgr == "apk"
- name: configure apt
block:
- name: update all software (apt)
ansible.builtin.apt:
update_cache: yes
upgrade: "{{ update_upgrade_command }}"
cache_valid_time: "{{ update_cache_valid_time }}"
notify:
- reboot
- name: apt autoremove (apt)
ansible.builtin.apt:
autoremove: "{{ update_autoremove }}"
when:
- ansible_pkg_mgr == "apt"
- update_autoremove
when:
- ansible_pkg_mgr == "apt"
- name: update all software (dnf)
ansible.builtin.dnf:
name: "*"
state: latest # noqa package-latest This role is to update packages.
notify:
- reboot
when:
- ansible_pkg_mgr == "dnf"
- name: update all software (pacman)
community.general.pacman:
update_cache: yes
upgrade: yes
notify:
- reboot
when:
- ansible_pkg_mgr == "pacman"
- name: configure yum
block:
- name: update all software (yum/6)
ansible.builtin.yum:
name: "*"
state: latest # noqa package-latest This role is to update packages.
notify:
- reboot
when:
- ansible_distribution_major_version == "6"
- name: update all software (yum/7)
ansible.builtin.yum:
name: "*"
state: latest # noqa package-latest This role is to update packages.
notify:
- reboot
when:
- ansible_distribution_major_version == "7"
- name: install yum-utils
ansible.builtin.package:
name: yum-utils
when:
- ansible_distribution_major_version == "7"
when:
- ansible_pkg_mgr == "yum"
- name: update all software (zypper)
community.general.zypper:
name: "*"
state: latest # noqa package-latest This role is to update packages.
notify:
- reboot
when:
- ansible_pkg_mgr == "zypper"