Created
February 21, 2020 14:02
-
-
Save thefaxe/1cf058ad748c2c39619ec1784acd8293 to your computer and use it in GitHub Desktop.
dirty ansible update-script for centos and debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: debian | |
remote_user: ansible | |
become: yes | |
become_user: root | |
tasks: | |
- name: update debian | |
apt: | |
upgrade: yes | |
update_cache: yes | |
cache_valid_time: 86400 #One day | |
when: ansible_os_family == 'Debian' | |
- name: dist-update debian | |
apt: | |
upgrade: dist | |
update_cache: yes | |
cache_valid_time: 86400 #One day | |
when: ansible_os_family == 'Debian' | |
- name: autoclean | |
command: apt-get autoremove -y | |
- hosts: centos | |
remote_user: ansible | |
become: yes | |
become_user: root | |
tasks: | |
- name: update local Centos | |
yum: name=* state=latest | |
when: ansible_os_family == 'RedHat' | |
- name: neustart | |
command: shutdown -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment