|
[root@Monitor ansible]# vim update_bash.yml
- hosts: all
remote_user: root
gather_facts: True
tasks:
- name: update bash in redhat 6 version
yum: name=http://mirrors.aliyun.com/centos/6.6/os/x86_64/Packages/bash-4.1.2
-29.el6.x86_64.rpm.rpm state=present
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
- name: update bash in redhat 5 version
yum: name=http://mirrors.hustunique.com/centos/5/updates/x86_64/RPMS/bash-3.
2-33.el5.1.x86_64.rpm state=present
when: ansible_os_family == "RedHat" and ansible_distribution_version|int <=5
[root@Monitor ansible]# ansible
ansible ansible-doc ansible-playbook ansible-vault
ansible-console ansible-galaxy ansible-pull
[root@Monitor ansible]# ansible-playbook update_bash.yml
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
ok: [Server6]
ok: [192.168.180.23]
ok: [Server5]
ok: [192.168.180.6]
ok: [192.168.180.5]
ok: [192.168.180.4]
ok: [192.168.180.2]
ok: [192.168.180.10]
TASK [update bash in redhat 6 version] *****************************************
fatal: [192.168.180.4]: FAILED! => {"changed": false, "failed": true, "msg": "Failure downloading http://mirrors.aliyun.com/centos/6.6/os/x86_64/Packages/bash-4.1.2-29.el6.x86_64.rpm.rpm, 'NoneType' object has no attribute 'read'"}
skipping: [192.168.180.23]
TASK [update bash in redhat 5 version] *****************************************
fatal: [192.168.180.23]: FAILED! => {"changed": false, "failed": true, "msg": "Failure downloading http://mirrors.hustunique.com/centos/5/updates/x86_64/RPMS/bash-3.2-33.el5.1.x86_64.rpm, 'NoneType' object has no attribute 'read'"}
to retry, use: --limit @/etc/ansible/update_bash.retry
PLAY RECAP *********************************************************************
192.168.180.10 : ok=1 changed=0 unreachable=0 failed=1
192.168.180.2 : ok=1 changed=0 unreachable=0 failed=1
192.168.180.23 : ok=1 changed=0 unreachable=0 failed=1
192.168.180.4 : ok=1 changed=0 unreachable=0 failed=1
192.168.180.5 : ok=1 changed=0 unreachable=0 failed=1
192.168.180.6 : ok=1 changed=0 unreachable=0 failed=1
Server5 : ok=1 changed=0 unreachable=0 failed=1
Server6 : ok=1 changed=0 unreachable=0 failed=1 |
|
|