Hi,

I've a similar issue and I would be interested if there exists now a 
solution to omit task parameters based on variable definitions. In my 
special example I've a role to provision EC2 instances. For some instances 
I would like to allocate private IP addresses and for some I wouldn't. Any 
other idea how I can solve this issue without duplication roles?

Best regards,
Christian


Am Dienstag, 22. Juli 2014 02:32:41 UTC+2 schrieb Steven Ringo:
>
> Hi,
>
> I am running the ec2 module to provision an instance, with variables 
> defined in a vars file, and the action in a role playbook:
>
> - name: instance provisioning
>   local_action:
>     module: ec2
>     region: "{{ region }}"
>     key_name: "{{ key }}"
>     id: "{{ idempotency_token }}"
>     ...truncated...
>
> For the ec2 module, id is an optional client token that if defined makes 
> that operation idempotent.
>
> If the id parameter is present in the action, it expects there to be a 
> value for it.
>
> I would like to have it that if idempotency_token is not defined or 
> declared it does not pass in the id as parameter in the playbook.
>
> I tried using null as a default but Amazon sees this as a valid token.
>
> Is there a way to combine passing in an attribute conditionally, e.g. 
> something like:
>
> - name: instance provisioning
>   local_action:
>     module: ec2
>     region: "{{ region }}"
>     key_name: "{{ key }}"
>     parameter:
>       name: id
>       value: "{{ idempotency_token }}"
>       when: idempotency_token is defined
>
> Thanks everyone.
>
> Steve
>

-- 
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/20e76074-3741-4ab1-b545-d2093d9d068b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to