*You can use with_items as shown below*
*# Create AMI*
* - name: Create AMI*
* local_action:*
* module: ec2_ami*
* instance_id: "{{ item.id <http://item.id/> }}"*
* wait: yes*
* wait_timeout: 3600*
* aws_access_key: "{{ AWSAccessKey }}"*
* aws_secret_key: "{{ AWSSecretKey }}"*
* region: "{{ region }}"*
* name: "OCCM-AUTO-AMI-4-E2E -TEST - {{ date }}"*
* description: "OCCM automatically created ami for E2E"*
* launch_permissions:*
* user_ids: {{item}}*
* with_items:*
* - **66602923934*
* - **66602923934*
* - **66602923934*
* device_mapping:*
* - device_name: /dev/sda1*
* size: 50*
* volume_type: gp2*
On Thursday, April 20, 2017 at 1:46:05 PM UTC+5:30, Shmulik Alfandari wrote:
>
> Hi,
>
> I am creating AMI in AWS using ec2_ami module. I need to create the AMI
> and to give permissions to multiple accounts,however it failed. When I am
> doing it with one account it's ok.
> Below the code to create AMI with permission to 1 account which is working
> fine.
>
> *# Create AMI*
> * - name: Create AMI*
> * local_action:*
> * module: ec2_ami*
> * instance_id: "{{ item.id <http://item.id> }}"*
> * wait: yes*
> * wait_timeout: 3600*
> * aws_access_key: "{{ AWSAccessKey }}"*
> * aws_secret_key: "{{ AWSSecretKey }}"*
> * region: "{{ region }}"*
> * name: "OCCM-AUTO-AMI-4-E2E -TEST - {{ date }}"*
> * description: "OCCM automatically created ami for E2E"*
> * launch_permissions:*
> * user_ids: ['66602923934']*
> * device_mapping:*
> * - device_name: /dev/sda1*
> * size: 50*
> * volume_type: gp2*
>
>
> Could you please let me know how to pass multiple accounts to: *user_ids
> ?*
>
> Thanks,
> Shmulik.
>
--
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/159d16b7-a61e-4f16-9dfc-292f0b308c6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.