Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roles/freeipa_host_group/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ freeipa_host_group__env_name: "{{ common__env_name }}"
freeipa_host_group__infra_type: "{{ common__infra_type }}"
freeipa_host_group__region: "{{ common__region }}"

freeipa_host_group__gcp_project: "{{ common__gcp_project }}"

# Outputs
freeipa_host_group__host_group_name: "freeipa_server_hosts"
19 changes: 15 additions & 4 deletions roles/freeipa_host_group/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@
# when: freeipa_host_group__infra_type == "azure"
# block:

# TODO: A block per cloud provider - GCP
# Get instance details for specific infra_type - GCP
# - name: Gather FreeIPA instance details on GCP
# when: freeipa_host_group__infra_type == "gcp"
# block:
- name: Gather FreeIPA instance details on GCP
when: freeipa_host_group__infra_type == "gcp"
block:
- name: Gather Address information used by FreeIPA GCP instance
google.cloud.gcp_compute_address_info:
region: "{{ freeipa_host_group__region }}"
project: "{{ freeipa_host_group__gcp_project }}"
# Filter on the freeipa instance name with the timestamp stripped
filters:
- "name : {{ __freeipa_server_instance_id | regex_replace('[^-]+$', '') }}*"
register: __gcp_freeipa_address_info

- name: Set facts for the FreeIPA server IP
ansible.builtin.set_fact:
__freeipa_server_public_ip: "{{ __gcp_freeipa_address_info.resources | map(attribute='address') }}"

# Add the FreeIPA server and username to the inventory
- name: Add FreeIPA servers to inventory
Expand Down