Hello, I have 2 different environments, staging + production. For both of them I need to create AMIs with my services.
For both, I have existing stopped EC2 instances that I need to start within the playbook, then run tasks on this machine, then stop the machine and create AMI. My problem is that I have different instances for those two environments, which I want to specify using group-vars/staging/ and group-vars/production. e.g.: echo "instance_id: i-123456" > group_vars/staging/instanceid.yml echo "instance_id: i-987654" > group_vars/production/instanceid.yml And then run ansible-playbook -l staging deployandcreateami.yml The problem is, that ec2 module is "local" and thus 'instance-id' is not defined within this context: - name: Start sandbox instances hosts: localhost gather_facts: false connection: local vars: instance_ids: - '{{ instance_id }}' region: us-east-1 tasks: - name: Start the sandbox instances ec2: instance_ids: '{{ instance_ids }}' region: '{{ region }}' state: running wait: True vpc_subnet_id: subnet-29e63245 assign_public_ip: yes roles: - do_neat_stuff - do_more_neat_stuff Any hints? Thank you! Michal -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8150c77c-c8b3-4988-b932-3f0788d6280d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.