Skip to content
Merged
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
11 changes: 6 additions & 5 deletions ansible/ci/retrieve_inventory.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
# Retrieve inventory from a deployed CI arcus environment by reversing arcus/inventory/hooks/pre.yml
# Retrieve inventory from a deployed CI arcus environment by reversing .stackhpc/inventory/hooks/pre.yml
# Usage example:
# ansible-playbook ansible/ci/retrieve_inventory.yml -e cluster_prefix=ci4005969475
# ansible-playbook ansible/ci/retrieve_inventory.yml -e cluster_prefix=slurmci-RL8-1030
#
- hosts: localhost
become: false
gather_facts: false
vars:
cluster_prefix: "{{ undef(hint='cluster_prefix must be defined') }}" # e.g. ci4005969475
cluster_prefix: "{{ undef(hint='cluster_prefix must be defined') }}" # e.g. slurmci-RL8-1030
ci_vars_file: "{{ appliances_environment_root + '/tofu/' + lookup('env', 'CI_CLOUD') }}.tfvars"
cluster_network: "{{ lookup('ansible.builtin.ini', 'cluster_net', file=ci_vars_file, type='properties') | trim('\"') }}"
network_regex: 'network = "(.+)"$'
cluster_network: "{{ lookup('ansible.builtin.file', ci_vars_file) | ansible.builtin.regex_search(network_regex, '\\1', multiline=True) }}"
tasks:
- name: Get control host IP
ansible.builtin.set_fact:
Expand All @@ -29,6 +30,6 @@
dest: "{{ item }}"
flat: true
loop:
- "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/hosts"
- "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/hosts.yml"
- "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/group_vars/all/secrets.yml"
- "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/group_vars/all/test_user.yml"