"There is a chance we need to deploy some of our servers on a different
cloud provider or on bare metal servers, in that case the ec2_facts module
will fail."
I would consider constraining the ec2 configuration items to a specific
role and maybe do:
- hosts: ec2_webservers
roles:
- ec2_config
- other_config
And in another playbook, maybe you apply all roles but the ec2 step.
If you wanted a fact on EC2 in a different variable, you could use the
"set_fact" module to assign it from a different source, and leave the other
roles independent.
Altenratively, you could have steps like:
when: ansible_ec2_blah is defined
or "is not defined"
using conditionals.
On Tue, May 20, 2014 at 10:59 AM, Nicolas G <[email protected]> wrote:
> Hi,
>
> We have our ansible playbooks working with no problem to deploy our
> servers in Amazon ec2. One of the ansible modules we use is the ec2_facts
> in order to configure some files , as for example we use the {{
> ansible_ec2_placement_availability_zone }} value.
>
> There is a chance we need to deploy some of our servers on a different
> cloud provider or on bare metal servers, in that case the ec2_facts module
> will fail.
>
> I know I could just add an ignore_errors on the ec2_facts task but we need
> to make sure when in AWS environment the ec2_facts are populated
> successfully so I'm wondering how can we set default values when we run a
> playbook in a non AWS environment ?
>
> For example I would like to set the bellow without using "when:" or
> specifying in advance if the inventory hosts are in ec2 or not :
>
> ansible_ec2_placement_availability_zone : NA
>
>
> Any ideas ?
>
> Regards,
> N.
>
> --
> 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/dea52314-0a99-48e1-923a-9eb85ab14aa4%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/dea52314-0a99-48e1-923a-9eb85ab14aa4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CA%2BnsWgyA_O61MeOs6zKHVAbvWqbvStT8-pLaodS7%2BNOAeHbjbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.