Could you please help .. am unable to retrieve the public ip address of the
ec2 instance to add it to the host inventory..
- name: Create an ec2 instance
ec2:
key_name: "{{ keypair }}"
group: sg_webserver_group
instance_type: "{{ instance_type}}"
image: "{{ ami }}"
wait: true
region: "{{ region }}"
assign_public_ip: yes
register: ec2
- debug: * var=ec2.instances.public_ip* (*or var=ec2.public_ip doesnt
give the public ip rather gives undefined variable but whereas var=ec2 *gives
all the details)
- name: Add the newly created host
add_host:
name: "{{ item.public_ip }}"
groups: webserver
with_items: "{{ ec2.instances }}"
Thank you
On Sun, Aug 19, 2018 at 12:41 PM, coach rhca <[email protected]> wrote:
> thanks kai..
>
> On Sat, Aug 18, 2018 at 5:14 PM, Kai Stian Olstad <
> [email protected]> wrote:
>
>> On Friday, 17 August 2018 06.11.03 CEST coach rhca wrote:
>> > thanks Jonathan for reciprocating, i use the openssl on the OS to
>> generate
>> > the pem file and then the crt file but i am checking on how to achieve
>> this
>> > on ansible.
>> > just like a private self signed certificate for internal use for the
>> > webserver that will be provisioned.
>>
>> You can do it with the same command that you usually use, Ansible can run
>> OS commands with the command and the shell modules.
>>
>>
>> --
>> Kai Stian Olstad
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/ansible-project/tBBrc4ycXmI/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/ms
>> gid/ansible-project/2154711.fANc0lNl0d%40x1.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/CALguqPKkJMjt7WtB6He9jE0kRwWLCa2_Agxr-XOOdS1811H36w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.