Consolidate package install tasks

Use the package module to install rsyslog server distro packages with
the package lists provided directly rather than looping through each
item.

Change-Id: If08bab687ef561edf61580d7f354207a83ca2393
This commit is contained in:
Jimmy McCrory 2017-07-11 14:37:18 -07:00
parent baf3152eae
commit b8a3625164
5 changed files with 11 additions and 94 deletions

View File

@ -1,28 +0,0 @@
---
# 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: Install rsyslog apt packages
apt:
pkg: "{{ item }}"
state: "{{ rsyslog_server_package_state }}"
update_cache: yes
cache_valid_time: "{{ cache_timeout }}"
register: install_apt_packages
until: install_apt_packages | success
retries: 5
delay: 2
with_items: "{{ rsyslog_server_distro_packages }}"
tags:
- rsyslog-apt-packages

View File

@ -1,36 +0,0 @@
---
# 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.
- name: yum clean all
command: "/usr/bin/yum clean all"
register: yum_clean
until: yum_clean | success
retries: 5
delay: 2
tags:
- rsyslog-yum-packages
- skip_ansible_lint
- name: Install rsyslog yum packages
yum:
pkg: "{{ item }}"
state: "{{ rsyslog_server_package_state }}"
register: install_yum_packages
until: install_yum_packages | success
retries: 5
delay: 2
with_items: "{{ rsyslog_server_distro_packages }}"
tags:
- rsyslog-yum-packages

View File

@ -1,26 +0,0 @@
---
# Copyright 2017, SUSE LINUX GmbH.
#
# 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 rsyslog zypper packages
zypper:
name: "{{ item }}"
state: "{{ rsyslog_server_package_state }}"
register: install_zypper_packages
until: install_zypper_packages | success
retries: 5
delay: 2
with_items: "{{ rsyslog_server_distro_packages }}"
tags:
- rsyslog-zypper-packages

View File

@ -13,7 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: install-{{ ansible_pkg_mgr }}.yml
- name: Install rsyslog packages
package:
name: "{{ rsyslog_server_distro_packages }}"
state: "{{ rsyslog_server_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages | success
retries: 5
delay: 2
tags:
- install-apt
- install-yum

View File

@ -39,7 +39,5 @@
- name: Remove conflicting distro packages
package:
name: "{{ item }}"
name: "{{ rsyslog_server_distro_packages_remove | default([]) }}"
state: absent
with_items:
- "{{ rsyslog_server_distro_packages_remove | default([]) }}"