kayobe/ansible/roles/kolla-build/tasks/main.yml
Michal Nasiadka 996651b478 kolla-build: Add support for cross-arch builds
When kolla_base_arch and ansible_facts.architecture differs
we need to run multiarch/qemu-user-static image - see [1].

[1]: https://github.com/multiarch/qemu-user-static

Co-Authored-By: Bartosz Bezak <bartosz@stackhpc.com>

Change-Id: If149418f509c687c3e5d1072cc39a80af33dec5a
2024-09-27 14:28:21 +02:00

51 lines
1.7 KiB
YAML

---
- name: Set facts for repos.y[a]ml
set_fact:
repos_yaml_dest: "{{ kolla_build_config_path }}/repos.yml"
repos_yaml_sources: "{{ kolla_build_config_paths | product(['/kolla/repos.yaml', '/kolla/repos.yml']) | map('join') | unique | list }}"
- name: Check for the presence of any custom repos.y[a]ml file
delegate_to: localhost
stat:
path: "{{ item }}"
get_checksum: false
mime: false
with_items: "{{ repos_yaml_sources }}"
register: repos_yaml_stat
- name: Set kolla_build_repos_yaml_path if any custom repos.y[a]ml file exists
set_fact:
kolla_build_repos_yaml_path: "{{ repos_yaml_dest }}"
when: repos_yaml_stat.results | map(attribute='stat.exists') | select | length > 0
- name: Ensure the Kolla repos.yaml configuration file exists
merge_yaml:
sources: "{{ repos_yaml_sources }}"
dest: "{{ repos_yaml_dest }}"
mode: "0644"
when: kolla_build_repos_yaml_path is defined
- name: Ensure the Kolla build configuration file exists
merge_configs:
sources: "{{ kolla_build_config_paths | product(['/kolla/kolla-build.conf']) | map('join') | unique | list }}"
dest: "{{ kolla_build_config_path }}/kolla-build.conf"
mode: "0644"
- name: Ensure the Kolla build template overrides file exists
template:
src: template-override.j2.j2
dest: "{{ kolla_build_config_path }}/template-override.j2"
mode: "0644"
- name: Run multiarch/qemu-user-static image to support cross-arch build
community.general.docker_container:
command: "--reset -p yes"
cleanup: true
detach: false
image: "multiarch/qemu-user-static:7.2.0-1"
name: "qemu_user_static"
privileged: true
state: "started"
network_mode: "host"
when: ansible_facts.architecture != kolla_base_arch