toolbox/tasks/alpine323.yaml

54 lines
1.2 KiB
YAML

---
# these set of tasks will upgrade Alpine from 3.22 to 3.23
- name: "upgrade to alpine 3.23"
when:
- "ansible_distribution == 'Alpine'"
- "ansible_distribution_version == '3.22'"
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"
# 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: "type == 'vm'"
# all is done
- name: "all is done"
ansible.builtin.debug:
msg: "all is done!"