feat: add alpine upgrade playbook
This commit is contained in:
parent
a5a8877b58
commit
e258ef4a96
1 changed files with 54 additions and 0 deletions
54
tasks/alpine323.yaml
Normal file
54
tasks/alpine323.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
|
||||
# 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!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue