Hello Dag,

thank you for your input. I added the step you mentioned to my role. But it 
will not update the IP of the instance and therefore the next step (ssh) 
times out. 
Note: although there are loops, I only run with 1 instance 

thanks and any other idea would reatly appreciated

Peter

- name: Launch instances
  gce:
    instance_names: abc
    network: dfe
    machine_type: "{{ machine_type }}"
    image: "{{ image }}"
    zone: "{{ zone }}"
    tags: test
  register: gce

- name: run python script to make ip static
  script: python script that may or may not change the ip
  register: res
  failed_when: "res.rc == 1"
  changed_when: "res.rc == 0"
  with_items: gce.instance_data

- name: Update host facts
  action: setup

- name: Wait for SSH to come up
  wait_for: host={{ item.public_ip }} port=22 delay=10 timeout=60
  with_items: gce.instance_data












On Monday, January 19, 2015 at 8:11:08 AM UTC-8, Dag Wieers wrote:
>
> On Sun, 18 Jan 2015, Peter Mooshammer wrote: 
>
> > On Sunday, January 18, 2015 at 4:57:39 PM UTC-8, James Martin wrote: 
> > 
> >> Have you looked into using the GCE dynamic inventory? 
> >> 
> >> http://docs.ansible.com/guide_gce.html#gce-dynamic-inventory 
> > 
> > I wanted to write a play that sets up and provisions a node in one 
> sweep, 
> > so I thought add_host is necessary (In the example I showed the 
> lineinfile, 
> > which isn't really necessary. 
> > 
> > But this is also a more general question, How can I update host 
> information. 
>
> Simply run the "setup" module again, eg: 
>
>   - name: Update host facts 
>     action: setup 
>
> This will only work if the changes have been activated. 
>
> -- 
> Dag 
>

-- 
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/8a2bb61d-7182-4ec9-ad18-06f29118a1d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to