Hello,
I’m feeding Ansible 2.0.0.2 dynamic inventory from an enterprise CMDB system.
I’ve worked through two issues already:
- inject empty _meta hostvars to be able to read in large JSON objects without killing RAM & CPU (https://groups.google.com/forum/#!searchin/Ansible-project/tsalolikhin/ansible-project/AB997vCLtCY/MT3CxG-fCAAJ)
- filter CMDB output to remove records that don’t have IP addresses as it makes Ansible throw Python errors
I think the last issue is allow the users to authenticate into the CMDB system…
I am trying to set it up so that the user would type their password into STDIN for the dynamic inventory script… what’s strange is that I can enter TWO lines and the first one isn’t passed to the script… what’s going on here?
$ cat test.sh
#!/bin/sh
read -s cmdb_password
pretend to download data from CMDB
cat /tmp/test.json
and let’s see what was entered
echo $cmdb_password > /tmp/test.out
$ ( echo one; echo two) | ansible -i ./test.sh all --list-hosts
hosts (1):
10.10.10.10
$ cat /tmp/test.out
two
$
Question: What happened to “one” ?
I was hoping to use a wrapper that would prompt the user for their CMDB password and then start Ansible so that when they type in their password it would go to the dynamic inventory script.
Best,
-at