Last active
January 26, 2017 15:06
-
-
Save bse666/5e7266dfdfaba0cfa408c61f4db07fb4 to your computer and use it in GitHub Desktop.
ansible stuff
This file contains hidden or 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: all | |
become: true | |
tasks: | |
- name: Check if there are Packages available to be installed/upgraded | |
command: /usr/lib/update-notifier/apt-check --package-names | |
register: packages | |
when: ansible_os_family == "Debian" | |
environment: | |
http_proxy: http://proxy:3142 | |
- name: Check if a reboot ist required | |
register: file | |
stat: path=/var/run/reboot-required get_md5=no | |
when: ansible_os_family == "Debian" | |
- name: Check for package updates on RedHats | |
shell: 'yum check-update || test $? -eq 100' | |
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' | |
- name: Check for reboot hint. | |
shell: LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1); CURRENT_KERNEL=$(uname -r); if [ $LAST_KERNEL != $CURRENT_KERNEL ]; then echo 'reboot'; else echo 'no'; fi | |
ignore_errors: true | |
register: reboot_hint | |
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' | |
This file contains hidden or 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: all | |
become: true | |
tasks: | |
- name: APT Cache | |
apt: update_cache=yes cache_valid_time=3600 | |
when: ansible_os_family == "Debian" | |
- name: APT Upgrade | |
apt: upgrade=yes | |
when: ansible_os_family == "Debian" | |
- name: CentOS - Upgrade | |
yum: name=* state=latest | |
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment