From d1fcb5b61590dd26cd97532a89ca2e48229ceaba Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 17 Feb 2016 15:08:36 -0500 Subject: [PATCH] Refactor package support Remove dead code. Remove epel-release support and force user to enable it. Change-Id: Ie9fc5c43f6aa5eb953923eb4bc2d3d481fc6aa2d Signed-off-by: Paul Belanger --- defaults/main.yaml | 2 ++ tasks/install.yaml | 11 ++++------- tasks/install/redhat.yaml | 9 --------- tests/test.yaml | 8 ++++++++ vars/Debian.yaml | 14 ++++++++++++++ vars/RedHat.yaml | 1 - 6 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 vars/Debian.yaml diff --git a/defaults/main.yaml b/defaults/main.yaml index 3949daf..ca4064b 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -20,3 +20,5 @@ nginx_file_include_dir_src: "" nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf nginx_file_nginx_conf_src: "" + +nginx_package_name: nginx diff --git a/tasks/install.yaml b/tasks/install.yaml index c72da95..71484ec 100644 --- a/tasks/install.yaml +++ b/tasks/install.yaml @@ -12,10 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. --- -- name: Define nginx_config_include_dir - set_fact: - nginx_config_include_dir: "{{ __nginx_config_include_dir }}" - when: nginx_config_include_dir is not defined - -- include: install/redhat.yaml - when: ansible_os_family == 'RedHat' +- name: Install nginx package. + package: + name: "{{ nginx_package_name }}" + state: installed diff --git a/tasks/install/redhat.yaml b/tasks/install/redhat.yaml index 7ea7404..7dcd548 100644 --- a/tasks/install/redhat.yaml +++ b/tasks/install/redhat.yaml @@ -12,13 +12,4 @@ # License for the specific language governing permissions and limitations # under the License. --- -# NOTE(pabelanger): This needs to be here for now, since we need python-pip. -- name: Ensure EPEL is enabled. - yum: - pkg: epel-release - state: installed -- name: Install nginx using yum. - yum: - pkg: nginx - state: installed diff --git a/tests/test.yaml b/tests/test.yaml index 81dab81..62d6636 100644 --- a/tests/test.yaml +++ b/tests/test.yaml @@ -15,5 +15,13 @@ - hosts: localhost vars: rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" + pre_tasks: + # Make sure OS does not have a stale package cache. + - name: Update apt cache. + become: yes + apt: + update_cache: yes + when: ansible_os_family == 'Debian' + roles: - "{{ rolename }}" diff --git a/vars/Debian.yaml b/vars/Debian.yaml new file mode 100644 index 0000000..ca41d99 --- /dev/null +++ b/vars/Debian.yaml @@ -0,0 +1,14 @@ +# Copyright 2015 Red Hat, 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. +--- diff --git a/vars/RedHat.yaml b/vars/RedHat.yaml index e1ccf05..ca41d99 100644 --- a/vars/RedHat.yaml +++ b/vars/RedHat.yaml @@ -12,4 +12,3 @@ # License for the specific language governing permissions and limitations # under the License. --- -__nginx_config_include_dir: /etc/nginx/conf.d