Skip to content

Commit

Permalink
PR geerlingguy#45: Clean up var names and document new feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Mar 26, 2016
1 parent 3af0b28 commit e818255
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -60,6 +64,3 @@ nginx_upstreams: []
# "srv2.example.com weight=3",
# "srv3.example.com"
# }

nginx_ppa_version: stable
nginx_use_ppa: false
21 changes: 12 additions & 9 deletions tasks/setup-Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e818255

Please sign in to comment.