From e2a01b790f56df863b390a1ca3ffa38730d569ae Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 4 Feb 2021 15:14:06 +0000 Subject: [PATCH] Ubuntu: container image build * Use bash to execute kolla-build * Remove backslashes from kolla-build command. YAML folded literal block avoids the need for this by replacing newlines with spaces * Distribution-specific package list when installing kolla Change-Id: Icad129aaafb17023f3c9d007fb63466b23b1395a Story: 2004960 Task: 41764 --- ansible/container-image-build.yml | 20 +++++++++++--------- ansible/roles/kolla/tasks/install.yml | 11 ++++------- ansible/roles/kolla/vars/Debian.yml | 8 ++++++++ ansible/roles/kolla/vars/RedHat.yml | 8 ++++++++ 4 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 ansible/roles/kolla/vars/Debian.yml create mode 100644 ansible/roles/kolla/vars/RedHat.yml diff --git a/ansible/container-image-build.yml b/ansible/container-image-build.yml index 452a1e1f3..f8bfe69c5 100644 --- a/ansible/container-image-build.yml +++ b/ansible/container-image-build.yml @@ -43,14 +43,16 @@ - kolla_docker_registry_password is not none - name: Ensure Kolla container images are built - shell: > - set -o pipefail && - . {{ kolla_venv }}/bin/activate && - kolla-build \ - --config-dir {{ kolla_build_config_path }} \ - {% if item.type is defined %}--type {{ item.type }}{% endif %} \ - {% if kolla_docker_registry is not none %}--registry {{ kolla_docker_registry }}{% endif %} \ - {% if push_images | bool %}--push{% endif %} \ - {{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }} + shell: + cmd: > + set -o pipefail && + . {{ kolla_venv }}/bin/activate && + kolla-build + --config-dir {{ kolla_build_config_path }} + {% if item.type is defined %}--type {{ item.type }}{% endif %} + {% if kolla_docker_registry is not none %}--registry {{ kolla_docker_registry }}{% endif %} + {% if push_images | bool %}--push{% endif %} + {{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }} + executable: /bin/bash with_items: "{{ container_image_sets }}" when: item.regexes != '' diff --git a/ansible/roles/kolla/tasks/install.yml b/ansible/roles/kolla/tasks/install.yml index e81850204..f89af3597 100644 --- a/ansible/roles/kolla/tasks/install.yml +++ b/ansible/roles/kolla/tasks/install.yml @@ -1,4 +1,7 @@ --- +- name: Include OS family-specific variables + include_vars: "{{ ansible_os_family }}.yml" + - name: Ensure EPEL repo is installed package: name: epel-release @@ -10,13 +13,7 @@ - name: Ensure required packages are installed package: - name: - - gcc - - libffi-devel - - openssl-devel - - python3-devel - - python3-pip - - python3-virtualenv + name: "{{ kolla_package_dependencies }}" state: present become: True diff --git a/ansible/roles/kolla/vars/Debian.yml b/ansible/roles/kolla/vars/Debian.yml new file mode 100644 index 000000000..6a2428ae2 --- /dev/null +++ b/ansible/roles/kolla/vars/Debian.yml @@ -0,0 +1,8 @@ +--- +# List of packages to install. +kolla_package_dependencies: + - gcc + - libffi-dev + - libssl-dev + - python3-dev + - python3-pip diff --git a/ansible/roles/kolla/vars/RedHat.yml b/ansible/roles/kolla/vars/RedHat.yml new file mode 100644 index 000000000..dc2dbb32b --- /dev/null +++ b/ansible/roles/kolla/vars/RedHat.yml @@ -0,0 +1,8 @@ +--- +# List of packages to install. +kolla_package_dependencies: + - gcc + - libffi-devel + - openssl-devel + - python3-devel + - python3-pip