Skip to content

Commit

Permalink
Dump all hostvars to files
Browse files Browse the repository at this point in the history
For using job variables (which are passed in job definitions as
'vars') in quickstart we need to pass them to nested ansible.
Just like we do with zuul variables.

Change-Id: I482186bfed1de94ac3c7e9ec38db93786cf1f63d
  • Loading branch information
sshnaidm committed Aug 6, 2019
1 parent 0df6d99 commit 84018c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/prepare-node/tasks/main.yaml
Expand Up @@ -33,6 +33,15 @@
content: "{{ zuul_dump|to_nice_yaml }}"
dest: "{{ workspace }}/logs/zuul-variables.yaml"

- name: Dump hostvars with job variables
set_fact:
local_hostvars: "{{ {'job': hostvars[inventory_hostname]} }}"

- name: Dump hostvars on the host to pass it to inner ansible
copy:
content: "{{ local_hostvars|to_nice_yaml }}"
dest: "{{ workspace }}/logs/hostvars-variables.yaml"

- name: Remove package exclusions from package manager
become: true
ini_file:
Expand Down
3 changes: 3 additions & 0 deletions roles/run-test/templates/toci_quickstart.sh.j2
Expand Up @@ -56,6 +56,7 @@ QUICKSTART_COLLECTLOGS_CMD="$LOCAL_WORKING_DIR/bin/ansible-playbook \
--extra-vars @{{ tripleo_root }}/tripleo-ci/toci-quickstart/config/collect-logs.yml \
--extra-vars artcl_collect_dir=$LOGS_DIR \
--extra-vars @{{ workspace }}/logs/zuul-variables.yaml \
--extra-vars @{{ workspace }}/logs/hostvars-variables.yaml \
--tags all \
"

Expand Down Expand Up @@ -136,6 +137,7 @@ for playbook in {{ " ".join(playbooks) }}; do
$DEFAULT_ARGS \
$LOCAL_WORKING_DIR/playbooks/$playbook ${PLAYBOOKS_ARGS[$playbook]:-}" \
--extra-vars @{{ workspace }}/logs/zuul-variables.yaml \
--extra-vars @{{ workspace }}/logs/hostvars-variables.yaml \
| sed 's/--/\n--/g' \
| tee -a $LOGS_DIR/playbook_executions.log
echo "# --------------------------------------- " \
Expand All @@ -159,6 +161,7 @@ done
{{ vxlan_vars }} \
$DEFAULT_ARGS \
--extra-vars @{{ workspace }}/logs/zuul-variables.yaml \
--extra-vars @{{ workspace }}/logs/hostvars-variables.yaml \
$LOCAL_WORKING_DIR/playbooks/$playbook ${PLAYBOOKS_ARGS[$playbook]:-} \
2>&1 | tee -a $LOGS_DIR/quickstart_install.log && exit_value=0 || exit_value=$?

Expand Down

0 comments on commit 84018c7

Please sign in to comment.