roles/nginx: Use template for nginx repo
A template is better than ansible's `apt_repository` module because we can idempotently control the contents of the file based on vari- ables. Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
parent
aa5a9f5dd8
commit
3746e798b6
@ -13,4 +13,8 @@ nginx_tls_protocols: TLSv1 TLSv1.1 TLSv1.2
|
||||
# TLS key directory
|
||||
tls_key_dir: /etc/ssl/private
|
||||
|
||||
# stable is 1.8.x
|
||||
# mainline is 1.9.x
|
||||
nginx_version: mainline
|
||||
|
||||
# vim: set ts=2 sw=2:
|
||||
|
@ -3,12 +3,8 @@
|
||||
apt_key: url=http://nginx.org/keys/nginx_signing.key state=present
|
||||
tags: nginx
|
||||
|
||||
- name: Add nginx.org mainline repo
|
||||
apt_repository: repo="deb http://nginx.org/packages/mainline/ubuntu/ {{ ansible_distribution_release }} nginx" state=absent
|
||||
tags: nginx
|
||||
|
||||
- name: Add nginx.org stable repo
|
||||
apt_repository: repo="deb http://nginx.org/packages/ubuntu/ {{ ansible_distribution_release }} nginx" state=present
|
||||
- name: Add nginx.org repo
|
||||
template: src=nginx_org_packages_ubuntu.list.j2 dest=/etc/apt/sources.list.d/nginx_org_packages_ubuntu.list owner=root group=root mode=0644
|
||||
tags: nginx
|
||||
|
||||
- name: Install nginx
|
||||
|
5
roles/nginx/templates/nginx_org_packages_ubuntu.list.j2
Normal file
5
roles/nginx/templates/nginx_org_packages_ubuntu.list.j2
Normal file
@ -0,0 +1,5 @@
|
||||
{% if nginx_version == "stable" %}
|
||||
deb http://nginx.org/packages/ubuntu/ {{ ansible_distribution_release }} nginx
|
||||
{% elif nginx_version == "mainline" %}
|
||||
deb http://nginx.org/packages/mainline/ubuntu/ {{ ansible_distribution_release }} nginx
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user