
In order to reduce divergance with ansible-lint rules, we apply auto-fixing of violations. In current patch we replace all kind of truthy variables with `true` or `false` values to align with recommendations along with alignment of used quotes. Change-Id: I99d1920dd89b3d506741d388317da6f8089756a2
104 lines
4.4 KiB
YAML
104 lines
4.4 KiB
YAML
---
|
|
# Copyright 2018, 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.
|
|
|
|
# Set the available build targets for all nodes within an environment.
|
|
# build targets are grouped based on operating system and CPU
|
|
# architecture.
|
|
#
|
|
# This is the data structure used to determine the build host.
|
|
# venv_build_targets:
|
|
# {
|
|
# ansible_facts['distribution'] + '_' +
|
|
# ansible_facts['distribution_version'] + '_' +
|
|
# ansible_facts['architecture']: inventory_hostname
|
|
# }
|
|
# }
|
|
#
|
|
# Auto generation process:
|
|
# * The current inventory hostname is inserted as the first build target
|
|
# and will be used if no other suitable targets are found.
|
|
# * It then iterates over the group defined by {{ venv_build_group }} and if any
|
|
# targets are found it will catagorize them by distro and cpu architecture
|
|
# and add them to the list of targets.
|
|
# * If no build target is found for matching the distro and cpu
|
|
# criteria of the active inventory item, the generator will fall
|
|
# back to using the active inventory host as the build target.
|
|
#
|
|
# NOTE: (cloudnull): While there may be multiple inventory items
|
|
# that match a single distro and CPU architecture
|
|
# type, only one build target will ever be used.
|
|
# To make more than one build target effective,
|
|
# deployers should be using a shared file system
|
|
# for the repo servers.
|
|
venv_build_targets: |-
|
|
{% set targets = {} %}
|
|
{% for item in ((groups[venv_build_group] | default([])) | reverse) %}
|
|
{% set distro = (hostvars[item]['ansible_facts']['distribution'] | default('none') | lower) | replace(' ', '_') %}
|
|
{% if distro == 'ubuntu' %}
|
|
{% set distro_ver = (hostvars[item]['ansible_facts']['distribution_version'] | default('none.none')).split('.')[:2] | join('.') %}
|
|
{% else %}
|
|
{% set distro_ver = hostvars[item]['ansible_facts']['distribution_major_version'] | default('none') %}
|
|
{% endif %}
|
|
{% set arch = hostvars[item]['ansible_facts']['architecture'] | default('none') %}
|
|
{% set distro_arch = [distro, distro_ver, arch] | join('-') %}
|
|
{% if distro_arch not in targets %}
|
|
{% set _ = targets.update({distro_arch: item | string}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ targets }}
|
|
|
|
_venv_wheels_play_hosts: |-
|
|
{% set wheel_groups = {} %}
|
|
{% for host in ansible_play_hosts %}
|
|
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
|
|
{% set distro = (hostvars[host]['ansible_facts']['distribution'] | lower) | replace(' ', '_') %}
|
|
{% if distro == 'ubuntu' %}
|
|
{% set distro_ver = hostvars[host]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %}
|
|
{% else %}
|
|
{% set distro_ver = hostvars[host]['ansible_facts']['distribution_major_version'] %}
|
|
{% endif %}
|
|
{% set distro_arch = [distro, distro_ver, arch] | join('-') %}
|
|
{% if distro_arch not in wheel_groups %}
|
|
{% set _ = wheel_groups.update({distro_arch: [host]}) %}
|
|
{% else %}
|
|
{% set _ = wheel_groups[distro_arch].append(host) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ wheel_groups }}
|
|
|
|
_venv_wheels_first_play_hosts: |-
|
|
{% set first_hosts = [] %}
|
|
{% for distro_arch_hosts in _venv_wheels_play_hosts.values() %}
|
|
{% set _ = first_hosts.append(distro_arch_hosts | first) %}
|
|
{% endfor %}
|
|
{{ first_hosts }}
|
|
|
|
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"
|
|
|
|
_venv_build_dist: >-
|
|
{{ (ansible_facts['distribution'] | lower == 'ubuntu') | ternary(
|
|
ansible_facts['distribution_version'].split('.')[:2] | join('.'),
|
|
ansible_facts['distribution_major_version']
|
|
) }}
|
|
|
|
_venv_build_dist_arch: >-
|
|
{{
|
|
((ansible_facts['distribution'] | lower) | replace(' ', '_')) ~ '-' ~
|
|
_venv_build_dist ~ '-' ~
|
|
(ansible_facts['architecture'] | lower)
|
|
}}
|
|
|
|
_venv_build_requirements_prefix: "{{ venv_build_host_requirements_path }}/{{ venv_install_destination_path | basename }}"
|