openstack-ansible-tests/common-tasks/test-set-nodepool-vars.yml
Jean-Philippe Evrard e01a2aecca Fix SUSE gate overrides outside gates
When storing the nodepool information task into suse mirror, the
resulting variable could be storing ansible information, not only
stdout. That could lead to malformed urls for the variable, when
the check is skipped outside gates.

See the value of a repo, containing ``opensuse_mirror`` here:
"{'skipped': True,
  'skip_reason': 'Conditional result was False',
  'changed': False}/distribution/leap/42.3/repo/oss/"

Change-Id: Idfd3c233c2239b642154960b536abe1f7fca7942
2017-12-04 09:44:02 +00:00

113 lines
3.3 KiB
YAML

---
# Copyright 2016, 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.
- name: Check if this is an OpenStack-CI nodepool instance
stat:
path: /etc/nodepool
register: nodepool
delegate_to: localhost
- name: Discover the lxc_image_cache_server value when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "http://${NODEPOOL_MIRROR_HOST}:8080/images.linuxcontainers/"
args:
executable: /bin/bash
register: lxc_reverse_proxy
delegate_to: localhost
when:
- nodepool.stat.exists | bool
tags:
- skip_ansible_lint
- name: Set a fact to override lxc_image_cache_server value when in nodepool
set_fact:
lxc_image_cache_server_mirrors: "{{ [lxc_reverse_proxy.stdout] }}"
when:
- nodepool.stat.exists | bool
- name: Discover the UCA repo URL value when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "${NODEPOOL_UCA_MIRROR}"
args:
executable: /bin/bash
register: uca_repo_url
delegate_to: localhost
when:
- ansible_pkg_mgr == 'apt'
- nodepool.stat.exists | bool
tags:
- skip_ansible_lint
- name: Set a fact to override uca_apt_repo_url value when in nodepool
set_fact:
uca_apt_repo_url: "{{ uca_repo_url.stdout }}"
when:
- ansible_pkg_mgr == 'apt'
- nodepool.stat.exists | bool
- name: Discover the CentOS mirror URL when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "${NODEPOOL_CENTOS_MIRROR}"
args:
executable: /bin/bash
register: centos_mirror_url
delegate_to: localhost
when:
- ansible_pkg_mgr in ['yum', 'dnf']
- nodepool.stat.exists | bool
tags:
- skip_ansible_lint
# NOTE(mhayden): This mirror URL already has the '/centos' URI added.
- name: Set a fact to override the CentOS mirror URL when in nodepool
set_fact:
openstack_hosts_centos_mirror_url: "{{ centos_mirror_url.stdout }}"
when:
- ansible_pkg_mgr in ['yum', 'dnf']
- nodepool.stat.exists | bool
- name: Discover the openSUSE mirror URL when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "${NODEPOOL_OPENSUSE_MIRROR}"
args:
executable: /bin/bash
register: _opensuse_mirror
delegate_to: localhost
when:
- ansible_pkg_mgr == 'zypper'
- nodepool.stat.exists | bool
tags:
- skip_ansible_lint
- name: Set a fact to override the openSUSE mirror URL when in nodepool
set_fact:
opensuse_mirror: "{{ _opensuse_mirror.stdout }}"
# OpenStack infra doesn't mirror OBS repos so use the upstream one
opensuse_mirror_obs: "http://download.opensuse.org"
when:
- ansible_pkg_mgr == 'zypper'
- nodepool.stat.exists | bool
- name: Set the files to copy into the container cache for OpenStack-CI instances
set_fact:
lxc_container_cache_files:
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
when:
- nodepool.stat.exists | bool