From cc03f55cbc6eeee4b48e1d5cf3597fcf36a8923d Mon Sep 17 00:00:00 2001 From: Lennart Jern Date: Tue, 22 Jun 2021 16:17:56 +0300 Subject: [PATCH] Reducs Ansible verbosity and use DIY callback The DIY callback plugin is configured to print only the status of k8s resources instead of everything (but otherwise work as before). Ansible verbosity is turned down to default. --- 01_prepare_host.sh | 2 +- 02_configure_host.sh | 4 ++-- ansible.cfg | 22 ++++++++++++++++++++++ host_cleanup.sh | 4 ++-- scripts/run.sh | 2 +- 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 ansible.cfg diff --git a/01_prepare_host.sh b/01_prepare_host.sh index 6c731f783..1ec1ca383 100755 --- a/01_prepare_host.sh +++ b/01_prepare_host.sh @@ -44,7 +44,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "metal3_dir=$SCRIPTDIR" \ -e "virthost=$HOSTNAME" \ -i vm-setup/inventory.ini \ - -b -vvv vm-setup/install-package-playbook.yml + -b vm-setup/install-package-playbook.yml # shellcheck disable=SC1091 source lib/network.sh diff --git a/02_configure_host.sh b/02_configure_host.sh index 218b49ab7..07f3521fe 100755 --- a/02_configure_host.sh +++ b/02_configure_host.sh @@ -28,7 +28,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "nodes_file=$NODES_FILE" \ -e "node_hostname_format=$NODE_HOSTNAME_FORMAT" \ -i vm-setup/inventory.ini \ - -b -vvv vm-setup/setup-playbook.yml + -b vm-setup/setup-playbook.yml # Usually virt-manager/virt-install creates this: https://www.redhat.com/archives/libvir-list/2008-August/msg00179.html if ! sudo virsh pool-uuid default > /dev/null 2>&1 ; then @@ -108,7 +108,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "{use_firewalld: $USE_FIREWALLD}" \ -e "external_subnet_v4: ${EXTERNAL_SUBNET_V4}" \ -i vm-setup/inventory.ini \ - -b -vvv vm-setup/firewall.yml + -b vm-setup/firewall.yml # FIXME(stbenjam): ansbile firewalld module doesn't seem to be doing the right thing if [ "$USE_FIREWALLD" == "True" ]; then diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 000000000..ddb9b35c8 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,22 @@ +[defaults] +stdout_callback=community.general.diy + +[callback_diy] +; Note that the action can be both k8s_info and community.kubernetes.k8s_info +runner_retry_msg=' + FAILED: {{ ansible_callback_diy.task.name }} + {{ ("FAILED: " + ansible_callback_diy.task.name) | length * "-" }} + {% if ansible_callback_diy.task.action is search("k8s_info") %} + {% for r in ansible_callback_diy.result.output.resources %} + kind: {{ r.kind }} + name: {{ r.metadata.name }} + {% if r.kind == "BareMetalHost" %} + status.provisioning: + {{ r.status.provisioning | to_nice_yaml | indent(2, first=True) }} + {% else %} + status: + {{ r.status | to_nice_yaml | indent(2, first=True) }} + {% endif %} + {% endfor %} + {% endif %} + RETRYING: {{ ansible_callback_diy.task.name }} {{ ansible_callback_diy.result.output.attempts }}/{{ ansible_callback_diy.task.retries }}' diff --git a/host_cleanup.sh b/host_cleanup.sh index 437f9924a..06455e3e7 100755 --- a/host_cleanup.sh +++ b/host_cleanup.sh @@ -40,7 +40,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "manage_baremetal=$MANAGE_BR_BRIDGE" \ -e "nodes_file=$NODES_FILE" \ -i vm-setup/inventory.ini \ - -b -vvv vm-setup/teardown-playbook.yml + -b vm-setup/teardown-playbook.yml if [ "$USE_FIREWALLD" == "False" ]; then ANSIBLE_FORCE_COLOR=true ansible-playbook \ @@ -48,7 +48,7 @@ if [ "$USE_FIREWALLD" == "False" ]; then -e "external_subnet_v4: ${EXTERNAL_SUBNET_V4}" \ -e "firewall_rule_state=absent" \ -i vm-setup/inventory.ini \ - -b -vvv vm-setup/firewall.yml + -b vm-setup/firewall.yml fi # There was a bug in this file, it may need to be recreated. diff --git a/scripts/run.sh b/scripts/run.sh index 20797630a..84d170353 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -35,4 +35,4 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "metal3_dir=$SCRIPTDIR" \ -e "v1aX_integration_test_action=${ACTION}" \ -i "${METAL3_DIR}/vm-setup/inventory.ini" \ - -b -vvv "${METAL3_DIR}/vm-setup/v1aX_integration_test.yml" + -b "${METAL3_DIR}/vm-setup/v1aX_integration_test.yml"