Hi All
my ansible version,
ansible --version
ansible 2.7.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
How can I create a gce instance with already exists network and subnetwork,
then assign a static internal and a static external ip address in to it,
I tried followed, success with creating instance with network and
subnetwork, but can not add a static internal and a static external ip
address
tasks:
- name: Create a Regional external IP address
gce_eip:
name: test-ansi3-ext-ip
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
region: "{{ region }}"
state: present
register: externalip
- name: Launch instances ("{{ instances }}")
gce:
instance_names: "{{ instances }}"
machine_type: "{{ machine_type }}"
image: "{{ image }}"
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
zone: asia-southeast1-b
disk_auto_delete: true
preemptible: true
network: pickme-stage-vpc
subnetwork: mgmt-sn
external_ip: '{{ externalip }}'
tags: ansible,allow-jenkins-fw-rule,allow-ssh-fw-rule,int-lb
register: gce
- name: Wait for SSH to come up ("{{ instances }}")
wait_for: host={{ item.public_ip }} port=22 delay=10 timeout=60
with_items: "{{ gce.instance_data }}"
- name: Add host to groupname ("{{ instances }}")
add_host: hostname={{ item.public_ip }} groupname=new_instances
with_items: "{{ gce.instance_data }}"
- name: Save host data ("{{ instances }}")
add_host:
hostname: "{{ item.public_ip }}"
groupname: gce_instances
with_items: "{{ gce.instance_data }}"
--
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/0845dc4f-53bb-4774-bfe2-dabb9566c729%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.