From f27644c1870ce3151fa26a022caacb77034ce311 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 23 Apr 2018 15:53:15 -0700 Subject: [PATCH] Split logging of inventory to its own role The ability to read and write the inventory is privileged and requires you are running in a trusted context. This makes testing the validate-host role difficult as it reads the inventory file and writes it to the job log dir. Make a new role called log-inventory that will allow us to eventually remove this task from validate-host enabling better testing of validate host. Also this will allow us to log the inventory in the post-run logging activity. Change-Id: I4098fd140484bc54dc95b5f4c51afb1c56c7b19c --- roles/log-inventory/README.rst | 3 +++ roles/log-inventory/tasks/main.yaml | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 roles/log-inventory/README.rst create mode 100644 roles/log-inventory/tasks/main.yaml diff --git a/roles/log-inventory/README.rst b/roles/log-inventory/README.rst new file mode 100644 index 000000000..ea7b523f9 --- /dev/null +++ b/roles/log-inventory/README.rst @@ -0,0 +1,3 @@ +Log the inventory used to run the job to the job's log dir. + +This will result in the log collection roles logging the job inventory. diff --git a/roles/log-inventory/tasks/main.yaml b/roles/log-inventory/tasks/main.yaml new file mode 100644 index 000000000..e3dad5544 --- /dev/null +++ b/roles/log-inventory/tasks/main.yaml @@ -0,0 +1,5 @@ +- name: Copy ansible inventory to logs dir + delegate_to: localhost + copy: + src: "{{ inventory_file }}" + dest: "{{ zuul_info_dir }}"