0

Need a little hint on yaml syntax for a very simple inventory file.

I want to include dhcp range of workstations in a nice inventory file. Regarding the official documentation this could be done but i'm not on the right track Need a little clue.

---
all:
  hosts:
    site0:
      hosts:
        192.168.0.[100:200]
    site1:
      hosts:
        192.168.1.[100:200]
    site2:
      hosts:
        192.164.2.[100:200]
    site3:
      hosts:
        192.168.3.[1.50]

Can someone help me to achieve this ? Thanks

  • 1
    appart from the missing semi-colons at the end of every line with an ip/range in your above file to make it a correct yaml hence a correct yaml ansible inventory, what is the exact problem you are facing ? – Zeitounator Mar 31 '22 at 17:56
  • Hi thanks for your help. I added the semicolon. Still i have this error : `site0 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname site0: Name or service not known", "unreachable": true } ` – infoman33 Apr 08 '22 at 08:05
  • Sorry typo in my first message, I should have written "colons". Meanwhile, veryfing your file with `yamllint` and/or `ansible-lint` and/or `ansible-inventory` should give you a direct clue. – Zeitounator Apr 08 '22 at 08:49

0 Answers0