Remove rsyslog_client_repos var and fix apt cache updating

The ability to implement a custom apt/yum repository for rsyslog_client
has been removed as it is unused. Deployers may opt to do this in
a number of other methods (including customising the base container
cache) which do not require us to maintain this code.

Having this ability there resulted in the apt cache updating every time
the role executed even though there was no repo being added.

The cache_timeout variable is moved to the role defaults to allow it
to be overridden more easily and to be exposed in the role docs.

Change-Id: I113c9803495f2a935b99f272c387a4304a149cbf
This commit is contained in:
Jesse Pretorius 2016-08-22 15:42:27 +01:00 committed by Major Hayden
parent 7754422b5e
commit c0cff7b366
6 changed files with 9 additions and 41 deletions

View File

@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
## APT Cache Options
cache_timeout: 600
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
rsyslog_client_package_state: "latest"

View File

@ -0,0 +1,4 @@
---
upgrade:
- In the ``rsyslog_client`` role, the variable ``rsyslog_client_repos`` has
been removed as it is no longer used.

View File

@ -13,16 +13,6 @@
# 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_repos }}"
register: add_repos
until: add_repos|success
retries: 5
delay: 2
#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)
@ -34,9 +24,7 @@
- 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
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
- name: Install rsyslog packages
apt:

View File

@ -13,26 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#TODO(cloudnull) Remove this task once we move to Ansible 2.1
# where we can leverage the `yum_repository` module:
# https://docs.ansible.com/ansible/yum_repository_module.html
- name: Rsyslog yum repository
copy:
content: |
[{{ item.name }}]
name={{ item.name }}
description={{ item.description }}
baseurl={{ item.baseurl }}
gpgkey={{ item.gpgkey }}
gpgcheck=1
enabled=1
dest: "/etc/yum.repos.d/{{ item.file }}.repo"
register: add_repos
until: add_repos|success
retries: 5
delay: 2
with_items: "{{ rsyslog_client_repos }}"
- name: Install rsyslog packages
yum:
pkg: "{{ item }}"

View File

@ -13,15 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
## APT Cache Options
cache_timeout: 600
rsyslog_client_repos: []
# Example override to specify which repo the packages should come from
# rsyslog_client_repos:
# - { repo: "ppa:adiscon/v8-stable", state: "present" }
rsyslog_client_packages:
- rsyslog
- logrotate
- logrotate

View File

@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
rsyslog_client_repos: []
rsyslog_client_packages:
- rsyslog
- logrotate