Closed obilodeau closed 4 years ago
I realized that the wildcard -i
search was too much and could conflict with hostnames like infra-internal-database
so I reduced it to a strict match. Since the script is strict bash (not csh or dash), it seems to be sufficient to rely on the tests provided by the [[
equality.
Thanks for the contribution :+1:
A little thing - I will change [[
to [
for using uniform style throughout the whole script.
Resolves #4.
It only works if it is the first flag (before the host) to avoid conflicting with a potential
-i
meant for ssh.-i
is used for SSH's identity file or more commonly known as the ssh key to use for the connection.Without a host argument, it will successfully list the dynamic inventory.
I added some help. I successfully tested it in my environments using both terraform-inventory and terraform.py as inventory scripts.
For anyone stumbling upon this and wondering which to use: the later is superior to the former because it can enrich the inventory with the SSH configuration variables. Using
terraform-inventory
you need to supply-l <login>
and-i <ssh-key>
whereas interraform.py
you can use the terraform-provider-ansible and populate all these inventory variables right in your terraform script. Thanks to @kavishkumar94 for finding that out.