xci: Replace ANSIBLE_VERBOSITY with XCI_ANSIBLE_VERBOSITY 03/43203/10
authorMarkos Chandras <mchandras@suse.de>
Tue, 26 Sep 2017 14:55:23 +0000 (15:55 +0100)
committerMarkos Chandras <mchandras@suse.de>
Wed, 27 Sep 2017 22:11:57 +0000 (23:11 +0100)
The ANSIBLE_VERBOSITY env variable is actually used internally by
Ansible and exporting it actually makes Ansible super verbose even if
the variable is empty. This feature is going away in the future so we
introduce our own XCI_ANSIBLE_VERBOSITY variable which is simply passed
to the command line to control verbosity in a proper and deterministic
way.

Change-Id: I8a32eeb1a86b4cb0a9872a51bbe9f9624d096e39
Signed-off-by: Markos Chandras <mchandras@suse.de>
bifrost/scripts/bifrost-provision.sh
xci/config/user-vars
xci/xci-deploy.sh

index d4d1f96..bd9493e 100755 (executable)
@@ -91,10 +91,10 @@ cd $BIFROST_HOME/playbooks
 
 # Syntax check of dynamic inventory test path
 for task in syntax-check list-tasks; do
-    ${ANSIBLE} -i inventory/localhost \
+    ${ANSIBLE} ${XCI_ANSIBLE_VERBOSITY} -i inventory/localhost \
            test-bifrost-create-vm.yaml \
            --${task}
-    ${ANSIBLE} -i inventory/localhost \
+    ${ANSIBLE} ${XCI_ANSIBLE_VERBOSITY} -i inventory/localhost \
            ${TEST_PLAYBOOK} \
            --${task} \
            -e testing_user=${TESTING_USER}
@@ -111,7 +111,8 @@ if [[ -e /etc/centos-release ]]; then
 fi
 
 # Create the VMS
-${ANSIBLE} -i inventory/localhost \
+${ANSIBLE} ${XCI_ANSIBLE_VERBOSITY} \
+       -i inventory/localhost \
        test-bifrost-create-vm.yaml \
        -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
        -e test_vm_memory_size=${VM_MEMORY_SIZE} \
@@ -120,7 +121,8 @@ ${ANSIBLE} -i inventory/localhost \
        -e ${INVENTORY_FILE_FORMAT}=${BAREMETAL_DATA_FILE}
 
 # Execute the installation and VM startup test
-${ANSIBLE} -i inventory/bifrost_inventory.py \
+${ANSIBLE} ${XCI_ANSIBLE_VERBOSITY} \
+    -i inventory/bifrost_inventory.py \
     ${TEST_PLAYBOOK} \
     -e use_cirros=${USE_CIRROS} \
     -e testing_user=${TESTING_USER} \
index ecde6db..7c99ee9 100755 (executable)
@@ -49,10 +49,10 @@ export OPNFV_OSA_PLAYBOOK=${OPNFV_OSA_PLAYBOOK:-"$OPENSTACK_OSA_PATH/playbooks/s
 # Set the verbosity for ansible
 #
 # Examples:
-#   ANSIBLE_VERBOSITY="-v"
+#   XCI_ANSIBLE_VERBOSITY="-v"
 # or
-#   ANSIBLE_VERBOSITY="-vvvv"
-export ANSIBLE_VERBOSITY=${ANSIBLE_VERBOSITY:-""}
+#   XCI_ANSIBLE_VERBOSITY="-vvvv"
+export XCI_ANSIBLE_VERBOSITY=${XCI_ANSIBLE_VERBOSITY:-""}
 export LOG_PATH=${LOG_PATH:-${XCI_DEVEL_ROOT}/opnfv/logs}
 export RUN_TEMPEST=${RUN_TEMPEST:-false}
 # Set this to to true to force XCI to re-create the target OS images
index 0ee5262..80ff53b 100755 (executable)
@@ -123,7 +123,7 @@ cd $XCI_PATH/playbooks
 sudo pip uninstall -y ansible || true
 sudo -H pip uninstall -y ansible || true
 sudo pip install ansible==${XCI_ANSIBLE_PIP_VERSION}
-ansible-playbook -i inventory provision-vm-nodes.yml
+ansible-playbook ${XCI_ANSIBLE_VERBOSITY} -i inventory provision-vm-nodes.yml
 cd ${OPENSTACK_BIFROST_PATH}
 bash ./scripts/bifrost-provision.sh
 echo "-----------------------------------------------------------------------"
@@ -153,7 +153,7 @@ sudo pip install --force-reinstall ansible==${XCI_ANSIBLE_PIP_VERSION}
 # Start fresh
 hash -r
 cd $XCI_PATH/playbooks
-ansible-playbook -i inventory configure-localhost.yml
+ansible-playbook ${XCI_ANSIBLE_VERBOSITY} -i inventory configure-localhost.yml
 echo "-----------------------------------------------------------------------"
 echo "Info: Configured localhost host for openstack-ansible"
 
@@ -171,7 +171,7 @@ echo "Info: Configured localhost host for openstack-ansible"
 echo "Info: Configuring opnfv deployment host for openstack-ansible"
 echo "-----------------------------------------------------------------------"
 cd ${XCI_DEVEL_ROOT}
-ansible-playbook -i ${OPNFV_XCI_PATH}/playbooks/inventory ${OPNFV_XCI_PATH}/playbooks/configure-opnfvhost.yml
+ansible-playbook ${XCI_ANSIBLE_VERBOSITY} -i ${OPNFV_XCI_PATH}/playbooks/inventory ${OPNFV_XCI_PATH}/playbooks/configure-opnfvhost.yml
 echo "-----------------------------------------------------------------------"
 echo "Info: Configured opnfv deployment host for openstack-ansible"
 
@@ -190,7 +190,7 @@ if [[ $XCI_FLAVOR != "aio" ]]; then
     echo "Info: Configuring target hosts for openstack-ansible"
     echo "-----------------------------------------------------------------------"
     cd $OPNFV_XCI_PATH/playbooks
-    ansible-playbook -i inventory configure-targethosts.yml
+    ansible-playbook ${XCI_ANSIBLE_VERBOSITY} -i inventory configure-targethosts.yml
     echo "-----------------------------------------------------------------------"
     echo "Info: Configured target hosts"
 fi
@@ -202,7 +202,7 @@ fi
 #-------------------------------------------------------------------------------
 echo "Info: Setting up target hosts for openstack-ansible"
 echo "-----------------------------------------------------------------------"
-ssh root@$OPNFV_HOST_IP "openstack-ansible \
+ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \
      $OPENSTACK_OSA_PATH/playbooks/setup-hosts.yml | tee setup-hosts.log "
 scp root@$OPNFV_HOST_IP:~/setup-hosts.log $LOG_PATH/setup-hosts.log
 echo "-----------------------------------------------------------------------"
@@ -224,7 +224,7 @@ echo "Info: Set up target hosts for openstack-ansible successfuly"
 echo "Info: Gathering facts"
 echo "-----------------------------------------------------------------------"
 ssh root@$OPNFV_HOST_IP "cd $OPENSTACK_OSA_PATH/playbooks; \
-        ansible -m setup -a gather_subset=network,hardware,virtual all"
+        ansible ${XCI_ANSIBLE_VERBOSITY} -m setup -a gather_subset=network,hardware,virtual all"
 echo "-----------------------------------------------------------------------"
 
 #-------------------------------------------------------------------------------
@@ -235,7 +235,7 @@ echo "-----------------------------------------------------------------------"
 echo "Info: Setting up infrastructure"
 echo "-----------------------------------------------------------------------"
 echo "xci: running ansible playbook setup-infrastructure.yml"
-ssh root@$OPNFV_HOST_IP "openstack-ansible \
+ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \
      $OPENSTACK_OSA_PATH/playbooks//setup-infrastructure.yml | tee setup-infrastructure.log"
 scp root@$OPNFV_HOST_IP:~/setup-infrastructure.log $LOG_PATH/setup-infrastructure.log
 echo "-----------------------------------------------------------------------"
@@ -269,7 +269,7 @@ echo "Info: Database cluster verification successful!"
 #-------------------------------------------------------------------------------
 echo "Info: Installing OpenStack on target hosts"
 echo "-----------------------------------------------------------------------"
-ssh root@$OPNFV_HOST_IP "openstack-ansible \
+ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \
      $OPENSTACK_OSA_PATH/playbooks/setup-openstack.yml | tee opnfv-setup-openstack.log"
 scp root@$OPNFV_HOST_IP:~/opnfv-setup-openstack.log $LOG_PATH/opnfv-setup-openstack.log
 echo "-----------------------------------------------------------------------"
@@ -299,4 +299,4 @@ USERNAME=$(ssh -q root@192.168.122.2 awk "/OS_USERNAME=./" openrc)
 PASSWORD=$(ssh -q root@192.168.122.2 awk "/OS_PASSWORD=./" openrc)
 echo "Info: Admin username -  ${USERNAME##*=}"
 echo "Info: Admin password - ${PASSWORD##*=}"
-echo "Info: It is recommended to change the default password."
\ No newline at end of file
+echo "Info: It is recommended to change the default password."