One thing to remember about internal AWS IP addresses is that they are
ephemeral and will change if the instance is rebooted.  If you want the IP
to persist, use an Elastic IP.  The elastic IP will also have an internal,
static IP address that you can use for internal communication. This
internal elastic IP address will survive a reboot.


On Sat, Dec 21, 2013 at 2:59 AM, Trond Hindenes <[email protected]> wrote:

> Hi all,
> I'm struggling with a concept in Ansible and hopefully you guys can
> provide some input for me:
>
> I'm trying to create a playbook which performs the following:
> 1. Provisions 2 Amazon EC2 instances
> 2. Deploys mysql on one instance
> 3. Deploys and configures wordpress on the other, configered to use the
> mysql node configured in step 2 for database
>
> I'm going to use this as a framework for some other work down the road.
> The important thing is that each playbook run will deploy its "own" EC2
> instances, which means that I cannot use statically typed names.
>
> Everything works as it should, until the step where I need to inject the
> internal ip address of the mysql server into the wordpress config file on
> the wordpress node. I just can't get my head around how I should do this
> step. I don't know the mysql hostname (and I don't care), but I know that
> it's a member of the "tag_Group_MySQL" group. I have a variable called
> "ec2_mysql" on the "control node" containing the public ip of the mysql
> server, but this variable does not exist on the wordpress server (according
> to the docs, variables only live on the server where they are defined, if I
> understand it correctly).
>
> The whole playbook is available at
> https://github.com/trondhindenes/AnsibleTest/tree/master/ec2-env. I would
> love another set of eyes on this.
>
> I'm thinking about running the ec2.py script as a local task after
> provisioning, and trying to use some filtering to grab the facts of the
> first member of the ec2_mysql group or something but I still feel very
> limited by the fact that variables only seem to exist on the host where
> they got defined.... Any pointers deeply appreciated!
>
> -Trond
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Peter Gehres
Site Reliability Engineer | AppDynamics, Inc.
www.appdynamics.com | AS62897

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to