![Jonathan Rosser](/assets/img/avatar_default.png)
All references to Gentoo, SUSE, Debian stretch and Centos-7 are removed. Conditional tasks, ternary operators and variables are simplified where possible OS specific variables files are generalised where possible Change-Id: Ibe914d0d547b930b8167bfa475cc838df8d7ae25
80 lines
2.4 KiB
YAML
80 lines
2.4 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: Install EPEL gpg keys
|
|
rpm_key:
|
|
key: "{{ repo_centos_epel_key }}"
|
|
state: present
|
|
when:
|
|
- ansible_facts['pkg_mgr'] == 'dnf'
|
|
register: _add_yum_keys
|
|
until: _add_yum_keys is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Install the EPEL repository
|
|
yum_repository:
|
|
name: epel-repo_server
|
|
baseurl: "{{ repo_centos_epel_mirror ~ '/' ~ repo_centos_epel_base }}"
|
|
description: 'Extra Packages for Enterprise Linux'
|
|
gpgcheck: yes
|
|
enabled: yes
|
|
state: present
|
|
includepkgs: 'lsyncd'
|
|
when:
|
|
- ansible_facts['pkg_mgr'] == 'dnf'
|
|
register: install_epel_repo
|
|
until: install_epel_repo is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Add NGINX repository
|
|
yum_repository:
|
|
name: nginx
|
|
description: 'nginx repo'
|
|
baseurl: "{{ repo_centos_nginx_mirror }}"
|
|
gpgkey: "{{ repo_centos_nginx_key }}"
|
|
when:
|
|
- ansible_facts['pkg_mgr'] == 'dnf'
|
|
register: add_nginx_repo
|
|
until: add_nginx_repo is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Install distro packages
|
|
package:
|
|
name: "{{ repo_server_distro_packages | reject('equalto', '') | list }}"
|
|
state: "{{ repo_server_package_state }}"
|
|
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
|
|
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
|
|
register: install_packages
|
|
until: install_packages is success
|
|
retries: 5
|
|
delay: 5
|
|
|
|
# This is so that the master repo server can perform pre and post rsync tasks
|
|
# which may include stopping nginx on the slaves while data is syncing.
|
|
- name: Allow nginx user to stop/start nginx via sudo
|
|
copy:
|
|
content: "nginx ALL=NOPASSWD: {{ repo_service_home_folder }}/repo/repo_prepost_cmd.sh\n"
|
|
dest: /etc/sudoers.d/nginx
|
|
|
|
- name: Drop rsyncd configuration file(s)
|
|
copy:
|
|
src: "rsync.defaults"
|
|
dest: "/etc/default/rsync"
|
|
notify:
|
|
- reload rsyncd
|