Multi-distro pattern for rsyslog-client role
This is an implementation of a pattern for multi-distro support This allows for support of distros other than Ubuntu Change-Id: Ide94831464a74827d5c46b38557e483aaf4180d0
This commit is contained in:
parent
d7d6cb1794
commit
51d8a9e2df
@ -13,19 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
## APT Cache Options
|
|
||||||
cache_timeout: 600
|
|
||||||
|
|
||||||
rsyslog_client_apt_repos: []
|
|
||||||
|
|
||||||
# Example override to specify which repo the packages should come from
|
|
||||||
# rsyslog_client_apt_repos:
|
|
||||||
# - { repo: "ppa:adiscon/v8-stable", state: "present" }
|
|
||||||
|
|
||||||
rsyslog_client_apt_packages:
|
|
||||||
- rsyslog
|
|
||||||
- logrotate
|
|
||||||
|
|
||||||
rsyslog_client_spool_directory: /var/spool/rsyslog
|
rsyslog_client_spool_directory: /var/spool/rsyslog
|
||||||
|
|
||||||
# Set the `rsyslog_client_log_dir` variable in to override log file
|
# Set the `rsyslog_client_log_dir` variable in to override log file
|
||||||
|
57
tasks/install-apt.yml
Normal file
57
tasks/install-apt.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2014, 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: Rsyslog apt repository
|
||||||
|
apt_repository:
|
||||||
|
repo: "{{ item.repo }}"
|
||||||
|
state: "{{ item.state }}"
|
||||||
|
with_items: "{{ rsyslog_client_apt_repos }}"
|
||||||
|
register: add_repos
|
||||||
|
until: add_repos|success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
tags:
|
||||||
|
- rsyslog-client-apt-repositories
|
||||||
|
|
||||||
|
#TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache
|
||||||
|
#when https://github.com/ansible/ansible-modules-core/pull/1517 is merged
|
||||||
|
#in 1.9.x or we move to 2.0 (if tested working)
|
||||||
|
- name: Check apt last update file
|
||||||
|
stat:
|
||||||
|
path: /var/cache/apt
|
||||||
|
register: apt_cache_stat
|
||||||
|
tags:
|
||||||
|
- rsyslog-client-apt-packages
|
||||||
|
|
||||||
|
- name: Update apt if needed
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: >
|
||||||
|
"ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or
|
||||||
|
add_repos | changed
|
||||||
|
tags:
|
||||||
|
- rsyslog-client-apt-packages
|
||||||
|
|
||||||
|
- name: Install rsyslog packages
|
||||||
|
apt:
|
||||||
|
pkg: "{{ item }}"
|
||||||
|
state: latest
|
||||||
|
register: install_packages
|
||||||
|
until: install_packages|success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
with_items: "{{ rsyslog_client_apt_packages }}"
|
||||||
|
tags:
|
||||||
|
- rsyslog-client-apt-packages
|
@ -13,6 +13,15 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Gather variables for each operating system
|
||||||
|
include_vars: "{{ item }}"
|
||||||
|
with_first_found:
|
||||||
|
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||||
|
- "{{ ansible_distribution | lower }}.yml"
|
||||||
|
- "{{ ansible_os_family | lower }}.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- include: rsyslog_client_pre_install.yml
|
- include: rsyslog_client_pre_install.yml
|
||||||
- include: rsyslog_client_install.yml
|
- include: rsyslog_client_install.yml
|
||||||
- include: rsyslog_client_post_install.yml
|
- include: rsyslog_client_post_install.yml
|
||||||
|
@ -13,45 +13,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Rsyslog apt repository
|
- include: install-apt.yml
|
||||||
apt_repository:
|
when:
|
||||||
repo: "{{ item.repo }}"
|
- ansible_pkg_mgr == 'apt'
|
||||||
state: "{{ item.state }}"
|
|
||||||
with_items: "{{ rsyslog_client_apt_repos }}"
|
|
||||||
register: add_repos
|
|
||||||
until: add_repos|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
tags:
|
tags:
|
||||||
- rsyslog-client-apt-repositories
|
- install-apt
|
||||||
|
|
||||||
#TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache
|
|
||||||
#when https://github.com/ansible/ansible-modules-core/pull/1517 is merged
|
|
||||||
#in 1.9.x or we move to 2.0 (if tested working)
|
|
||||||
- name: Check apt last update file
|
|
||||||
stat:
|
|
||||||
path: /var/cache/apt
|
|
||||||
register: apt_cache_stat
|
|
||||||
tags:
|
|
||||||
- rsyslog-client-apt-packages
|
|
||||||
|
|
||||||
- name: Update apt if needed
|
|
||||||
apt:
|
|
||||||
update_cache: yes
|
|
||||||
when: >
|
|
||||||
"ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or
|
|
||||||
add_repos | changed
|
|
||||||
tags:
|
|
||||||
- rsyslog-client-apt-packages
|
|
||||||
|
|
||||||
- name: Install rsyslog packages
|
|
||||||
apt:
|
|
||||||
pkg: "{{ item }}"
|
|
||||||
state: latest
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ rsyslog_client_apt_packages }}"
|
|
||||||
tags:
|
|
||||||
- rsyslog-client-apt-packages
|
|
||||||
|
27
vars/debian.yml
Normal file
27
vars/debian.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2014, 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.
|
||||||
|
|
||||||
|
## APT Cache Options
|
||||||
|
cache_timeout: 600
|
||||||
|
|
||||||
|
rsyslog_client_apt_repos: []
|
||||||
|
|
||||||
|
# Example override to specify which repo the packages should come from
|
||||||
|
# rsyslog_client_apt_repos:
|
||||||
|
# - { repo: "ppa:adiscon/v8-stable", state: "present" }
|
||||||
|
|
||||||
|
rsyslog_client_apt_packages:
|
||||||
|
- rsyslog
|
||||||
|
- logrotate
|
Loading…
Reference in New Issue
Block a user