0

I'm encountering an issue with my Ansible playbook when attempting to run it against a group of hosts defined in my inventory. Despite being able to SSH into the servers directly, when I run my playbook, I get an error for the master group indicating that Ansible cannot resolve the hostname:

fatal: [master]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname master: nodename nor servname provided, or not known", "unreachable": true}

Here's my inventory.ini:

[all:vars]
ansible_user=root

[cluster]
master
worker

[master]
nuc1
nuc2

[worker]
CPU
GPU

[CPU]
server ...

[GPU]
server1 ...
server2 ...

[admin]
admin-pc ...

[nuc]
...

[thinksystem]
...

1 Answer 1

1

I have fixed the problem with the :children directive, which is used for defining groups within groups, as shown below:

[all:vars]
ansible_user=root

[cluster:children]
master
worker

[master]
nuc1
nuc2

[worker:children]
CPU
GPU

[CPU]
server ...

[GPU]
server1 ...
server2 ...

[admin]
admin-pc ...

[nuc]
...

[thinksystem]
...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.