107 lines
2.8 KiB
YAML
107 lines
2.8 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: Enable epel-testing repository for cacher packages
|
|
yum_repository:
|
|
name: epel-testing
|
|
enabled: yes
|
|
mirrorlist: 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel7&arch=$basearch'
|
|
description: 'EPEL Testing Repository'
|
|
when:
|
|
- ansible_pkg_mgr == 'yum'
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- name: Enable zypper repositories (SUSE)
|
|
zypper_repository:
|
|
refresh: yes
|
|
name: "{{ item.name }}"
|
|
repo: "{{ item.repo }}"
|
|
register: zypper_repository_added
|
|
with_items:
|
|
- "{{ zypper_repositories }}"
|
|
when:
|
|
- ansible_pkg_mgr == 'zypper'
|
|
tags:
|
|
- repo_server-install
|
|
|
|
# NOTE(hwoarang): We need to run this right after we add the repos and
|
|
# before we install any packages so it can't be a handler unless we
|
|
# move everything to pre_tasks
|
|
- name: Refresh zypper repository (SUSE)
|
|
command: zypper --gpg-auto-import-keys ref
|
|
when:
|
|
- ansible_pkg_mgr == 'zypper'
|
|
- zypper_repository_added.changed
|
|
tags:
|
|
- skip_ansible_lint
|
|
- repo_server-install
|
|
|
|
- name: Install repo caching server packages
|
|
package:
|
|
name: "{{ repo_pkg_cache_server_distro_packages }}"
|
|
state: "{{ repo_server_package_state }}"
|
|
register: install_packages
|
|
until: install_packages|success
|
|
retries: 5
|
|
delay: 5
|
|
when:
|
|
- repo_pkg_cache_enabled | bool
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- name: Create cache directory
|
|
file:
|
|
path: "{{ repo_pkg_cache_dir }}"
|
|
state: "directory"
|
|
owner: "{{ repo_pkg_cache_owner }}"
|
|
group: "{{ repo_service_group_name }}"
|
|
mode: "02775"
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- name: Stat the cache path
|
|
stat:
|
|
path: /var/cache/apt-cacher-ng
|
|
register: acs
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- 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
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- name: Link cacher to the repo path
|
|
file:
|
|
src: "{{ repo_service_home_folder }}/repo/pkg-cache"
|
|
dest: "/var/cache/apt-cacher-ng"
|
|
state: "link"
|
|
tags:
|
|
- repo_server-install
|
|
|
|
- name: Drop acng.conf
|
|
template:
|
|
src: "acng.conf.j2"
|
|
dest: "/etc/apt-cacher-ng/acng.conf"
|
|
notify:
|
|
- reload acng
|
|
tags:
|
|
- repo_server-config
|