Sunday, July 14, 2019

# Gathering Ansible facts from remote server


===========================================

You can get remote severs facts using ad-hoc commands.
============================================

[root@ansimaster:/etc/ansible]#ansible webservers -m setup -a 'filter=ansible_dns'
192.168.122.50 | SUCCESS => {
    "ansible_facts": {
        "ansible_dns": {
            "nameservers": [
                "192.168.122.1"
            ],
            "search": [
                "default"
            ]
        }
    },
    "changed": false
}
[root@ansimaster:/etc/ansible]# ansible webservers -m setup -a 'filter=ansible_bios'
192.168.122.50 | SUCCESS => {
    "ansible_facts": {},
    "changed": false
}
[root@ansimaster:/etc/ansible]#
[root@ansimaster:/etc/ansible]# \ ansible 03:16 PM]
[root@ansimaster:/etc/ansible]# \ ansible 03:16 PM]ansible webservers -m setup -a 'filter=ansible_bios_version'
192.168.122.50 | SUCCESS => {
    "ansible_facts": {
        "ansible_bios_version": "0.5.1"
    },
    "changed": false
}
[root@ansimaster:/etc/ansible]# \ ansible 03:17 PM]ansible webservers -m setup -a 'filter=ansible_bios_date'
192.168.122.50 | SUCCESS => {
    "ansible_facts": {
        "ansible_bios_date": "01/01/2011"
    },
    "changed": false
}
[root@ansimaster:/etc/ansible]#
[root@ansimaster:/etc/ansible]# ansible webservers -m setup -a 'filter=ansible_cmdline'
192.168.122.50 | SUCCESS => {
    "ansible_facts": {
        "ansible_cmdline": {
            "BOOT_IMAGE": "/vmlinuz-3.10.0-514.el7.x86_64",
            "LANG": "en_US.UTF-8",
            "crashkernel": "auto",
            "quiet": true,
            "rd.lvm.lv": "cl_web1/swap",
            "rhgb": true,
            "ro": true,
            "root": "/dev/mapper/cl_web1-root"
        }
    },
    "changed": false
}

No comments:

Post a Comment

kubernetes Pod Scheduling

 ===================   Deployment ================= 1.) Deployment without any nodeName or nodeSelector, pod will spread among all of the av...