Use the ping module to ping all the nodes in your inventory:
[sai@san-master-anisble ~]$cat /etc/ansible/hosts
192.161.1.10
[sai@san-master-anisble ~]$ ansible all -m ping -u root -k
SSH password:
192.161.1.10| SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[sai@san-master-anisble ~]$ ansible all -a "/bin/echo hello" -u root -k
SSH password:
192.161.1.11 | CHANGED | rc=0 >>
hello
[sai@san-master-anisble ~]$
[sai@san-master-anisble ~]$ ansible all -m ping -u noc --become
192.161.1.11 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
Case 2: from noc user to switch to noc1
[sai@san-master-anisble ~]$ ansible all -m ping -u noc --become --become-user noc1
192.161.1.11 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[sai@san-master-anisble ~]$
[sai@san-master-anisble ~]$cat /etc/ansible/hosts
192.161.1.10
[sai@san-master-anisble ~]$ ansible all -m ping -u root -k
SSH password:
192.161.1.10| SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[sai@san-master-anisble ~]$ ansible all -a "/bin/echo hello" -u root -k
SSH password:
192.161.1.11 | CHANGED | rc=0 >>
hello
[sai@san-master-anisble ~]$
If you need privilege escalation (sudo) to run a command,
pass the become flags:
Case1:- noc // from noc user switched to root[sai@san-master-anisble ~]$ ansible all -m ping -u noc --become
192.161.1.11 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
Case 2: from noc user to switch to noc1
[sai@san-master-anisble ~]$ ansible all -m ping -u noc --become --become-user noc1
192.161.1.11 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[sai@san-master-anisble ~]$
The main motive of the Big data cloud solutions is to spread the knowledge so that they can give more big data engineers to the world.
ReplyDeleteThank you for sharing this Information.
ReplyDeleteI also found Various useful links related to Devops, Docker & Kubernetes
Kubernetes Kubectl Commands CheatSheet
Introduction to Kubernetes Networking
Basic Concept of Kubernetes
Kubernetes Sheetsheat
Docker Basic Tutorial
Linux Sar Command Tutorial
Linux Interview Questions and Answers
Kubernetes Interview Question and Answers
Docker Interview Question and Answers
OpenStack Interview Questions and Answers
Great post I must say and thanks for the information. Education is definitely a sticky subject. it is still among the leading topics of our time. I appreciate your post and looking for more.
ReplyDeletemobile phone repair in Novi
iphone repair in Novi
cell phone repair in Novi
phone repair in Novi
tablet repair in Novi
ipad repair in Novi
mobile phone repair Novi
iphone repair Novi
cell phone repair Novi
phone repair Novi
I am really happy to say it’s an interesting post to read. I learn new information from your article, you are doing a great job, Keep it up.
ReplyDeletemobile phone repair in Novi
iphone repair in Novi
cell phone repair in Novi
phone repair in Novi
tablet repair in Novi
ipad repair in Novi
mobile phone repair Novi
iphone repair Novi
cell phone repair Novi
phone repair Novi
As claimed by Stanford Medical, It is really the one and ONLY reason this country's women get to live 10 years more and weigh 42 lbs lighter than us.
ReplyDelete(By the way, it is not related to genetics or some secret exercise and EVERYTHING around "HOW" they are eating.)
P.S, What I said is "HOW", not "WHAT"...
CLICK on this link to see if this brief questionnaire can help you find out your real weight loss potential
Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
ReplyDeleteAWS Online Training
AWS Certification Training
AWS Certification Course Online
AWS Training
AWS Online Course