toolbox/tasks/alpine323.yaml
Simon Cornet ca0d331181
All checks were successful
ci/woodpecker/push/linting Pipeline was successful
chore: migrate bare ansible_* facts to ansible_facts[] syntax
2026-05-19 09:19:07 +02:00

60 lines
1.4 KiB
YAML

---
# these set of tasks will upgrade Alpine from v3.22 to v3.23
- name: "upgrade to alpine v3.23"
when:
- "ansible_facts['distribution'] == 'Alpine'"
- "'3.22' in ansible_facts['distribution_version']"
block:
# change repositories
- name: "change repositories"
ansible.builtin.replace:
path: "/etc/apk/repositories"
regexp: 'v3\.22'
replace: "v3.23"
# update apk cache
- name: "update apk cache"
ansible.builtin.apk:
update_cache: true
# upgrade apk
- name: "upgrade apk"
ansible.builtin.apk:
name: "apk-tools"
state: "latest"
# upgrade the rest
- name: "upgrade the rest"
ansible.builtin.apk:
upgrade: true
# reboot host
- name: "reboot"
ansible.builtin.reboot:
msg: "Upgrade Alpine to v3.23"
# remove motd
- name: "remove motd"
ansible.builtin.file:
path: "/etc/motd"
state: "absent"
# clean apk cache
- name: "clean apk cache"
ansible.builtin.command:
cmd: "apk clean cache"
changed_when: false
# fstrim disk
- name: "fstrim disk"
ansible.builtin.command:
cmd: "fstrim /"
changed_when: false
when: "ansible_facts['virtualization_type'] == 'kvm'"
# all is done
- name: "all is done"
ansible.builtin.debug:
msg: "all is done!"