gce inventory #30

pull/262/head
Jack Ivanov 7 years ago
parent 9cc9cf7b5f
commit 6e538627db

@ -12,6 +12,8 @@
credentials_file: "{{ credentials_file }}"
project_id: "{{ credentials_file_lookup.project_id }}"
metadata: '{"sshKeys":"root:{{ ssh_public_key_lookup }}"}'
tags:
- "environment: algo"
register: google_vm
- name: Add the instance to an inventory group
@ -38,3 +40,17 @@
- set_fact:
cloud_instance_ip: "{{ google_vm.instance_data[0].public_ip }}"
- name: Ensure the group gce exists in the dynamic inventory file
lineinfile:
state: present
dest: configs/inventory.dynamic
line: '[gce]'
- name: Populate the dynamic inventory
lineinfile:
state: present
dest: configs/inventory.dynamic
insertafter: '\[gce\]'
regexp: "^{{ google_vm.instance_data[0].public_ip }}.*"
line: "{{ google_vm.instance_data[0].public_ip }}"

Loading…
Cancel
Save