Add Centos-8 support

This builds lsyncd from source files for CentOS 8 as there is no package
for it.

Change-Id: Iab8d28c32e534e62759dc2bc72bd6368fbea471d
This commit is contained in:
Jonathan Rosser 2020-02-24 13:49:15 +00:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 8108928483
commit eea73c1011
6 changed files with 121 additions and 5 deletions

View File

@ -25,10 +25,10 @@ cache_timeout: 600
## Centos EPEL repository options
repo_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}"
repo_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7') }}"
repo_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_distribution_major_version) }}"
## Centos NGINX repository options
repo_centos_nginx_mirror: "{{ centos_nginx_mirror | default('http://nginx.org/packages/centos/7/$basearch/') }}"
repo_centos_nginx_mirror: "{{ centos_nginx_mirror | default('http://nginx.org/packages/centos/$releasever/$basearch') }}"
repo_centos_nginx_key: "{{ centos_nginx_key | default('http://nginx.org/keys/nginx_signing.key') }}"
# Set the package install state for distribution and pip packages

View File

@ -27,8 +27,8 @@
- name: Install the EPEL repository
yum_repository:
name: epel-repo_server
baseurl: "{{ repo_centos_epel_mirror ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}"
description: 'Extra Packages for Enterprise Linux 7 - $basearch'
baseurl: "{{ repo_centos_epel_mirror ~ '/' ~ repo_centos_epel_base }}"
description: 'Extra Packages for Enterprise Linux'
gpgcheck: yes
enabled: yes
state: present

View File

@ -0,0 +1,59 @@
---
# Copyright 2020, VEXXHOST, 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 devel packages
package:
name: "{{ repo_server_build_packages }}"
state: installed
enablerepo: "{{ (ansible_os_family | lower == 'redhat' and ansible_distribution_major_version is version('8', '=')) | ternary('PowerTools', omit) }}"
- name: Create temporary directory for build
tempfile:
state: directory
register: lsync_build
- name: Clone lsyncd repository
git:
repo: "{{ repo_server_lsyncd_repo }}"
dest: "{{ lsync_build.path }}"
version: "{{ repo_server_lsyncd_version }}"
update: no
- name: Install lsync
command: "{{ item }}"
args:
chdir: "{{ lsync_build.path }}"
changed_when: false
with_items:
- 'cmake .'
- 'make'
- 'make install'
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_slice_name: lsyncd
systemd_lock_path: /var/lock/lsync
systemd_services:
- service_name: lsyncd
state: started
enabled: yes
execstarts: /usr/local/bin/lsyncd -nodaemon /etc/lsyncd/lsyncd.conf.lua
- name: Cleanup temporary build folder
file:
path: "{{ lsync_build.path }}"
state: absent

View File

@ -13,6 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install lsyncd from source
include_tasks: repo_install_lsyncd.yml
when:
- ansible_os_family | lower == 'redhat'
- ansible_distribution_major_version is version('8', '=')
tags:
- build-lsyncd
- name: Deploy lsyncd configuration file
template:
src: "{{ item.src }}"

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
repo_centos_epel_base: "{{ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}"
systemd_utils_prefix: "/lib/systemd"
repo_nginx_pid: /run/nginx.pid
@ -25,7 +27,6 @@ repo_server_distro_packages:
- nginx
- openssh-server
- rsync
- "{% if ansible_distribution_major_version|int > 7 %}rsync-daemon{% endif %}"
- sudo
repo_lsyncd_config_file: /etc/lsyncd.conf

48
vars/redhat-8.yml Normal file
View File

@ -0,0 +1,48 @@
---
# Copyright 2016, Walmart Stores, 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.
repo_centos_epel_base: "{{ ansible_distribution_major_version ~ '/Everything/' ~ ansible_architecture }}"
systemd_utils_prefix: "/lib/systemd"
repo_nginx_pid: /run/nginx.pid
git_daemon_path: /usr/libexec/git-core/git-daemon
rsyncd_service_name: rsyncd
repo_server_lsyncd_repo: https://github.com/axkibe/lsyncd
repo_server_lsyncd_version: master
# Installing this to build lsyncd from source
repo_server_build_packages:
- automake
- cmake
- gcc
- gcc-c++
- lua-devel
- make
repo_server_distro_packages:
- git-daemon
- nginx
- openssh-server
- rsync
- rsync-daemon
- sudo
repo_lsyncd_config_file: /etc/lsyncd.conf
repo_lsyncd_defaults_file: /etc/sysconfig/lsyncd
repo_server_sshd: sshd