1,760
edits
Changes
→Key Concepts
== Key Concepts ==
* YAML - a human-readable data serialization language & is commonly used for configuration files. To know more, your can check out the [https://en.wikipedia.org/wiki/YAML wikipedia page here]
* Control machine - (Management node)
* Remote machine - (Controlled node)
* Playbook -
* Inventory file -
* Hosts file -
* Ad hoc commands
** <u><b>shell commands</b></u>
** ansible 192.168.99.153 -a 'date'
** ansible 192.168.99.153 -a 'df'
** ansible 192.168.99.153 -a 'iptables -L -n -v' -u root
** <u><b>copy module</b></u>
** ansible 192.169.99.153 -m copy -a "src=/ops435/ansible.txt dest=/tmp/ansible.txt"
** <u><b>Package management</b></u>
== Sample runs for some of the Ad hoc commands ==
<pre>
[rchan@centos7 ansible]$ ansible 192.168.99.153 -m copy -a "src=/home/rchan/ops435/ansible/ansible.txt dest=/tmp/ansible.txt"
192.168.99.153 | SUCCESS => {
"changed": true,
"checksum": "837affc90674fb92cdb0ebac6e49ad31a586b37e",
"dest": "/tmp/ansible.txt",
"gid": 1001,
"group": "rchan",
"md5sum": "78ae49d77d28d06173cf2194a3909732",
"mode": "0664",
"owner": "rchan",
"secontext": "unconfined_u:object_r:user_home_t:s0",
"size": 106,
"src": "/home/rchan/.ansible/tmp/ansible-tmp-1542902119.15-117618539513309/source",
"state": "file",
"uid": 1001
}
[rchan@centos7 ansible]$ ansible 192.168.99.153 -m yum -a "name=epel-release state=present"
192.168.99.153 | SUCCESS => {
"changed": false,
"msg": "",
"rc": 0,
"results": [
"epel-release-7-11.noarch providing epel-release is already installed"
]
}
[rchan@centos7 ansible]$ ansible 192.168.99.153 -m yum -a "name=epel-release state=present" -u root
192.168.99.153 | SUCCESS => {
"changed": false,
"msg": "",
"rc": 0,
"results": [
"epel-release-7-11.noarch providing epel-release is already installed"
]
}
[rchan@centos7 ansible]$ ansible 192.168.99.153 -m yum -a "name=epel-release state=latest" -u root
192.168.99.153 | SUCCESS => {
"changed": false,
"msg": "",
"rc": 0,
"results": [
"All packages providing epel-release are up to date",
""
]
}
</pre>
= Pre-Lab arrangement =