teslamotors / ansible_puller

Ansible daemon for massively-scaleable Ansible
MIT License
129 stars 35 forks source link

Adding IP support to the inventory so that you can use ip address instead of simply hostnames as a way to designate hosts in your inventories #2

Closed nfelsen closed 5 years ago

nfelsen commented 5 years ago
go test 
{"level":"info","msg":"Disabled Ansible-Puller","time":"2019-09-09T15:45:47-07:00"}
Running Suite: Ansible Puller Suite
===================================
Random Seed: 1568069147
Will run 12 of 12 specs

••••••••••••
Ran 12 of 12 Specs in 0.017 seconds
SUCCESS! -- 12 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS
ok      github.com/teslamotors/ansible_puller   0.670s

With that code change, the execution will try to find the different ips of a host in the inventory and fallback to the hostname:

Sep 09 15:19:45 [...] time="2019-09-09T15:19:45-07:00" level=debug msg="Did not find 10.235.7.9 in inventory [...]"
[...]
Sep 09 15:19:50 [...] time="2019-09-09T15:19:50-07:00" level=debug msg="Did not find fe80::9:9cff:fec3:f43a in inventory [...]"
[...]
Sep 09 15:19:55 [...] time="2019-09-09T15:19:55-07:00" level=debug msg="Found ip-10-235-7-9.cn-north-1.compute.internal in inventory [...]"
dfinninger commented 5 years ago

Pushed changes look pretty good. Can we add some simple tests for the new functions?