File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Retrieve inventory from a deployed CI arcus environment by reversing arcus/inventory/hooks/pre.yml
2
+ # Usage example:
3
+ # ansible-playbook ansible/ci/retrieve_inventory.yml -e cluster_prefix=ci4005969475
4
+ #
5
+ - hosts : localhost
6
+ become : no
7
+ gather_facts : no
8
+ vars :
9
+ cluster_prefix : " {{ undef(hint='cluster_prefix must be defined') }}" # e.g. ci4005969475
10
+ cluster_network : WCDC-iLab-60
11
+ tasks :
12
+ - name : Get control host IP
13
+ set_fact :
14
+ control_ip : " {{ (lookup('pipe', 'openstack server show -f json ' + cluster_prefix + '-control') | from_json)['addresses'][cluster_network][0] }}"
15
+ - name : Add host into in-memory inventory
16
+ add_host :
17
+ name : cluster_control
18
+ groups : control
19
+ ansible_host : " {{ control_ip }}"
20
+
21
+ - hosts : control
22
+ become : yes
23
+ gather_facts : no
24
+ tasks :
25
+ - ansible.builtin.fetch :
26
+ src : " /etc/ci-config/{{ item | basename }}"
27
+ dest : " {{ item }}"
28
+ flat : true
29
+ loop :
30
+ - " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/hosts"
31
+ - " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/group_vars/all/secrets.yml"
32
+ - " {{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}/inventory/group_vars/all/test_user.yml"
You can’t perform that action at this time.
0 commit comments