Working with Ansible

[root@localhost ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:62:c0:ef brd ff:ff:ff:ff:ff:ff
inet 192.168.43.133/24 brd 192.168.43.255 scope global dynamic eno16777736
valid_lft 1402sec preferred_lft 1402sec
inet6 fe80::20c:29ff:fe62:c0ef/64 scope link
valid_lft forever preferred_lft forever
======================================================================
[root@localhost ~]# yum install epel-release -y
======================================================================
[root@localhost ~]# yum install ansible -y
======================================================================
[root@localhost ~]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1323/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1665/master
tcp6 0 0 :::22 :::* LISTEN 1323/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1665/master
======================================================================
[root@localhost ~]# cat /etc/ansible/hosts
# This is the default ansible ‘hosts’ file.
#
# It should live in /etc/ansible/hosts
#
# – Comments begin with the ‘#’ character
# – Blank lines are ignored
# – Groups of hosts are delimited by [header] elements
# – You can enter hostnames or ip addresses
# – A hostname/ip can be a member of multiple groups

# Ex 1: Ungrouped hosts, specify before any group headers.

## green.example.com
## blue.example.com
## 192.168.100.1
## 192.168.100.10

# Ex 2: A collection of hosts belonging to the ‘webservers’ group

## [webservers]
## alpha.example.org
## beta.example.org
## 192.168.1.100
## 192.168.1.110

# If you have multiple hosts following a pattern you can specify
# them like this:

## www[001:006].example.com

# Ex 3: A collection of database servers in the ‘dbservers’ group

## [dbservers]
##
## db01.intranet.mydomain.net
## db02.intranet.mydomain.net
## 10.25.1.56
## 10.25.1.57

# Here’s another example of host ranges, this time there are no
# leading 0s:

## db-[99:101]-node.example.com
======================================================================
[root@localhost ~]# hostnamectl set-hostname aserver.example.org

[root@localhost ~]# hostnamectl
Static hostname: aserver.example.org
Icon name: computer-vm
Chassis: vm
Machine ID: 15e602f4fd8a4b0ab9c7b03f91efd945
Boot ID: b5fc7fe5aaea4f0888e55ce6d8296547
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@localhost ~]# hostname
aserver.example.org

[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.43.133 aserver.example.org

[root@localhost ~]# hostname –fqdn
aserver.example.org
======================================================================
[root@localhost ~]# logout
Connection to 192.168.43.133 closed.
mohammedrafi@NOC-RAFI:~$ ssh root@192.168.43.133
root@192.168.43.133’s password:
Last login: Wed Nov 16 03:35:29 2016 from 192.168.43.1
[root@aserver ~]#
======================================================================
[root@aserver ~]# echo “192.168.43.154 bserver.example.org” >> /etc/hosts

[root@aserver ~]# ping bserver.example.org
PING bserver.example.org (192.168.43.154) 56(84) bytes of data.
64 bytes from bserver.example.org (192.168.43.154): icmp_seq=1 ttl=64 time=0.502 ms
64 bytes from bserver.example.org (192.168.43.154): icmp_seq=2 ttl=64 time=0.430 ms
64 bytes from bserver.example.org (192.168.43.154): icmp_seq=3 ttl=64 time=0.411 ms
^C
— bserver.example.org ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.411/0.447/0.502/0.046 ms

======================================================================
[root@aserver ~]# ssh root@bserver.example.org
The authenticity of host ‘bserver.example.org (192.168.43.154)’ can’t be established.
ECDSA key fingerprint is e0:6e:80:3c:4e:6a:79:3e:0b:6d:08:9a:50:c6:ca:ac.
Are you sure you want to continue connecting (yes/no)? ^C

[root@aserver ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
66:d6:f7:cb:fd:a1:f5:2e:0a:dc:1c:7d:f0:a7:de:de root@aserver.example.org
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| |
| . |
| . . o |
| S . o . +|
| + . + o o.|
| o o oo |
| . o+++|
| .o++E|
+—————–+

[root@aserver ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@bserver.example.org
The authenticity of host ‘bserver.example.org (192.168.43.144)’ can’t be established.
ECDSA key fingerprint is e0:6e:80:3c:4e:6a:79:3e:0b:6d:08:9a:50:c6:ca:ac.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
root@bserver.example.org’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘root@bserver.example.org'”
and check to make sure that only the key(s) you wanted were added.

[root@aserver ~]# ssh root@bserver.example.org
Last login: Wed Nov 16 04:09:30 2016 from 192.168.43.1

[root@bserver ~]#

[root@bserver ~]# logout
Connection to bserver.example.org closed.
[root@aserver ~]#
======================================================================
[root@aserver ~]# ansible all -m ping
[WARNING]: provided hosts list is empty, only localhost is available

[WARNING]: No hosts matched, nothing to do
======================================================================
[root@aserver ~]# vim /etc/ansible/hosts
bserver.example.org

[root@aserver ~]# ansible all -m ping
bserver.example.org | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
======================================================================
[root@aserver ~]# ansible bserver.example.org -m ping
bserver.example.org | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
======================================================================
[root@aserver ~]#ansible bserver.example.org -a “/bin/echo hello”
bserver.example.org | SUCCESS | rc=0 >>
hello
######################## bserver ################################

[root@localhost ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:18:e7:65 brd ff:ff:ff:ff:ff:ff
inet 192.168.43.144/24 brd 192.168.43.255 scope global dynamic eno16777736
valid_lft 1705sec preferred_lft 1705sec
inet6 fe80::20c:29ff:fe18:e765/64 scope link
valid_lft forever preferred_lft forever
===========================================================
[root@localhost ~]# hostnamectl set-hostname bserver.example.org

[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.43.144 bserver.example.org

[root@localhost ~]# hostnamectl
Static hostname: bserver.example.org
Icon name: computer-vm
Chassis: vm
Machine ID: 15e602f4fd8a4b0ab9c7b03f91efd945
Boot ID: d955742096134722be2b1fc66f9b958d
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64

[root@localhost ~]# hostname –fqdn
bserver.example.org
===========================================================
[root@localhost ~]# logout
Connection to 192.168.43.144 closed.
mohammedrafi@NOC-RAFI:~$ ssh root@192.168.43.154
root@192.168.43.144’s password:
Last login: Wed Nov 16 03:57:47 2016 from 192.168.43.1

[root@bserver ~]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 963/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2052/master
tcp6 0 0 :::22 :::* LISTEN 963/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2052/master
=======================================================================

[root@aserver ~]# ansible all -i /etc/ansible/hosts -m ping
bserver.example.org | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
==========================================
[root@aserver ~]# ansible localhost -m setup
localhost | SUCCESS => {
“ansible_facts”: {
“ansible_all_ipv4_addresses”: [
“192.168.43.133”
],
“ansible_all_ipv6_addresses”: [
“fe80::20c:29ff:fe62:c0ef”
],
“ansible_architecture”: “x86_64”,
“ansible_bios_date”: “07/02/2015”,
“ansible_bios_version”: “6.00”,
“ansible_cmdline”: {
“BOOT_IMAGE”: “/vmlinuz-3.10.0-327.el7.x86_64”,
“LANG”: “en_US.UTF-8”,
“crashkernel”: “auto”,
“quiet”: true,
“rhgb”: true,
“ro”: true,
“root”: “UUID=6d37ac80-06f2-481a-b033-bb5e3394b6ca”
},
“ansible_date_time”: {
“date”: “2016-12-31”,
“day”: “31”,
“epoch”: “1483186127”,
“hour”: “07”,
“iso8601”: “2016-12-31T12:08:47Z”,
“iso8601_basic”: “20161231T070847986914”,
“iso8601_basic_short”: “20161231T070847”,
“iso8601_micro”: “2016-12-31T12:08:47.987218Z”,
“minute”: “08”,
“month”: “12”,
“second”: “47”,
“time”: “07:08:47”,
“tz”: “EST”,
“tz_offset”: “-0500”,
“weekday”: “Saturday”,
“weekday_number”: “6”,
“weeknumber”: “52”,
“year”: “2016”
},
“ansible_default_ipv4”: {
“address”: “192.168.43.133”,
“alias”: “eno16777736”,
“broadcast”: “192.168.43.255”,
“gateway”: “192.168.43.2”,
“interface”: “eno16777736”,
“macaddress”: “00:0c:29:62:c0:ef”,
“mtu”: 1500,
“netmask”: “255.255.255.0”,
“network”: “192.168.43.0”,
“type”: “ether”
},
“ansible_default_ipv6”: {},
“ansible_devices”: {
“sda”: {
“holders”: [],
“host”: “”,
“model”: “VMware Virtual S”,
“partitions”: {
“sda1”: {
“holders”: [],
“sectors”: “2048000”,
“sectorsize”: 512,
“size”: “1000.00 MB”,
“start”: “2048”,
“uuid”: “3fe22f94-b109-4293-9502-b830342a9a55”
},
“sda2”: {
“holders”: [],
“sectors”: “39892992”,
“sectorsize”: 512,
“size”: “19.02 GB”,
“start”: “2050048”,
“uuid”: “6d37ac80-06f2-481a-b033-bb5e3394b6ca”
}
},
“removable”: “0”,
“rotational”: “1”,
“sas_address”: null,
“sas_device_handle”: null,
“scheduler_mode”: “deadline”,
“sectors”: “41943040”,
“sectorsize”: “512”,
“size”: “20.00 GB”,
“support_discard”: “0”,
“vendor”: “VMware,”
},
“sr0”: {
“holders”: [],
“host”: “”,
“model”: “VMware IDE CDR10”,
“partitions”: {},
“removable”: “1”,
“rotational”: “1”,
“sas_address”: null,
“sas_device_handle”: null,
“scheduler_mode”: “cfq”,
“sectors”: “15175680”,
“sectorsize”: “2048”,
“size”: “28.95 GB”,
“support_discard”: “0”,
“vendor”: “NECVMWar”
}
},
“ansible_distribution”: “CentOS”,
“ansible_distribution_major_version”: “7”,
“ansible_distribution_release”: “Core”,
“ansible_distribution_version”: “7.2.1511”,
“ansible_dns”: {
“nameservers”: [
“192.168.43.2”
],
“search”: [
“localdomain”,
“example.org”
]
},
“ansible_domain”: “example.org”,
“ansible_eno16777736”: {
“active”: true,
“device”: “eno16777736”,
“features”: {
“busy_poll”: “off [fixed]”,
“fcoe_mtu”: “off [fixed]”,
“generic_receive_offload”: “on”,
“generic_segmentation_offload”: “on”,
“highdma”: “off [fixed]”,
“large_receive_offload”: “off [fixed]”,
“loopback”: “off [fixed]”,
“netns_local”: “off [fixed]”,
“ntuple_filters”: “off [fixed]”,
“receive_hashing”: “off [fixed]”,
“rx_all”: “off”,
“rx_checksumming”: “off”,
“rx_fcs”: “off”,
“rx_vlan_filter”: “on [fixed]”,
“rx_vlan_offload”: “on”,
“rx_vlan_stag_filter”: “off [fixed]”,
“rx_vlan_stag_hw_parse”: “off [fixed]”,
“scatter_gather”: “on”,
“tcp_segmentation_offload”: “on”,
“tx_checksum_fcoe_crc”: “off [fixed]”,
“tx_checksum_ip_generic”: “on”,
“tx_checksum_ipv4”: “off [fixed]”,
“tx_checksum_ipv6”: “off [fixed]”,
“tx_checksum_sctp”: “off [fixed]”,
“tx_checksumming”: “on”,
“tx_fcoe_segmentation”: “off [fixed]”,
“tx_gre_segmentation”: “off [fixed]”,
“tx_gso_robust”: “off [fixed]”,
“tx_ipip_segmentation”: “off [fixed]”,
“tx_lockless”: “off [fixed]”,
“tx_mpls_segmentation”: “off [fixed]”,
“tx_nocache_copy”: “off”,
“tx_scatter_gather”: “on”,
“tx_scatter_gather_fraglist”: “off [fixed]”,
“tx_sit_segmentation”: “off [fixed]”,
“tx_tcp6_segmentation”: “off [fixed]”,
“tx_tcp_ecn_segmentation”: “off [fixed]”,
“tx_tcp_segmentation”: “on”,
“tx_udp_tnl_segmentation”: “off [fixed]”,
“tx_vlan_offload”: “on [fixed]”,
“tx_vlan_stag_hw_insert”: “off [fixed]”,
“udp_fragmentation_offload”: “off [fixed]”,
“vlan_challenged”: “off [fixed]”
},
“ipv4”: {
“address”: “192.168.43.133”,
“broadcast”: “192.168.43.255”,
“netmask”: “255.255.255.0”,
“network”: “192.168.43.0”
},
“ipv6”: [
{
“address”: “fe80::20c:29ff:fe62:c0ef”,
“prefix”: “64”,
“scope”: “link”
}
],
“macaddress”: “00:0c:29:62:c0:ef”,
“module”: “e1000”,
“mtu”: 1500,
“pciid”: “0000:02:01.0”,
“promisc”: false,
“speed”: 1000,
“type”: “ether”
},
“ansible_env”: {
“HISTCONTROL”: “ignoredups”,
“HISTSIZE”: “1000”,
“HOME”: “/root”,
“HOSTNAME”: “aserver.example.org”,
“LANG”: “en_IN”,
“LESSOPEN”: “||/usr/bin/lesspipe.sh %s”,
“LOGNAME”: “root”,
“LS_COLORS”: “rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:”,
“MAIL”: “/var/spool/mail/root”,
“PATH”: “/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin”,
“PWD”: “/root”,
“SHELL”: “/bin/bash”,
“SHLVL”: “3”,
“SSH_CLIENT”: “192.168.43.1 38051 22”,
“SSH_CONNECTION”: “192.168.43.1 38051 192.168.43.133 22”,
“SSH_TTY”: “/dev/pts/0”,
“TERM”: “xterm”,
“USER”: “root”,
“XDG_RUNTIME_DIR”: “/run/user/0”,
“XDG_SESSION_ID”: “2”,
“_”: “/usr/bin/python2”
},
“ansible_fips”: false,
“ansible_form_factor”: “Other”,
“ansible_fqdn”: “aserver.example.org”,
“ansible_gather_subset”: [
“hardware”,
“network”,
“virtual”
],
“ansible_hostname”: “aserver”,
“ansible_interfaces”: [
“lo”,
“eno16777736”
],
“ansible_kernel”: “3.10.0-327.el7.x86_64”,
“ansible_lo”: {
“active”: true,
“device”: “lo”,
“features”: {
“busy_poll”: “off [fixed]”,
“fcoe_mtu”: “off [fixed]”,
“generic_receive_offload”: “on”,
“generic_segmentation_offload”: “on”,
“highdma”: “on [fixed]”,
“large_receive_offload”: “off [fixed]”,
“loopback”: “on [fixed]”,
“netns_local”: “on [fixed]”,
“ntuple_filters”: “off [fixed]”,
“receive_hashing”: “off [fixed]”,
“rx_all”: “off [fixed]”,
“rx_checksumming”: “on [fixed]”,
“rx_fcs”: “off [fixed]”,
“rx_vlan_filter”: “off [fixed]”,
“rx_vlan_offload”: “off [fixed]”,
“rx_vlan_stag_filter”: “off [fixed]”,
“rx_vlan_stag_hw_parse”: “off [fixed]”,
“scatter_gather”: “on”,
“tcp_segmentation_offload”: “on”,
“tx_checksum_fcoe_crc”: “off [fixed]”,
“tx_checksum_ip_generic”: “on [fixed]”,
“tx_checksum_ipv4”: “off [fixed]”,
“tx_checksum_ipv6”: “off [fixed]”,
“tx_checksum_sctp”: “off [fixed]”,
“tx_checksumming”: “on”,
“tx_fcoe_segmentation”: “off [fixed]”,
“tx_gre_segmentation”: “off [fixed]”,
“tx_gso_robust”: “off [fixed]”,
“tx_ipip_segmentation”: “off [fixed]”,
“tx_lockless”: “on [fixed]”,
“tx_mpls_segmentation”: “off [fixed]”,
“tx_nocache_copy”: “off [fixed]”,
“tx_scatter_gather”: “on [fixed]”,
“tx_scatter_gather_fraglist”: “on [fixed]”,
“tx_sit_segmentation”: “off [fixed]”,
“tx_tcp6_segmentation”: “on”,
“tx_tcp_ecn_segmentation”: “on”,
“tx_tcp_segmentation”: “on”,
“tx_udp_tnl_segmentation”: “off [fixed]”,
“tx_vlan_offload”: “off [fixed]”,
“tx_vlan_stag_hw_insert”: “off [fixed]”,
“udp_fragmentation_offload”: “on”,
“vlan_challenged”: “on [fixed]”
},
“ipv4”: {
“address”: “127.0.0.1”,
“broadcast”: “host”,
“netmask”: “255.0.0.0”,
“network”: “127.0.0.0”
},
“ipv6”: [
{
“address”: “::1”,
“prefix”: “128”,
“scope”: “host”
}
],
“mtu”: 65536,
“promisc”: false,
“type”: “loopback”
},
“ansible_machine”: “x86_64”,
“ansible_machine_id”: “15e602f4fd8a4b0ab9c7b03f91efd945”,
“ansible_memfree_mb”: 393,
“ansible_memory_mb”: {
“nocache”: {
“free”: 517,
“used”: 196
},
“real”: {
“free”: 393,
“total”: 713,
“used”: 320
},
“swap”: {
“cached”: 0,
“free”: 0,
“total”: 0,
“used”: 0
}
},
“ansible_memtotal_mb”: 713,
“ansible_mounts”: [
{
“device”: “/dev/sda2”,
“fstype”: “ext4”,
“mount”: “/”,
“options”: “rw,relatime,data=ordered”,
“size_available”: 17854824448,
“size_total”: 19971829760,
“uuid”: “6d37ac80-06f2-481a-b033-bb5e3394b6ca”
},
{
“device”: “/dev/sda1”,
“fstype”: “ext4”,
“mount”: “/boot”,
“options”: “rw,relatime,data=ordered”,
“size_available”: 847273984,
“size_total”: 1015308288,
“uuid”: “3fe22f94-b109-4293-9502-b830342a9a55”
}
],
“ansible_nodename”: “aserver.example.org”,
“ansible_os_family”: “RedHat”,
“ansible_pkg_mgr”: “yum”,
“ansible_processor”: [
“GenuineIntel”,
“Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz”
],
“ansible_processor_cores”: 1,
“ansible_processor_count”: 1,
“ansible_processor_threads_per_core”: 1,
“ansible_processor_vcpus”: 1,
“ansible_product_name”: “VMware Virtual Platform”,
“ansible_product_serial”: “VMware-56 4d 52 ba 4a 97 1c 1a-3a c9 3c b9 88 62 c0 ef”,
“ansible_product_uuid”: “564D52BA-4A97-1C1A-3AC9-3CB98862C0EF”,
“ansible_product_version”: “None”,
“ansible_python”: {
“executable”: “/usr/bin/python2”,
“has_sslcontext”: true,
“type”: “CPython”,
“version”: {
“major”: 2,
“micro”: 5,
“minor”: 7,
“releaselevel”: “final”,
“serial”: 0
},
“version_info”: [
2,
7,
5,
“final”,
0
]
},
“ansible_python_version”: “2.7.5”,
“ansible_selinux”: {
“status”: “disabled”
},
“ansible_service_mgr”: “systemd”,
“ansible_ssh_host_key_ecdsa_public”: “AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLi6ovzNiq1ECapmV7Uxox8833gwrsqmlFxoOBnb0VdkncxbiVCjgdC3OG17i09pc+kB2WM53XZpFN3OsdrZZtY=”,
“ansible_ssh_host_key_ed25519_public”: “AAAAC3NzaC1lZDI1NTE5AAAAIK884xM/LCkV52po1VVbxTuFnclEsxZwEEcKJsGgQiC0”,
“ansible_ssh_host_key_rsa_public”: “AAAAB3NzaC1yc2EAAAADAQABAAABAQDReQHUQ0Fe6nA4rA8B8R6+pM8xOAkp/BpfnI661gUBcmNtOdlA2hmwFXN5Jk3ARMLtAecJWDnF5L4mI3WVabPt8aIkQEN93upOQV1ZyWIB5bKX6KuecyXY2cCBpKpqQ8YBOhKOlLAOodcTZjw350s38MAVKhpdFRePbhw4N7h+Gpxn9TMPmzmDjiSWcFv92hR/4uh9z1wREF8NJoRuEF0/jlR6ZWG+MPoEo0p7msqIrEjdotC/YfHOgk/bv6FxMcZNoFBVeA/jahxgH0N1C/cupLWk14hSXBuyowurtTh4+HxoR1eSBwq/p3yIWEIOvvtYHOswiUtespM1162aDyPf”,
“ansible_swapfree_mb”: 0,
“ansible_swaptotal_mb”: 0,
“ansible_system”: “Linux”,
“ansible_system_capabilities”: [
“cap_chown”,
“cap_dac_override”,
“cap_dac_read_search”,
“cap_fowner”,
“cap_fsetid”,
“cap_kill”,
“cap_setgid”,
“cap_setuid”,
“cap_setpcap”,
“cap_linux_immutable”,
“cap_net_bind_service”,
“cap_net_broadcast”,
“cap_net_admin”,
“cap_net_raw”,
“cap_ipc_lock”,
“cap_ipc_owner”,
“cap_sys_module”,
“cap_sys_rawio”,
“cap_sys_chroot”,
“cap_sys_ptrace”,
“cap_sys_pacct”,
“cap_sys_admin”,
“cap_sys_boot”,
“cap_sys_nice”,
“cap_sys_resource”,
“cap_sys_time”,
“cap_sys_tty_config”,
“cap_mknod”,
“cap_lease”,
“cap_audit_write”,
“cap_audit_control”,
“cap_setfcap”,
“cap_mac_override”,
“cap_mac_admin”,
“cap_syslog”,
“35”,
“36+ep”
],
“ansible_system_capabilities_enforced”: “True”,
“ansible_system_vendor”: “VMware, Inc.”,
“ansible_uptime_seconds”: 3495,
“ansible_user_dir”: “/root”,
“ansible_user_gecos”: “root”,
“ansible_user_gid”: 0,
“ansible_user_id”: “root”,
“ansible_user_shell”: “/bin/bash”,
“ansible_user_uid”: 0,
“ansible_userspace_architecture”: “x86_64”,
“ansible_userspace_bits”: “64”,
“ansible_virtualization_role”: “guest”,
“ansible_virtualization_type”: “VMware”,
“module_setup”: true
},
“changed”: false
}
=================================================
[root@aserver ~]# ansible apache -m command -a “uptime”
bserver.example.org | SUCCESS | rc=0 >>
07:15:51 up 46 min, 3 users, load average: 0.00, 0.01, 0.05
=================================================
[root@aserver ~]# ansible bserver.example.org -m setup
bserver.example.org | SUCCESS => {
“ansible_facts”: {
“ansible_all_ipv4_addresses”: [
“192.168.43.154”
],
“ansible_all_ipv6_addresses”: [
“fe80::20c:29ff:fe7a:d096”
],
“ansible_architecture”: “x86_64”,
“ansible_bios_date”: “07/02/2015”,
“ansible_bios_version”: “6.00”,
“ansible_cmdline”: {
“BOOT_IMAGE”: “/vmlinuz-3.10.0-327.el7.x86_64”,
“LANG”: “en_US.UTF-8”,
“crashkernel”: “auto”,
“quiet”: true,
“rhgb”: true,
“ro”: true,
“root”: “UUID=6d37ac80-06f2-481a-b033-bb5e3394b6ca”
},
“ansible_date_time”: {
“date”: “2016-12-31”,
“day”: “31”,
“epoch”: “1483187290”,
“hour”: “07”,
“iso8601”: “2016-12-31T12:28:10Z”,
“iso8601_basic”: “20161231T072810985396”,
“iso8601_basic_short”: “20161231T072810”,
“iso8601_micro”: “2016-12-31T12:28:10.986209Z”,
“minute”: “28”,
“month”: “12”,
“second”: “10”,
“time”: “07:28:10”,
“tz”: “EST”,
“tz_offset”: “-0500”,
“weekday”: “Saturday”,
“weekday_number”: “6”,
“weeknumber”: “52”,
“year”: “2016”
},
“ansible_default_ipv4”: {
“address”: “192.168.43.154”,
“alias”: “eno16777736”,
“broadcast”: “192.168.43.255”,
“gateway”: “192.168.43.2”,
“interface”: “eno16777736”,
“macaddress”: “00:0c:29:7a:d0:96”,
“mtu”: 1500,
“netmask”: “255.255.255.0”,
“network”: “192.168.43.0”,
“type”: “ether”
},
“ansible_default_ipv6”: {},
“ansible_devices”: {
“sda”: {
“holders”: [],
“host”: “”,
“model”: “VMware Virtual S”,
“partitions”: {
“sda1”: {
“holders”: [],
“sectors”: “2048000”,
“sectorsize”: 512,
“size”: “1000.00 MB”,
“start”: “2048”,
“uuid”: “3fe22f94-b109-4293-9502-b830342a9a55”
},
“sda2”: {
“holders”: [],
“sectors”: “39892992”,
“sectorsize”: 512,
“size”: “19.02 GB”,
“start”: “2050048”,
“uuid”: “6d37ac80-06f2-481a-b033-bb5e3394b6ca”
}
},
“removable”: “0”,
“rotational”: “1”,
“sas_address”: null,
“sas_device_handle”: null,
“scheduler_mode”: “deadline”,
“sectors”: “41943040”,
“sectorsize”: “512”,
“size”: “20.00 GB”,
“support_discard”: “0”,
“vendor”: “VMware,”
},
“sr0”: {
“holders”: [],
“host”: “”,
“model”: “VMware IDE CDR10”,
“partitions”: {},
“removable”: “1”,
“rotational”: “1”,
“sas_address”: null,
“sas_device_handle”: null,
“scheduler_mode”: “cfq”,
“sectors”: “15175680”,
“sectorsize”: “2048”,
“size”: “28.95 GB”,
“support_discard”: “0”,
“vendor”: “NECVMWar”
}
},
“ansible_distribution”: “CentOS”,
“ansible_distribution_major_version”: “7”,
“ansible_distribution_release”: “Core”,
“ansible_distribution_version”: “7.2.1511”,
“ansible_dns”: {
“nameservers”: [
“192.168.43.2”
],
“search”: [
“localdomain”,
“example.org”
]
},
“ansible_domain”: “example.org”,
“ansible_eno16777736”: {
“active”: true,
“device”: “eno16777736”,
“features”: {
“busy_poll”: “off [fixed]”,
“fcoe_mtu”: “off [fixed]”,
“generic_receive_offload”: “on”,
“generic_segmentation_offload”: “on”,
“highdma”: “off [fixed]”,
“large_receive_offload”: “off [fixed]”,
“loopback”: “off [fixed]”,
“netns_local”: “off [fixed]”,
“ntuple_filters”: “off [fixed]”,
“receive_hashing”: “off [fixed]”,
“rx_all”: “off”,
“rx_checksumming”: “off”,
“rx_fcs”: “off”,
“rx_vlan_filter”: “on [fixed]”,
“rx_vlan_offload”: “on”,
“rx_vlan_stag_filter”: “off [fixed]”,
“rx_vlan_stag_hw_parse”: “off [fixed]”,
“scatter_gather”: “on”,
“tcp_segmentation_offload”: “on”,
“tx_checksum_fcoe_crc”: “off [fixed]”,
“tx_checksum_ip_generic”: “on”,
“tx_checksum_ipv4”: “off [fixed]”,
“tx_checksum_ipv6”: “off [fixed]”,
“tx_checksum_sctp”: “off [fixed]”,
“tx_checksumming”: “on”,
“tx_fcoe_segmentation”: “off [fixed]”,
“tx_gre_segmentation”: “off [fixed]”,
“tx_gso_robust”: “off [fixed]”,
“tx_ipip_segmentation”: “off [fixed]”,
“tx_lockless”: “off [fixed]”,
“tx_mpls_segmentation”: “off [fixed]”,
“tx_nocache_copy”: “off”,
“tx_scatter_gather”: “on”,
“tx_scatter_gather_fraglist”: “off [fixed]”,
“tx_sit_segmentation”: “off [fixed]”,
“tx_tcp6_segmentation”: “off [fixed]”,
“tx_tcp_ecn_segmentation”: “off [fixed]”,
“tx_tcp_segmentation”: “on”,
“tx_udp_tnl_segmentation”: “off [fixed]”,
“tx_vlan_offload”: “on [fixed]”,
“tx_vlan_stag_hw_insert”: “off [fixed]”,
“udp_fragmentation_offload”: “off [fixed]”,
“vlan_challenged”: “off [fixed]”
},
“ipv4”: {
“address”: “192.168.43.154”,
“broadcast”: “192.168.43.255”,
“netmask”: “255.255.255.0”,
“network”: “192.168.43.0”
},
“ipv6”: [
{
“address”: “fe80::20c:29ff:fe7a:d096”,
“prefix”: “64”,
“scope”: “link”
}
],
“macaddress”: “00:0c:29:7a:d0:96”,
“module”: “e1000”,
“mtu”: 1500,
“pciid”: “0000:02:01.0”,
“promisc”: false,
“speed”: 1000,
“type”: “ether”
},
“ansible_env”: {
“HOME”: “/root”,
“LANG”: “en_IN”,
“LESSOPEN”: “||/usr/bin/lesspipe.sh %s”,
“LOGNAME”: “root”,
“MAIL”: “/var/mail/root”,
“PATH”: “/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin”,
“PWD”: “/root”,
“SELINUX_LEVEL_REQUESTED”: “”,
“SELINUX_ROLE_REQUESTED”: “”,
“SELINUX_USE_CURRENT_RANGE”: “”,
“SHELL”: “/bin/bash”,
“SHLVL”: “2”,
“SSH_CLIENT”: “192.168.43.133 42908 22”,
“SSH_CONNECTION”: “192.168.43.133 42908 192.168.43.154 22”,
“SSH_TTY”: “/dev/pts/1”,
“TERM”: “xterm”,
“USER”: “root”,
“XDG_RUNTIME_DIR”: “/run/user/0”,
“XDG_SESSION_ID”: “12”,
“_”: “/usr/bin/python”
},
“ansible_fips”: false,
“ansible_form_factor”: “Other”,
“ansible_fqdn”: “bserver.example.org”,
“ansible_gather_subset”: [
“hardware”,
“network”,
“virtual”
],
“ansible_hostname”: “bserver”,
“ansible_interfaces”: [
“lo”,
“eno16777736”
],
“ansible_kernel”: “3.10.0-327.el7.x86_64”,
“ansible_lo”: {
“active”: true,
“device”: “lo”,
“features”: {
“busy_poll”: “off [fixed]”,
“fcoe_mtu”: “off [fixed]”,
“generic_receive_offload”: “on”,
“generic_segmentation_offload”: “on”,
“highdma”: “on [fixed]”,
“large_receive_offload”: “off [fixed]”,
“loopback”: “on [fixed]”,
“netns_local”: “on [fixed]”,
“ntuple_filters”: “off [fixed]”,
“receive_hashing”: “off [fixed]”,
“rx_all”: “off [fixed]”,
“rx_checksumming”: “on [fixed]”,
“rx_fcs”: “off [fixed]”,
“rx_vlan_filter”: “off [fixed]”,
“rx_vlan_offload”: “off [fixed]”,
“rx_vlan_stag_filter”: “off [fixed]”,
“rx_vlan_stag_hw_parse”: “off [fixed]”,
“scatter_gather”: “on”,
“tcp_segmentation_offload”: “on”,
“tx_checksum_fcoe_crc”: “off [fixed]”,
“tx_checksum_ip_generic”: “on [fixed]”,
“tx_checksum_ipv4”: “off [fixed]”,
“tx_checksum_ipv6”: “off [fixed]”,
“tx_checksum_sctp”: “off [fixed]”,
“tx_checksumming”: “on”,
“tx_fcoe_segmentation”: “off [fixed]”,
“tx_gre_segmentation”: “off [fixed]”,
“tx_gso_robust”: “off [fixed]”,
“tx_ipip_segmentation”: “off [fixed]”,
“tx_lockless”: “on [fixed]”,
“tx_mpls_segmentation”: “off [fixed]”,
“tx_nocache_copy”: “off [fixed]”,
“tx_scatter_gather”: “on [fixed]”,
“tx_scatter_gather_fraglist”: “on [fixed]”,
“tx_sit_segmentation”: “off [fixed]”,
“tx_tcp6_segmentation”: “on”,
“tx_tcp_ecn_segmentation”: “on”,
“tx_tcp_segmentation”: “on”,
“tx_udp_tnl_segmentation”: “off [fixed]”,
“tx_vlan_offload”: “off [fixed]”,
“tx_vlan_stag_hw_insert”: “off [fixed]”,
“udp_fragmentation_offload”: “on”,
“vlan_challenged”: “on [fixed]”
},
“ipv4”: {
“address”: “127.0.0.1”,
“broadcast”: “host”,
“netmask”: “255.0.0.0”,
“network”: “127.0.0.0”
},
“ipv6”: [
{
“address”: “::1”,
“prefix”: “128”,
“scope”: “host”
}
],
“mtu”: 65536,
“promisc”: false,
“type”: “loopback”
},
“ansible_machine”: “x86_64”,
“ansible_machine_id”: “15e602f4fd8a4b0ab9c7b03f91efd945”,
“ansible_memfree_mb”: 264,
“ansible_memory_mb”: {
“nocache”: {
“free”: 511,
“used”: 202
},
“real”: {
“free”: 264,
“total”: 713,
“used”: 449
},
“swap”: {
“cached”: 0,
“free”: 0,
“total”: 0,
“used”: 0
}
},
“ansible_memtotal_mb”: 713,
“ansible_mounts”: [
{
“device”: “/dev/sda2”,
“fstype”: “ext4”,
“mount”: “/”,
“options”: “rw,seclabel,relatime,data=ordered”,
“size_available”: 18018615296,
“size_total”: 19971829760,
“uuid”: “6d37ac80-06f2-481a-b033-bb5e3394b6ca”
},
{
“device”: “/dev/sda1”,
“fstype”: “ext4”,
“mount”: “/boot”,
“options”: “rw,seclabel,relatime,data=ordered”,
“size_available”: 847273984,
“size_total”: 1015308288,
“uuid”: “3fe22f94-b109-4293-9502-b830342a9a55”
}
],
“ansible_nodename”: “bserver.example.org”,
“ansible_os_family”: “RedHat”,
“ansible_pkg_mgr”: “yum”,
“ansible_processor”: [
“GenuineIntel”,
“Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz”
],
“ansible_processor_cores”: 1,
“ansible_processor_count”: 1,
“ansible_processor_threads_per_core”: 1,
“ansible_processor_vcpus”: 1,
“ansible_product_name”: “VMware Virtual Platform”,
“ansible_product_serial”: “VMware-56 4d d5 66 3c 96 d2 83-98 f5 b0 57 1b 7a d0 96”,
“ansible_product_uuid”: “564DD566-3C96-D283-98F5-B0571B7AD096”,
“ansible_product_version”: “None”,
“ansible_python”: {
“executable”: “/usr/bin/python”,
“has_sslcontext”: true,
“type”: “CPython”,
“version”: {
“major”: 2,
“micro”: 5,
“minor”: 7,
“releaselevel”: “final”,
“serial”: 0
},
“version_info”: [
2,
7,
5,
“final”,
0
]
},
“ansible_python_version”: “2.7.5”,
“ansible_selinux”: {
“config_mode”: “enforcing”,
“mode”: “enforcing”,
“policyvers”: 28,
“status”: “enabled”,
“type”: “targeted”
},
“ansible_service_mgr”: “systemd”,
“ansible_ssh_host_key_ecdsa_public”: “AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLi6ovzNiq1ECapmV7Uxox8833gwrsqmlFxoOBnb0VdkncxbiVCjgdC3OG17i09pc+kB2WM53XZpFN3OsdrZZtY=”,
“ansible_ssh_host_key_ed25519_public”: “AAAAC3NzaC1lZDI1NTE5AAAAIK884xM/LCkV52po1VVbxTuFnclEsxZwEEcKJsGgQiC0”,
“ansible_ssh_host_key_rsa_public”: “AAAAB3NzaC1yc2EAAAADAQABAAABAQDReQHUQ0Fe6nA4rA8B8R6+pM8xOAkp/BpfnI661gUBcmNtOdlA2hmwFXN5Jk3ARMLtAecJWDnF5L4mI3WVabPt8aIkQEN93upOQV1ZyWIB5bKX6KuecyXY2cCBpKpqQ8YBOhKOlLAOodcTZjw350s38MAVKhpdFRePbhw4N7h+Gpxn9TMPmzmDjiSWcFv92hR/4uh9z1wREF8NJoRuEF0/jlR6ZWG+MPoEo0p7msqIrEjdotC/YfHOgk/bv6FxMcZNoFBVeA/jahxgH0N1C/cupLWk14hSXBuyowurtTh4+HxoR1eSBwq/p3yIWEIOvvtYHOswiUtespM1162aDyPf”,
“ansible_swapfree_mb”: 0,
“ansible_swaptotal_mb”: 0,
“ansible_system”: “Linux”,
“ansible_system_capabilities”: [
“cap_chown”,
“cap_dac_override”,
“cap_dac_read_search”,
“cap_fowner”,
“cap_fsetid”,
“cap_kill”,
“cap_setgid”,
“cap_setuid”,
“cap_setpcap”,
“cap_linux_immutable”,
“cap_net_bind_service”,
“cap_net_broadcast”,
“cap_net_admin”,
“cap_net_raw”,
“cap_ipc_lock”,
“cap_ipc_owner”,
“cap_sys_module”,
“cap_sys_rawio”,
“cap_sys_chroot”,
“cap_sys_ptrace”,
“cap_sys_pacct”,
“cap_sys_admin”,
“cap_sys_boot”,
“cap_sys_nice”,
“cap_sys_resource”,
“cap_sys_time”,
“cap_sys_tty_config”,
“cap_mknod”,
“cap_lease”,
“cap_audit_write”,
“cap_audit_control”,
“cap_setfcap”,
“cap_mac_override”,
“cap_mac_admin”,
“cap_syslog”,
“35”,
“36+ep”
],
“ansible_system_capabilities_enforced”: “True”,
“ansible_system_vendor”: “VMware, Inc.”,
“ansible_uptime_seconds”: 3503,
“ansible_user_dir”: “/root”,
“ansible_user_gecos”: “root”,
“ansible_user_gid”: 0,
“ansible_user_id”: “root”,
“ansible_user_shell”: “/bin/bash”,
“ansible_user_uid”: 0,
“ansible_userspace_architecture”: “x86_64”,
“ansible_userspace_bits”: “64”,
“ansible_virtualization_role”: “guest”,
“ansible_virtualization_type”: “VMware”,
“module_setup”: true
},
“changed”: false
}
================================================

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s