From e5622adc4369aa284734d73dcb92897c5de21fc2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Fri, 10 Jun 2016 13:47:01 +0100 Subject: [PATCH] Speed up gate: avoid gathering facts more than necessary This commit adds a gather_facts variable in the playbooks, which is defaulted to True. If run_playbooks.sh is used, this commit adds "-e gather_facts=False" to the openstack-ansible cli for the playbook run. Everything should work fine for deployers (because there is no change for them), and for the gate (because fact caching is enabled) It should speed up the gate by avoiding the long "setup" task cost for each host. Instead it does the setup to the appropriate hosts, at the appropriate time. Change-Id: I348a4b7dfe70d56a64899246daf65ea834a75d2a Signed-off-by: Jean-Philippe Evrard --- playbooks/galera-install.yml | 2 ++ playbooks/haproxy-install.yml | 3 +++ playbooks/lxc-containers-create.yml | 1 + playbooks/lxc-containers-destroy.yml | 1 + playbooks/lxc-hosts-setup.yml | 1 + playbooks/memcached-install.yml | 1 + playbooks/openstack-hosts-setup.yml | 1 + playbooks/os-aodh-install.yml | 1 + playbooks/os-ceilometer-install.yml | 1 + playbooks/os-cinder-install.yml | 1 + playbooks/os-glance-install.yml | 1 + playbooks/os-heat-install.yml | 1 + playbooks/os-horizon-install.yml | 1 + playbooks/os-ironic-install.yml | 1 + playbooks/os-keystone-install.yml | 1 + playbooks/os-neutron-install.yml | 1 + playbooks/os-nova-install.yml | 1 + playbooks/os-swift-install.yml | 1 + playbooks/os-swift-setup.yml | 1 + playbooks/os-swift-sync.yml | 1 + playbooks/os-tempest-install.yml | 1 + playbooks/rabbitmq-install.yml | 1 + playbooks/repo-server.yml | 1 + playbooks/rsyslog-install.yml | 1 + playbooks/security-hardening.yml | 1 + scripts/run-playbooks.sh | 8 +++++++- scripts/scripts-library.sh | 2 +- 27 files changed, 36 insertions(+), 2 deletions(-) diff --git a/playbooks/galera-install.yml b/playbooks/galera-install.yml index da77d3eb19..75ceff2f8d 100644 --- a/playbooks/galera-install.yml +++ b/playbooks/galera-install.yml @@ -16,6 +16,7 @@ - name: Galera container config hosts: galera_all max_fail_percentage: 0 + gather_facts: "{{ gather_facts | default(True) }}" user: root tasks: - name: Use the lxc-openstack aa profile @@ -59,6 +60,7 @@ - name: Install galera server hosts: galera_all + gather_facts: "{{ gather_facts | default(True) }}" serial: 1 max_fail_percentage: 20 user: root diff --git a/playbooks/haproxy-install.yml b/playbooks/haproxy-install.yml index d838c8c940..98f342d91e 100644 --- a/playbooks/haproxy-install.yml +++ b/playbooks/haproxy-install.yml @@ -15,6 +15,7 @@ - name: haproxy container config hosts: haproxy_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 0 user: root tasks: @@ -49,6 +50,7 @@ - haproxy-lxc-container-setup - hosts: haproxy + gather_facts: "{{ gather_facts | default(True) }}" user: root vars_files: - "{{ haproxy_keepalived_vars_file | default('vars/configs/keepalived_haproxy.yml')}}" @@ -58,6 +60,7 @@ - name: Install haproxy hosts: haproxy + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/lxc-containers-create.yml b/playbooks/lxc-containers-create.yml index ae92986162..8651ee4564 100644 --- a/playbooks/lxc-containers-create.yml +++ b/playbooks/lxc-containers-create.yml @@ -15,6 +15,7 @@ - name: Create container(s) hosts: "{{ container_group|default('all_containers') }}" + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 gather_facts: false user: root diff --git a/playbooks/lxc-containers-destroy.yml b/playbooks/lxc-containers-destroy.yml index 5dd6534cdc..a5453fffe3 100644 --- a/playbooks/lxc-containers-destroy.yml +++ b/playbooks/lxc-containers-destroy.yml @@ -15,6 +15,7 @@ - name: Destroy lxc containers hosts: "{{ container_group|default('all_containers') }}" + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 gather_facts: false user: root diff --git a/playbooks/lxc-hosts-setup.yml b/playbooks/lxc-hosts-setup.yml index bec6c599db..085ebc47b5 100644 --- a/playbooks/lxc-hosts-setup.yml +++ b/playbooks/lxc-hosts-setup.yml @@ -15,6 +15,7 @@ - name: Basic lxc host setup hosts: "{{ lxc_host_group|default('hosts') }}" + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root roles: diff --git a/playbooks/memcached-install.yml b/playbooks/memcached-install.yml index 9ff72a1405..ecbfc60561 100644 --- a/playbooks/memcached-install.yml +++ b/playbooks/memcached-install.yml @@ -15,6 +15,7 @@ - name: Install memcached hosts: memcached + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/openstack-hosts-setup.yml b/playbooks/openstack-hosts-setup.yml index 895391f99d..1d05295afd 100644 --- a/playbooks/openstack-hosts-setup.yml +++ b/playbooks/openstack-hosts-setup.yml @@ -15,6 +15,7 @@ - name: Basic host setup hosts: "{{ openstack_host_group|default('hosts') }}" + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root roles: diff --git a/playbooks/os-aodh-install.yml b/playbooks/os-aodh-install.yml index b763d8d619..1e80720b7a 100644 --- a/playbooks/os-aodh-install.yml +++ b/playbooks/os-aodh-install.yml @@ -15,6 +15,7 @@ - name: Install the aodh components hosts: aodh_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-ceilometer-install.yml b/playbooks/os-ceilometer-install.yml index b8105bceec..d107ae327b 100644 --- a/playbooks/os-ceilometer-install.yml +++ b/playbooks/os-ceilometer-install.yml @@ -15,6 +15,7 @@ - name: Install the ceilometer components hosts: ceilometer_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-cinder-install.yml b/playbooks/os-cinder-install.yml index 01424b31f1..77e2473415 100644 --- a/playbooks/os-cinder-install.yml +++ b/playbooks/os-cinder-install.yml @@ -15,6 +15,7 @@ - name: Install cinder server hosts: cinder_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-glance-install.yml b/playbooks/os-glance-install.yml index bff77076b5..d05ed2ca61 100644 --- a/playbooks/os-glance-install.yml +++ b/playbooks/os-glance-install.yml @@ -15,6 +15,7 @@ - name: Install glance server hosts: glance_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-heat-install.yml b/playbooks/os-heat-install.yml index cbd12bc3ae..d133b7f294 100644 --- a/playbooks/os-heat-install.yml +++ b/playbooks/os-heat-install.yml @@ -15,6 +15,7 @@ - name: Install heat server hosts: heat_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-horizon-install.yml b/playbooks/os-horizon-install.yml index e5abbe7a54..8271601c44 100644 --- a/playbooks/os-horizon-install.yml +++ b/playbooks/os-horizon-install.yml @@ -15,6 +15,7 @@ - name: Install horizon server hosts: horizon_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-ironic-install.yml b/playbooks/os-ironic-install.yml index 3ca4c7f36f..64f59f40cb 100644 --- a/playbooks/os-ironic-install.yml +++ b/playbooks/os-ironic-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Ironic hosts: ironic_all + gather_facts: "{{ gather_facts | default(True) }}" user: root pre_tasks: - name: Use the lxc-openstack aa profile diff --git a/playbooks/os-keystone-install.yml b/playbooks/os-keystone-install.yml index fe9a135f8e..65fba527b1 100644 --- a/playbooks/os-keystone-install.yml +++ b/playbooks/os-keystone-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Keystone hosts: keystone_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-neutron-install.yml b/playbooks/os-neutron-install.yml index efbe16f365..cd42478d57 100644 --- a/playbooks/os-neutron-install.yml +++ b/playbooks/os-neutron-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Neutron hosts: neutron_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-nova-install.yml b/playbooks/os-nova-install.yml index d5b408358a..64e13e3a18 100644 --- a/playbooks/os-nova-install.yml +++ b/playbooks/os-nova-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Nova hosts: nova_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-swift-install.yml b/playbooks/os-swift-install.yml index 09ddc6c6eb..f80f16a633 100644 --- a/playbooks/os-swift-install.yml +++ b/playbooks/os-swift-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Swift hosts: swift_all:swift_remote_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-swift-setup.yml b/playbooks/os-swift-setup.yml index 1c560aa254..28c468e715 100644 --- a/playbooks/os-swift-setup.yml +++ b/playbooks/os-swift-setup.yml @@ -17,6 +17,7 @@ - name: Installation and setup of Swift hosts: swift_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/os-swift-sync.yml b/playbooks/os-swift-sync.yml index 7522b1d438..81e3835995 100644 --- a/playbooks/os-swift-sync.yml +++ b/playbooks/os-swift-sync.yml @@ -17,6 +17,7 @@ # The services need to be installed first though. - name: Synchronisation of swift ring and ssh keys hosts: swift_all:swift_remote_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root roles: diff --git a/playbooks/os-tempest-install.yml b/playbooks/os-tempest-install.yml index e8f0acf392..d167e18abc 100644 --- a/playbooks/os-tempest-install.yml +++ b/playbooks/os-tempest-install.yml @@ -15,6 +15,7 @@ - name: Installation and setup of Tempest hosts: utility_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root roles: diff --git a/playbooks/rabbitmq-install.yml b/playbooks/rabbitmq-install.yml index 6c47de11c4..6b9dd52a35 100644 --- a/playbooks/rabbitmq-install.yml +++ b/playbooks/rabbitmq-install.yml @@ -15,6 +15,7 @@ - name: Create and configure rabbitmq container hosts: rabbitmq_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 0 user: root pre_tasks: diff --git a/playbooks/repo-server.yml b/playbooks/repo-server.yml index 7b15aa9b49..a7d8ba67c3 100644 --- a/playbooks/repo-server.yml +++ b/playbooks/repo-server.yml @@ -15,6 +15,7 @@ - name: Setup repo servers hosts: repo_all + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/rsyslog-install.yml b/playbooks/rsyslog-install.yml index adc0b27f62..1d85c2fa55 100644 --- a/playbooks/rsyslog-install.yml +++ b/playbooks/rsyslog-install.yml @@ -15,6 +15,7 @@ - name: Install rsyslog hosts: rsyslog + gather_facts: "{{ gather_facts | default(True) }}" max_fail_percentage: 20 user: root pre_tasks: diff --git a/playbooks/security-hardening.yml b/playbooks/security-hardening.yml index ec8f561f96..9d0ff761a2 100644 --- a/playbooks/security-hardening.yml +++ b/playbooks/security-hardening.yml @@ -19,6 +19,7 @@ - name: Apply security hardening configurations hosts: "{{ host_group|default('hosts') }}" + gather_facts: "{{ gather_facts | default(True) }}" user: root roles: - { role: "openstack-ansible-security", diff --git a/scripts/run-playbooks.sh b/scripts/run-playbooks.sh index 0a0c38d54c..c1aaa5a0a6 100755 --- a/scripts/run-playbooks.sh +++ b/scripts/run-playbooks.sh @@ -39,6 +39,12 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $ # Initiate the deployment pushd "playbooks" + ansible -m setup localhost + + if [ "${DEPLOY_HOST}" == "no" ]; then + ansible -m setup all + fi + if [ "${DEPLOY_HOST}" == "yes" ]; then # Install all host bits install_bits openstack-hosts-setup.yml @@ -70,7 +76,7 @@ pushd "playbooks" # Create the containers. install_bits lxc-containers-create.yml - + ansible -m setup all # Log some data about the instance and the rest of the system log_instance_info diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index d5d0f18b6c..a8df6cb4cb 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -19,7 +19,7 @@ LINE='----------------------------------------------------------------------' MAX_RETRIES=${MAX_RETRIES:-5} REPORT_DATA=${REPORT_DATA:-""} -ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""} +ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-" -e 'gather_facts=False' "} STARTTIME="${STARTTIME:-$(date +%s)}" PIP_INSTALL_OPTIONS=${PIP_INSTALL_OPTIONS:-'pip==8.1.2 setuptools==22.0.0 wheel==0.29.0 '}