openstack-ansible-tests/common-tasks/test-set-nodepool-vars.yml

102 lines
3.1 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/provider
register: nodepool
delegate_to: localhost
- name: Discover the lxc_image_cache_server value when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "${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: "{{ 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:
pip_install_centos_mirror_url: "{{ centos_mirror_url.stdout }}"
when:
- ansible_pkg_mgr in ['yum', 'dnf']
- nodepool.stat.exists | bool
# NOTE(mhayden): GPG checking for local package installs is normally disabled
# by default in CentOS, but the ansible-hardening role enables GPG
# checking for local packages. The RDO repository package isn't signed, but the
# repos it installs have GPG checking enabled.
- name: Install the RDO release package
package:
name: "https://repos.fedorapeople.org/repos/openstack/openstack-ocata/rdo-release-ocata.rpm"
state: "present"
disable_gpg_check: yes
when:
- ansible_pkg_mgr in ['yum', 'dnf']
- 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