So, I’m super stuck on this problem. I created a pastie of all the info.
http://pastie.org/private/po3yakcngchu8wzjiwhsa
What am I doing wrong in the playbook that I can’t get those IPs into my hosts file?
Any help would be greatly appreciated!
So, I’m super stuck on this problem. I created a pastie of all the info.
http://pastie.org/private/po3yakcngchu8wzjiwhsa
What am I doing wrong in the playbook that I can’t get those IPs into my hosts file?
Any help would be greatly appreciated!
add_host is for adding a host to current run’s in-memory inventory, not the one on disk. It’s used to provision a newly-created VMs. You want to either use dynamic inventory and pull data from EC2, or somehow add the host to static inventory (with lineinfile maybe?)
Okay, I understand that it only adds to the in-memory inventory, but that’s not really the problem I’m having.
The problem I’m having is I can’t get the IP. What I plan to do with the IP after I get it involves provisioning those hosts. I can’t provision those hosts unless I get the IP from the current run which creates the host.
The step where I should be able to get the IP to add it to a group (in memory or otherwise) is failing.
`
TASK: [Add new instance to host group] ****************************************
fatal: [localhost → 127.0.0.1] => One or more undefined variables: ‘str object’ has no attribute ‘tagged_instances’
FATAL: all hosts have already failed – aborting
Sorry, I only skimmed that paste and missed the actual problem. For the record: it’s easier if you paste examples in your mail, and it’s better for archiving too is “run this task for all of ec2.results”, but what you wrote is “run this task for all of [‘ec2.results’]” (that’s why it’s complaining about a string). You want:
That was exactly my issue. Thank you very much for your help!