diff --git a/roles/nginx/defaults/main.yml b/roles/nginx/defaults/main.yml index 1104f14..df3863f 100644 --- a/roles/nginx/defaults/main.yml +++ b/roles/nginx/defaults/main.yml @@ -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: diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 44d416b..6332085 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -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 diff --git a/roles/nginx/templates/nginx_org_packages_ubuntu.list.j2 b/roles/nginx/templates/nginx_org_packages_ubuntu.list.j2 new file mode 100644 index 0000000..76b3159 --- /dev/null +++ b/roles/nginx/templates/nginx_org_packages_ubuntu.list.j2 @@ -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 %}