From e61277ba16604bb3975606eeaa5622554a939add Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Thu, 30 Apr 2026 16:18:50 +0100 Subject: [PATCH] fixup retrieve inventory adhoc play for current TF --- ansible/ci/retrieve_inventory.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ansible/ci/retrieve_inventory.yml b/ansible/ci/retrieve_inventory.yml index 6e395ef37..59c69e1f4 100644 --- a/ansible/ci/retrieve_inventory.yml +++ b/ansible/ci/retrieve_inventory.yml @@ -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: @@ -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"