My existing instances are provisioned thusly:
tasks:
- name: Provision an instance
ec2: >
aws_access_key={{ec2_access_key}}
aws_secret_key={{ec2_secret_key}}
keypair={{mykeypair}}
group_id={{security_group}}
instance_type={{instance_type}}
image={{image}}
region={{region}}
wait=true
count=1
vpc_subnet_id={{ subnet_name }}
instance_tags='{"Name":"{{ name }}","InternalName":"{{
internal_name }}"}'
register: ec2_info
- debug: var=ec2_info
- debug: var=item
with_items: ec2_info.instance_ids
- debug: var=item
with_items: ec2_info.instances
- name: add host to host list
add_host: hostname={{ item.public_ip }} groupname=ec2hosts
with_items: ec2_info.instances
- name: wait for instances to listen on port:22
wait_for:
state=started
host={{ item.private_dns_name }}
port=22
with_items: ec2_info.instances
- hosts: ec2hosts
gather_facts: True
user: ec2-user
sudo: True
roles:
- { role: common, XXXextra instance variablesXXX } <--- this role
(in main.yml) calls a number of scripts and shell commands on the
instance. How can it connect? and how can I replicate that connection?
On Thursday, November 12, 2015 at 5:10:18 PM UTC-5, nathan chu wrote:
>
> *typo: not --> now. there's a nice one-letter semantic change, lol.
>
>
>
>
> On Thursday, November 12, 2015 at 4:38:16 PM UTC-5, nathan chu wrote:
>>
>> Hi,
>>
>> I recently inherited an Ansible deployment that manages some EC2
>> instances and I have a couple questions. I am unable to find a pem
>> file/ssh key on the local file system, but somehow Ansible is able to
>> connect to the instances it creates and run shell scripts. How is this
>> possible? I'm* now *trying to enhance the existing playbooks to update
>> some data via a script on a central/master server in our deployment every
>> time we create a new instance, but I'm having trouble connecting to the
>> instance. How can I use whatever mechanism is in place for the recently
>> provisioned instances to access this single (relatively static) instance?
>>
>> Thanks,
>>
>>
>> Nate
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e0b8e5af-7d89-495b-9c11-c6df5ea0a6c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.