- hosts: tag_Name_Demo:&tag_Svc_Apache
gather_facts: true
user: ec2-user
# basic pre_task and post_task example
pre_tasks:
- name: Gathering ec2 facts
action: ec2_facts
- name: Instance De-register
local_action:
module: ec2_elb
region: eu-west-1
instance_id: "{{ ansible_ec2_instance_id }}"
state: 'absent'
tasks:
- name: install httpd
sudo: yes
yum: name=httpd state=present
- name: ensure httpd is running
sudo: yes
service: name=httpd state=started
- name: Check NTP service
sudo: yes
service: name=ntpd state=started
post_tasks:
- debug: msg="{{ item }}"
with_items: ec2_elbs
- name: Instance Register
local_action:
module: ec2_elb
region: eu-west-1
instance_id: "{{ ansible_ec2_instance_id }}"
ec2_elbs: "{{ item }}"
state: 'present'
wait: yes
ignore_errors: yes
with_items: ec2_elbs
PLAY [tag_Name_Demo:&tag_Svc_Apache] ******************************************
GATHERING FACTS ***************************************************************ok: [52.17.75.238]ok: [52.17.52.33]
TASK: [Gathering ec2 facts] ***************************************************ok: [52.17.75.238]ok: [52.17.52.33]
TASK: [Instance De-register] **************************************************ok: [52.17.75.238 -> 127.0.0.1]ok: [52.17.52.33 -> 127.0.0.1]
TASK: [install httpd] *********************************************************ok: [52.17.52.33]ok: [52.17.75.238]
TASK: [ensure httpd is running] ***********************************************ok: [52.17.75.238]ok: [52.17.52.33]
TASK: [Check NTP service] *****************************************************ok: [52.17.52.33]ok: [52.17.75.238]
TASK: [debug msg="{{ item }}"] ************************************************skipping: [52.17.52.33]skipping: [52.17.75.238]
TASK: [Instance Register] *****************************************************skipping: [52.17.52.33]skipping: [52.17.75.238]
PLAY RECAP ********************************************************************52.17.52.33 : ok=6 changed=0 unreachable=0 failed=052.17.75.238 : ok=6 changed=0 unreachable=0 failed=0
Hi,
Since there's no reply - possible to get someone at ansible to check / comment ? It seems similar to a question regarding VPCs that was recently asked and also has no answers yet?
In fact, when creating the ELBs, can I keep a local list of them thats being produced by the playbook, if I can't get it dynamically?
Thanks!
Alex
--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a86de61f-7782-4fd9-b332-6ee83e9a381b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/098cd092-edfc-472c-8be9-4bea312fe7b6%40googlegroups.com.