I have hosts without stable hostnames, but with predefined IP ranges.
How can I set the IP range for Ansible inventory file?
I'm trying to setup something like this:
test.ini:
[database]
db ansible_ssh_host=1.1.1.[20:25] ansible_ssh_port=22
[lemp]
lemp ansible_ssh_host=1.1.1.[10:15] ansible_ssh_port=22
And now I get this error after running ansible-playbook -i test.ini
:
fatal: [db] => SSH Error: ssh: Could not resolve hostname 1.1.1.[20:25]: Name or service not known
I found this working solution for my problem:
test.ini:
# I removed hostname section and ansible_ssh_host=
10.0.3.[20:25] ansible_ssh_port=22
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With