mirror of
https://github.com/trailofbits/algo.git
synced 2025-06-06 15:13:56 +02:00
gce inventory #30
This commit is contained in:
parent
9cc9cf7b5f
commit
6e538627db
1 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
||||||
credentials_file: "{{ credentials_file }}"
|
credentials_file: "{{ credentials_file }}"
|
||||||
project_id: "{{ credentials_file_lookup.project_id }}"
|
project_id: "{{ credentials_file_lookup.project_id }}"
|
||||||
metadata: '{"sshKeys":"root:{{ ssh_public_key_lookup }}"}'
|
metadata: '{"sshKeys":"root:{{ ssh_public_key_lookup }}"}'
|
||||||
|
tags:
|
||||||
|
- "environment: algo"
|
||||||
register: google_vm
|
register: google_vm
|
||||||
|
|
||||||
- name: Add the instance to an inventory group
|
- name: Add the instance to an inventory group
|
||||||
|
@ -38,3 +40,17 @@
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
cloud_instance_ip: "{{ google_vm.instance_data[0].public_ip }}"
|
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…
Add table
Reference in a new issue