Last active
August 29, 2015 14:13
-
-
Save hawaku/c654d4d7774c232ef523 to your computer and use it in GitHub Desktop.
AnsibleでNTP脆弱性に対応する ref: http://qiita.com/treeclad/items/2814a96a7cb9ec6dc392
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: all | |
sudo: yes | |
gather_facts: no | |
vars: | |
pkg: ntp | |
tasks: | |
- name: yum clean | |
shell: yum clean all | |
- name: before-check | |
shell: yum list "{{pkg}}" | |
register: result | |
- debug: var=result.stdout_lines | |
- name: update "{{pkg}}" | |
yum: name="{{pkg}}" state=latest | |
- name: check again | |
shell: yum list "{{pkg}}" | |
register: result | |
- debug: var=result.stdout_lines |
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
ansible-playbook -i inventory update.yml |
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
ansible -i inventory all --sudo -m shell -a "yum clean all" | |
ansible -i inventory all --sudo -m shell -a "yum list ntp" | |
ansible -i inventory all --sudo -m shell -a "yum update ntp -y" | |
ansible -i inventory all --sudo -m shell -a "yum list ntp" |
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: all | |
sudo: yes | |
gather_facts: no | |
vars: | |
pkg: ntp | |
tasks: | |
- name: yum clean | |
shell: yum clean all | |
- name: before-check | |
shell: yum list "{{pkg}}" | |
register: result | |
- debug: var=result.stdout_lines | |
- name: update "{{pkg}}" | |
yum: name="{{pkg}}" state=latest | |
- name: check again | |
shell: yum list "{{pkg}}" | |
register: result | |
- debug: var=result.stdout_lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment