Hi there,
I do the following on gce:
- 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: Add instance to local host group
local_action: lineinfile dest=hosts insertafter="\[gce\]" line="{{
item.public_ip }}
ansible_ssh_private_key_file=~/.ssh/google_compute_engine" state=present
with_items: gce.instance_data
However, the public_ip may have changed so how can I update it before I try
to add the item to the "hosts" file?
thanks
Peter
--
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/e51ee56e-f526-4412-a571-164f17dd1c37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.