From e81825546577cfb300efbcaec32aae4716561385 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 25 Mar 2016 22:15:25 -0500 Subject: [PATCH] PR #45: Clean up var names and document new feature. --- README.md | 5 +++++ defaults/main.yml | 7 ++++--- tasks/setup-Ubuntu.yml | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cf7d998..8da8bd2 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,11 @@ Extra lines to be inserted in the top-level `http` block in `nginx.conf`. The va (For Debian/Ubuntu only) Allows you to set a different repository for the installation of Nginx. As an example, if you are running Debian's wheezy release, and want to get a newer version of Nginx, you can install the `wheezy-backports` repository and set that value here, and Ansible will use that as the `-t` option while installing Nginx. + nginx_ppa_use: false + nginx_ppa_version: stable + +(For Ubuntu only) Allows you to use the official Nginx PPA instead of the system's package. You can set the version to `stable` or `development`. + ## Dependencies None. diff --git a/defaults/main.yml b/defaults/main.yml index 35262f6..7c7c893 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,6 +2,10 @@ # Used only for Debian/Ubuntu installation, as the -t option for apt. nginx_default_release: "" +# Use the official Nginx PPA for Ubuntu, and the version to use if so. +nginx_ppa_use: false +nginx_ppa_version: stable + # The name of the nginx apt/yum package to install. nginx_package_name: "nginx" @@ -60,6 +64,3 @@ nginx_upstreams: [] # "srv2.example.com weight=3", # "srv3.example.com" # } - -nginx_ppa_version: stable -nginx_use_ppa: false diff --git a/tasks/setup-Ubuntu.yml b/tasks/setup-Ubuntu.yml index 011d177..920dc0b 100644 --- a/tasks/setup-Ubuntu.yml +++ b/tasks/setup-Ubuntu.yml @@ -1,11 +1,14 @@ --- - - name: Add PPA for Nginx. - apt_repository: repo='ppa:nginx/{{ nginx_ppa_version }}' state=present update_cache=yes - register: added_ppa - when: nginx_use_ppa +- name: Add PPA for Nginx. + apt_repository: + repo: 'ppa:nginx/{{ nginx_ppa_version }}' + state: present + update_cache: yes + register: nginx_ppa_added + when: nginx_ppa_use - - name: ensure nginx is not installed when the ppa was just added - apt: - pkg: nginx - state: absent - when: added_ppa.changed +- name: Ensure nginx will reinstall if the PPA was just added. + apt: + name: nginx + state: absent + when: nginx_ppa_added.changed