54 lines
1.2 KiB
YAML
54 lines
1.2 KiB
YAML
---
|
|
|
|
# these set of tasks will upgrade Alpine from v3.22 to v3.23
|
|
- name: "upgrade to alpine v3.23"
|
|
when:
|
|
- "ansible_distribution == 'Alpine'"
|
|
- "'3.22' in ansible_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"
|
|
|
|
# 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!"
|