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 <jean-philippe.evrard@rackspace.co.uk>
This commit is contained in:
Jean-Philippe Evrard 2016-06-10 13:47:01 +01:00 committed by Jesse Pretorius (odyssey4me)
parent d83c889631
commit e5622adc43
27 changed files with 36 additions and 2 deletions

View File

@ -16,6 +16,7 @@
- name: Galera container config - name: Galera container config
hosts: galera_all hosts: galera_all
max_fail_percentage: 0 max_fail_percentage: 0
gather_facts: "{{ gather_facts | default(True) }}"
user: root user: root
tasks: tasks:
- name: Use the lxc-openstack aa profile - name: Use the lxc-openstack aa profile
@ -59,6 +60,7 @@
- name: Install galera server - name: Install galera server
hosts: galera_all hosts: galera_all
gather_facts: "{{ gather_facts | default(True) }}"
serial: 1 serial: 1
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root

View File

@ -15,6 +15,7 @@
- name: haproxy container config - name: haproxy container config
hosts: haproxy_all hosts: haproxy_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 0 max_fail_percentage: 0
user: root user: root
tasks: tasks:
@ -49,6 +50,7 @@
- haproxy-lxc-container-setup - haproxy-lxc-container-setup
- hosts: haproxy - hosts: haproxy
gather_facts: "{{ gather_facts | default(True) }}"
user: root user: root
vars_files: vars_files:
- "{{ haproxy_keepalived_vars_file | default('vars/configs/keepalived_haproxy.yml')}}" - "{{ haproxy_keepalived_vars_file | default('vars/configs/keepalived_haproxy.yml')}}"
@ -58,6 +60,7 @@
- name: Install haproxy - name: Install haproxy
hosts: haproxy hosts: haproxy
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Create container(s) - name: Create container(s)
hosts: "{{ container_group|default('all_containers') }}" hosts: "{{ container_group|default('all_containers') }}"
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
gather_facts: false gather_facts: false
user: root user: root

View File

@ -15,6 +15,7 @@
- name: Destroy lxc containers - name: Destroy lxc containers
hosts: "{{ container_group|default('all_containers') }}" hosts: "{{ container_group|default('all_containers') }}"
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
gather_facts: false gather_facts: false
user: root user: root

View File

@ -15,6 +15,7 @@
- name: Basic lxc host setup - name: Basic lxc host setup
hosts: "{{ lxc_host_group|default('hosts') }}" hosts: "{{ lxc_host_group|default('hosts') }}"
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
roles: roles:

View File

@ -15,6 +15,7 @@
- name: Install memcached - name: Install memcached
hosts: memcached hosts: memcached
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Basic host setup - name: Basic host setup
hosts: "{{ openstack_host_group|default('hosts') }}" hosts: "{{ openstack_host_group|default('hosts') }}"
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
roles: roles:

View File

@ -15,6 +15,7 @@
- name: Install the aodh components - name: Install the aodh components
hosts: aodh_all hosts: aodh_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install the ceilometer components - name: Install the ceilometer components
hosts: ceilometer_all hosts: ceilometer_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install cinder server - name: Install cinder server
hosts: cinder_all hosts: cinder_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install glance server - name: Install glance server
hosts: glance_all hosts: glance_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install heat server - name: Install heat server
hosts: heat_all hosts: heat_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install horizon server - name: Install horizon server
hosts: horizon_all hosts: horizon_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Ironic - name: Installation and setup of Ironic
hosts: ironic_all hosts: ironic_all
gather_facts: "{{ gather_facts | default(True) }}"
user: root user: root
pre_tasks: pre_tasks:
- name: Use the lxc-openstack aa profile - name: Use the lxc-openstack aa profile

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Keystone - name: Installation and setup of Keystone
hosts: keystone_all hosts: keystone_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Neutron - name: Installation and setup of Neutron
hosts: neutron_all hosts: neutron_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Nova - name: Installation and setup of Nova
hosts: nova_all hosts: nova_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Swift - name: Installation and setup of Swift
hosts: swift_all:swift_remote_all hosts: swift_all:swift_remote_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -17,6 +17,7 @@
- name: Installation and setup of Swift - name: Installation and setup of Swift
hosts: swift_all hosts: swift_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -17,6 +17,7 @@
# The services need to be installed first though. # The services need to be installed first though.
- name: Synchronisation of swift ring and ssh keys - name: Synchronisation of swift ring and ssh keys
hosts: swift_all:swift_remote_all hosts: swift_all:swift_remote_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
roles: roles:

View File

@ -15,6 +15,7 @@
- name: Installation and setup of Tempest - name: Installation and setup of Tempest
hosts: utility_all hosts: utility_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
roles: roles:

View File

@ -15,6 +15,7 @@
- name: Create and configure rabbitmq container - name: Create and configure rabbitmq container
hosts: rabbitmq_all hosts: rabbitmq_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 0 max_fail_percentage: 0
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Setup repo servers - name: Setup repo servers
hosts: repo_all hosts: repo_all
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -15,6 +15,7 @@
- name: Install rsyslog - name: Install rsyslog
hosts: rsyslog hosts: rsyslog
gather_facts: "{{ gather_facts | default(True) }}"
max_fail_percentage: 20 max_fail_percentage: 20
user: root user: root
pre_tasks: pre_tasks:

View File

@ -19,6 +19,7 @@
- name: Apply security hardening configurations - name: Apply security hardening configurations
hosts: "{{ host_group|default('hosts') }}" hosts: "{{ host_group|default('hosts') }}"
gather_facts: "{{ gather_facts | default(True) }}"
user: root user: root
roles: roles:
- { role: "openstack-ansible-security", - { role: "openstack-ansible-security",

View File

@ -39,6 +39,12 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $
# Initiate the deployment # Initiate the deployment
pushd "playbooks" pushd "playbooks"
ansible -m setup localhost
if [ "${DEPLOY_HOST}" == "no" ]; then
ansible -m setup all
fi
if [ "${DEPLOY_HOST}" == "yes" ]; then if [ "${DEPLOY_HOST}" == "yes" ]; then
# Install all host bits # Install all host bits
install_bits openstack-hosts-setup.yml install_bits openstack-hosts-setup.yml
@ -70,7 +76,7 @@ pushd "playbooks"
# Create the containers. # Create the containers.
install_bits lxc-containers-create.yml install_bits lxc-containers-create.yml
ansible -m setup all
# Log some data about the instance and the rest of the system # Log some data about the instance and the rest of the system
log_instance_info log_instance_info

View File

@ -19,7 +19,7 @@
LINE='----------------------------------------------------------------------' LINE='----------------------------------------------------------------------'
MAX_RETRIES=${MAX_RETRIES:-5} MAX_RETRIES=${MAX_RETRIES:-5}
REPORT_DATA=${REPORT_DATA:-""} REPORT_DATA=${REPORT_DATA:-""}
ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""} ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-" -e 'gather_facts=False' "}
STARTTIME="${STARTTIME:-$(date +%s)}" STARTTIME="${STARTTIME:-$(date +%s)}"
PIP_INSTALL_OPTIONS=${PIP_INSTALL_OPTIONS:-'pip==8.1.2 setuptools==22.0.0 wheel==0.29.0 '} PIP_INSTALL_OPTIONS=${PIP_INSTALL_OPTIONS:-'pip==8.1.2 setuptools==22.0.0 wheel==0.29.0 '}