Ensure we use the package module when installing packages.

Change-Id: Ia5f874eaf3d8ca08ca61a3ee1df3f8416fa83f6f
This commit is contained in:
Donovan Francesco (drifterza) 2017-01-30 10:41:48 +02:00
parent 9d21a73fb2
commit 9c8a51c8d0
4 changed files with 25 additions and 78 deletions

View File

@ -1,28 +0,0 @@
---
# 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 repo server packages
apt:
pkg: "{{ item }}"
state: "{{ repo_server_package_state }}"
update_cache: yes
cache_valid_time: "{{ cache_timeout }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 5
with_items: "{{ repo_server_distro_packages }}"
tags:
- repo-packages

View File

@ -1,26 +0,0 @@
---
# 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 repo server packages
yum:
pkg: "{{ item }}"
state: "{{ repo_server_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 5
with_items: "{{ repo_server_distro_packages }}"
tags:
- repo-packages

View File

@ -13,25 +13,20 @@
# 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: Install repo caching server packages (yum) - name: Enable epel-testing repository for cacher packages
yum: yum_repository:
pkg: "{{ item }}" name: epel-testing
state: "{{ repo_server_package_state }}" enabled: yes
enablerepo: "epel-testing" mirrorlist: 'http://mirrors.fedoraproject.org/mirrorlist?repo=testing-epel7&arch=$basearch'
register: install_packages description: 'EPEL Testing Repository'
until: install_packages|success
retries: 5
delay: 5
with_items: "{{ repo_pkg_cache_server_distro_packages }}"
when: when:
- ansible_pkg_mgr == 'yum' - ansible_pkg_mgr == 'yum'
- repo_pkg_cache_enabled | bool
tags: tags:
- repo_server-install - repo_server-install
- name: Install repo caching server packages (apt) - name: Install repo caching server packages
apt: package:
pkg: "{{ item }}" name: "{{ item }}"
state: "{{ repo_server_package_state }}" state: "{{ repo_server_package_state }}"
register: install_packages register: install_packages
until: install_packages|success until: install_packages|success
@ -39,7 +34,6 @@
delay: 5 delay: 5
with_items: "{{ repo_pkg_cache_server_distro_packages }}" with_items: "{{ repo_pkg_cache_server_distro_packages }}"
when: when:
- ansible_pkg_mgr == 'apt'
- repo_pkg_cache_enabled | bool - repo_pkg_cache_enabled | bool
tags: tags:
- repo_server-install - repo_server-install

View File

@ -13,14 +13,21 @@
# 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.
- include: install_apt.yml - name: Ensure apt cache is up to date
static: no apt:
when: ansible_pkg_mgr == 'apt' update_cache: yes
tags: cache_valid_time: "{{ cache_timeout }}"
- repo-apt-packages when:
- ansible_pkg_mgr == 'apt'
- include: install_yum.yml - name: Install repo server packages
static: no package:
when: ansible_pkg_mgr == 'yum' name: "{{ item }}"
state: "{{ repo_server_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 5
with_items: "{{ repo_server_distro_packages }}"
tags: tags:
- repo-yum-packages - repo-packages