How to filter IP address of remote system in Ansible

0 votes

Hi Guys,

I have configured the Ansible controller node in my system. I want to find out the IP address of all managed nodes. How can I do that?

Aug 20, 2020 in Ansible by akhtar
• 38,210 points
752 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the filter keyword in your ansible-playbook. It will fetch the data of your manages nodes using setup modules. I have attached one example below.

- name: Gather facts from new server
  setup:
    filter: ansible_default_ipv4.address
answered Aug 20, 2020 by MD
• 95,300 points
Hi@MD,

Thanks, it worked for me as well. Can you explain more about facts in Ansible ?

Hi,

Facts is a task that Ansible runs by default to every node. This task will gather all the information about those nodes. I suggest you just go through the official document of Ansible facts. You will get all the information with an example. I have attached the link below.

https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html

Related Questions In Ansible

0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,300 points
4,520 views
0 votes
1 answer

How to find the memory of remote systems using the setup module in Ansible?

Hi@akhtar, You need to use the setup module to ...READ MORE

answered Aug 10, 2020 in Ansible by MD
• 95,300 points
1,632 views
0 votes
1 answer

How to disable swap in remote system using Ansible?

Hi@akhtar, You can use the mount module in ...READ MORE

answered Sep 16, 2020 in Ansible by MD
• 95,300 points
2,090 views
0 votes
1 answer

How to install Ansible in Linux system?

Hi@akhtar, To install Ansible in your Linux system, ...READ MORE

answered Jul 27, 2020 in Ansible by MD
• 95,300 points
166 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,257 views
+2 votes
1 answer
0 votes
1 answer

How to copy files in remote system using Ansible?

Hi@akhtar, You need to use the copy module ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,300 points
327 views
0 votes
1 answer

How to start httpd service in a remote system using Ansible?

Hi@akhtar, Ansible has a module named service. This ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,300 points
756 views