d0b0668657
To resolve the warnings, we: 1. Use import_playbook instead of include for the conditional playbook inclusions in site.yml. TIL that using include_playbook does not work with conditionals. 2. Use include_tasks instead of include for the openstack-image-setup task set inclusion. 3. Switch to using 'is' instead of '|' for tests. Change-Id: I6d68bd4fecda122a77f7934842c3479a4c0792fd
107 lines
3.4 KiB
YAML
107 lines
3.4 KiB
YAML
---
|
|
# Copyright 2017, 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 witing, 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: Gather facts
|
|
hosts: pxe_hosts
|
|
environment: "{{ deployment_environment_variables | default({}) }}"
|
|
tags:
|
|
- deploy-acng
|
|
tasks:
|
|
- name: Gather variables for each operating system
|
|
include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
|
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
|
- "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
|
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}.yml"
|
|
- "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}.yml"
|
|
tags:
|
|
- always
|
|
|
|
- name: Install repo caching server packages
|
|
package:
|
|
name: "{{ mnaio_pkg_cache_server_distro_packages }}"
|
|
state: "latest"
|
|
update_cache: yes
|
|
cache_valid_time: 600
|
|
register: _install_host_packages
|
|
until: _install_host_packages is success
|
|
retries: 3
|
|
delay: 15
|
|
|
|
- name: Create cache directory
|
|
file:
|
|
path: "/var/www/pkg-cache"
|
|
state: "directory"
|
|
owner: "apt-cacher-ng"
|
|
group: "www-data"
|
|
mode: "02775"
|
|
|
|
- name: Stat the cache path
|
|
stat:
|
|
path: /var/cache/apt-cacher-ng
|
|
register: acs
|
|
|
|
- name: Remove cacher directory if its a directory
|
|
file:
|
|
path: "/var/cache/apt-cacher-ng"
|
|
state: "absent"
|
|
when:
|
|
- acs.stat.isdir is defined and acs.stat.isdir
|
|
|
|
- name: Link cacher to the repo path
|
|
file:
|
|
src: "/var/www/pkg-cache"
|
|
dest: "/var/cache/apt-cacher-ng"
|
|
state: "link"
|
|
|
|
- name: create yum merged mirror list
|
|
shell: |
|
|
curl https://www.centos.org/download/full-mirrorlist.csv | sed 's/^.*"http:/http:/' | sed 's/".*$//' | grep ^http >/etc/apt-cacher-ng/centos_mirrors
|
|
echo "http://mirror.centos.org/centos/" >>/etc/apt-cacher-ng/centos_mirrors
|
|
|
|
- name: override default ubuntu mirror list
|
|
copy:
|
|
dest: /etc/apt-cacher-ng/backends_ubuntu
|
|
mode: 0644
|
|
owner: root
|
|
group: root
|
|
content: 'http://archive.ubuntu.com/ubuntu/'
|
|
notify:
|
|
- reload acng
|
|
|
|
- name: Drop acng.conf
|
|
template:
|
|
src: "pxe/acng.conf.j2"
|
|
dest: "/etc/apt-cacher-ng/acng.conf"
|
|
notify:
|
|
- reload acng
|
|
|
|
- name: Drop apt package manager proxy
|
|
copy:
|
|
content: 'Acquire::http { Proxy "{{ default_ubuntu_mirror_proxy }}"; };'
|
|
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
|
|
|
|
- name: Update apt when proxy is added
|
|
apt:
|
|
update_cache: yes
|
|
|
|
handlers:
|
|
- name: reload acng
|
|
service:
|
|
name: "apt-cacher-ng"
|
|
state: restarted
|
|
enabled: yes
|