mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-08 21:34:25 +00:00
Added ansible play to upgrade an OS
This commit is contained in:
27
ansible/os.upgrade.yml
Normal file
27
ansible/os.upgrade.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Upgrade the operating system
|
||||
tags:
|
||||
- os
|
||||
- system
|
||||
- upgrade
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Upgrade GNU/Linux
|
||||
tags: linux
|
||||
when: ansible_system == 'Linux'
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: '*'
|
||||
state: "{{ (ansible_pkg_mgr in ['zypper']) | ternary('dist-upgrade', 'latest') }}"
|
||||
- name: Upgrade Mac OS X
|
||||
tags:
|
||||
- darwin
|
||||
- mac
|
||||
- osx
|
||||
when: ansible_system == 'Darwin'
|
||||
ansible.builtin.command: softwareupdate --install --recommended
|
||||
register: softwareupdate_result
|
||||
changed_when:
|
||||
- softwareupdate_result.rc != 0
|
||||
- softwareupdate_result.stderr != 'No updates are available.'
|
||||
Reference in New Issue
Block a user