Host file
[root@tiber ~]# cat hosts.yml
[nodes]
tiber
po
docker
I want to run task on 2ND & 3RD HOSTS only.
[root@tiber ~]# cat play.yml- hosts: alltasks:- shell: "hostname"when: inventory_hostname != play_hosts[0][root@tiber ~]# ansible-playbook -i hosts.yml play.yml[WARNING]: The version of gmp you have installed has a known issue regardingtiming vulnerabilities when used with pycrypto. If possible, you should updateit (ie. yum update gmp).PLAY [all] ********************************************************************GATHERING FACTS ***************************************************************ok: [docker]ok: [tiber]ok: [po]TASK: [shell hostname] ********************************************************skipping: [tiber]changed: [docker]changed: [po]PLAY RECAP ********************************************************************docker : ok=2 changed=1 unreachable=0 failed=0po : ok=2 changed=1 unreachable=0 failed=0tiber : ok=1 changed=0 unreachable=0 failed=0
No comments:
Post a Comment