Merge "Simplify multi arch repo build"
This commit is contained in:
commit
cd77532a0c
@ -16,36 +16,31 @@
|
|||||||
- name: Group repo servers by architecture
|
- name: Group repo servers by architecture
|
||||||
hosts: repo_all
|
hosts: repo_all
|
||||||
tasks:
|
tasks:
|
||||||
- name: Group repo servers by architecture
|
- name: Group repo servers by architecture and os version
|
||||||
group_by:
|
group_by:
|
||||||
key: repo_servers_{{ ansible_architecture }}
|
key: repo_servers_{{ ansible_distribution_version }}_{{ ansible_architecture }}
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
|
|
||||||
# Use the 'add_host' module to create the repo_nodes group. The add_hosts module
|
# Use the 'add_host' module to create the repo_masters group which consists of a
|
||||||
# bypasses the play host loop of ansible and runs only once referencing the first
|
# single host in each distribution/architecture combination. This ensures that
|
||||||
# host. To run it on each host we have to use with_items. Also note, we have
|
# the repo build happens per architecture and per distribution, covering the needs
|
||||||
# to manually lookup the ansible_architecture for the 'item' host.
|
# of each of these combinations when deploying.
|
||||||
- name: Prepare group of master repo servers
|
- name: Prepare group of master repo servers
|
||||||
local_action:
|
local_action:
|
||||||
module: "add_host"
|
module: "add_host"
|
||||||
name: "{{ groups['repo_servers_' + (hostvars[item].ansible_distribution_version.split('.')[:2] | join('.')) + hostvars[item].ansible_architecture][0] }}"
|
name: "{{ item }}"
|
||||||
groups: "repo_nodes"
|
groups: repo_masters
|
||||||
# Process all nodes that don't match the architecture of repo_all[0]
|
when:
|
||||||
when: >
|
- "inventory_hostname in groups['repo_servers_' + ansible_distribution_version + '_' + ansible_architecture][0]"
|
||||||
hostvars[item].ansible_architecture != hostvars[groups['repo_all'][0]].ansible_architecture or
|
with_inventory_hostnames:
|
||||||
(hostvars[item].ansible_distribution_version.split('.')[:2] | join('.')) != (hostvars[groups['repo_all'][0]].ansible_distribution_version.split('.')[:2] | join('.'))
|
- repo_all
|
||||||
with_items:
|
|
||||||
- "{{ groups['repo_all'][1:] }}"
|
|
||||||
tags:
|
tags:
|
||||||
|
- always
|
||||||
- repo-build
|
- repo-build
|
||||||
|
|
||||||
# repo_all[0] is built last to ensure it has all build artifacts for final indexing
|
|
||||||
# The repo_nodes group will be populated with the first node of any other system running
|
|
||||||
# different architectures. This group is a meta group created in the previous play and
|
|
||||||
# will not be found within inventory.
|
|
||||||
- name: Build new repo packages for a given release
|
- name: Build new repo packages for a given release
|
||||||
hosts: repo_nodes, repo_all[0]
|
hosts: repo_masters
|
||||||
gather_facts: "{{ gather_facts | default(True) }}"
|
gather_facts: "{{ gather_facts | default(True) }}"
|
||||||
user: root
|
user: root
|
||||||
serial: 1
|
serial: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user