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

57 lines
1.9 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: Determine the existing Ubuntu repo URL
shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list'
register: ubuntu_repo_url
changed_when: false
when:
- ansible_pkg_mgr == 'apt'
delegate_to: localhost
- name: Set apt repo facts based on discovered information
set_fact:
lxc_container_template_main_apt_repo: "{{ ubuntu_repo_url.stdout }}"
lxc_container_template_security_apt_rep: "{{ ubuntu_repo_url.stdout }}"
when:
- ansible_os_family == 'Debian'
- name: install the epel repo rpm from a remote repo
yum:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
state: "present"
when: ansible_pkg_mgr == 'yum'
- 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
- name: Set Ubuntu Cloud Archive repo URL based on discovered information
set_fact:
uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive"
when:
- nodepool.stat.exists | bool
- ansible_pkg_mgr == 'apt'
- nodepool.stat.exists | bool