diff --git a/defaults/main.yml b/defaults/main.yml index f2ee45b..08b572e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -54,3 +54,9 @@ repo_server_port: 8181 # This directory is used by the repo_build, and will cause problems if synced # to repo_containers with other releases. repo_build_global_links_dirname: links + +# This directory is used on the deploy host to create u-c files which are then +# copied to the repo server and served by http. Any other files in this +# directory placed by the deployer will also be transferred +repo_upper_constraints_path: "/etc/openstack_deploy/upper-constraints" + diff --git a/tasks/main.yml b/tasks/main.yml index c52dd15..d55ba94 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -50,5 +50,9 @@ tags: - repo_server-config +- include: repo_install_constraints.yml + when: inventory_hostname == groups['repo_all'][0] + tags: repo_server-config + - name: Flush handlers meta: flush_handlers diff --git a/tasks/repo_install_constraints.yml b/tasks/repo_install_constraints.yml new file mode 100644 index 0000000..00b0ecf --- /dev/null +++ b/tasks/repo_install_constraints.yml @@ -0,0 +1,52 @@ +--- +# Copyright 2021, BBC +# +# 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: Ensure deploy host u-c directory exists + file: + state: directory + path: "{{ repo_upper_constraints_path }}" + delegate_to: localhost + +# by default the u-c file is retrieved by https +- name: Retrieve upper constraints using https + get_url: + url: "{{ user_requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" + dest: "{{ repo_upper_constraints_path }}/{{ 'upper_constraints_' ~ requirements_git_install_branch | default('master') ~ '.txt' }}" + when: requirements_git_repo is search('http') + delegate_to: localhost + +- name: Retrieve local filesystem upper constraints in CI + command: + git --git-dir={{ requirements_git_repo.split('file://')[1] }}/.git show {{ requirements_git_install_branch | default('master') }}:upper-constraints.txt + when: requirements_git_repo is search('file://') + register: _uc_contents_git + delegate_to: localhost + tags: + - skip_ansible_lint + +- name: Copy local upper constraints content to a file in CI + copy: + content: "{{ _uc_contents_git.stdout }}" + dest: "{{ repo_upper_constraints_path }}/{{ 'upper_constraints_' ~ requirements_git_install_branch | default('master') ~ '.txt' }}" + when: requirements_git_repo is search('file://') + delegate_to: localhost + +- name: Copy all constraints files from the deploy host to the first repo server + copy: + src: "{{ repo_upper_constraints_path }}/" + dest: "{{ repo_service_home_folder }}/repo/constraints/" + owner: "{{ repo_service_user_name }}" + group: "{{ repo_service_group_name }}" + mode: 0644 \ No newline at end of file diff --git a/tasks/repo_pre_install.yml b/tasks/repo_pre_install.yml index da3e7b6..4f815ea 100644 --- a/tasks/repo_pre_install.yml +++ b/tasks/repo_pre_install.yml @@ -46,6 +46,7 @@ - path: "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}" - path: "{{ repo_service_home_folder }}/repo/pools" - path: "{{ repo_service_home_folder }}/repo/venvs" + - path: "{{ repo_service_home_folder }}/repo/constraints" - path: "/var/lib/nginx" - path: "/var/log/nginx" mode: "0775"