openstack-ansible/playbooks/repo-build.yml
Jesse Pretorius 8d2caac546 Restrict Ansible fact gathering to base subset
In Ansible 2.x the fact gathering process includes facts gathered
by facter [1] and ohai [2]if they are available. While this may be
useful in some environment, OpenStack-Ansible does not make use of
any of these facts in any of its playbooks/roles and the facts
gathered are therefore just an extra overhead.

This patch removes the facter and aohai gathering subsets. On a
test AIO this reduced the execution time for fact gathering to the
host and all running containers from 1m5s to 6s.

[1] https://docs.puppet.com/facter/
[2] https://docs.chef.io/ohai.html

This patch also re-implements the selective fact gathering in
run-playbooks that was implemented in
I348a4b7dfe70d56a64899246daf65ea834a75d2a but unintentionally
removed in 9be0662c4f79783d4db8736b89bbd38063635067

Change-Id: I9bfee53571f3dc3a0b0a0950242008e815722180
2016-08-20 13:11:32 +00:00

55 lines
1.8 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Group repo servers by architecture
hosts: repo_all
tasks:
- name: Group repo servers by architecture
group_by:
key: repo_servers_{{ ansible_architecture }}
tags:
- "repo-build"
# repo_all[0] is built last to ensure it has all build artifacts for final indexing
- name: Build new repo packages for a given release
hosts: repo_all[1:],repo_all[0]
gather_facts: "{{ gather_facts | default(True) }}"
user: root
serial: 1
pre_tasks:
- name: Load local packages
debug:
msg: "Loading Packages"
when:
- "groups['repo_servers_{{ ansible_architecture }}'] | length > 0"
- "inventory_hostname == groups['repo_servers_{{ ansible_architecture }}'][0]"
with_py_pkgs: "{{ pkg_locations }}"
register: local_packages
tags:
- always
roles:
- role: "repo_build"
repo_build_release_tag: "{{ openstack_release }}"
when:
- "groups['repo_servers_{{ ansible_architecture }}'] | length > 0"
- "inventory_hostname == groups['repo_servers_{{ ansible_architecture }}'][0]"
tags:
- "repo-build"
vars:
pkg_locations:
- ../
- /etc/ansible/roles
- /etc/openstack_deploy