From f946b0eaa53f073d916d59efdf3c0483c9baea34 Mon Sep 17 00:00:00 2001 From: ybrun Date: Wed, 12 Apr 2017 10:16:02 +0200 Subject: [PATCH 1/3] Add nginx repo in apt sources --- tasks/main.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index 6c420fe..3508653 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,6 +8,17 @@ nginx_user: "{{ __nginx_user }}" when: nginx_user is not defined +- name: Ensure nginx repository is present + apt_key: + url: 'http://nginx.org/keys/nginx_signing.key' + state: 'present' + apt_repository: + repo: 'deb http://nginx.org/packages/debian/ jessie nginx' + state: present + filename: 'nginx' + update_cache: yes + become: yes + # Setup/install tasks. - include: setup-RedHat.yml when: ansible_os_family == 'RedHat' From 82c21a9c770a2d01568774da940cb7ce80bb586e Mon Sep 17 00:00:00 2001 From: ybrun Date: Wed, 12 Apr 2017 15:07:30 +0200 Subject: [PATCH 2/3] Fix multiple task issue --- tasks/main.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3508653..0c7aa04 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,14 +8,16 @@ nginx_user: "{{ __nginx_user }}" when: nginx_user is not defined -- name: Ensure nginx repository is present +- name: Ensure apt key is present for nginx repository apt_key: - url: 'http://nginx.org/keys/nginx_signing.key' - state: 'present' + url: http://nginx.org/keys/nginx_signing.key + state: present + +- name: Ensure nginx apt repository is present apt_repository: - repo: 'deb http://nginx.org/packages/debian/ jessie nginx' + repo: deb http://nginx.org/packages/debian/ jessie nginx state: present - filename: 'nginx' + filename: nginx update_cache: yes become: yes From bfd169c3868cfc2c802f507598c89f3f755732ec Mon Sep 17 00:00:00 2001 From: ybrun Date: Wed, 12 Apr 2017 15:33:02 +0200 Subject: [PATCH 3/3] Add privilege for apt key task --- tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/main.yml b/tasks/main.yml index 0c7aa04..382b940 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,6 +12,7 @@ apt_key: url: http://nginx.org/keys/nginx_signing.key state: present + become: yes - name: Ensure nginx apt repository is present apt_repository: