How to create a group of Managed Nodes in Ansible

0 votes

Hi Guys,

I have three managed nodes in Ansible. I want to create two groups of these Managed nodes. How can I do that?

Aug 1, 2020 in Ansible by akhtar
• 38,230 points
958 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use tags in your inventory file. It will act as a group of nodes. You can see the below example.

[web]
192.168.0.179   ansible_ssh_user=root   ansible_ssh_pass=redhat
[server]
192.168.0.180   ansible_ssh_user=root   ansible_ssh_pass=redhat

Now you can run Ansible command group-wise as shown below.

[root@localhost ~]# ansible web -m ping
192.168.0.179 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "ping": "pong"
}
answered Aug 1, 2020 by MD
• 95,440 points

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,440 points
13,075 views
0 votes
1 answer

How to create a variable in Ansible Playbook?

Hi@akhtar, Variable in playbooks are very similar to using variables in ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,440 points
1,043 views
0 votes
1 answer

How to capture the output of a task in Ansible Playbook?

Hi@akhtar, Ansible registers module used to capture/store the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,440 points
14,289 views
0 votes
1 answer

How to create a role in Ansible?

Hi@akhtar, You can create a role in Ansible ...READ MORE

answered Aug 20, 2020 in Ansible by MD
• 95,440 points
592 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,439 views
+2 votes
1 answer
0 votes
1 answer

How to create a security group in AWS using Ansible-Playbook?

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

answered Aug 13, 2020 in Ansible by MD
• 95,440 points
3,368 views
0 votes
2 answers

How to create a directory in remote nodes using Ansible-Playbook?

You can read install and setup apache ...READ MORE

answered Aug 23, 2020 in Ansible by anonymous
• 160 points
3,551 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP