From 0e3088a642a8fb3d8bcb444cab00044eafb9a78e Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 4 Feb 2021 13:43:08 +0100 Subject: [PATCH] improve nginx installation method --- defaults/main.yml | 4 +++- tasks/installation.yml | 18 +++++++++++------- tasks/main.yml | 14 -------------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6f3cda8..24dcb34 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,4 +24,6 @@ snippet_files: #default_robots_file: 'robots_disallow_all.txt' -nginx__dhparam_size: 2048 +nginx__dhparam_size: 4096 + +nxinx__state: 'present' diff --git a/tasks/installation.yml b/tasks/installation.yml index 642f240..d4dd1e6 100644 --- a/tasks/installation.yml +++ b/tasks/installation.yml @@ -1,11 +1,15 @@ --- +- name: Update apt cache + become: true + apt: + cache_valid_time: 3600 + update_cache: true + when: + - ansible_pkg_mgr == "apt" - name: Install nginx - apt: - package: + become: true + package: + name: - 'nginx' - state: latest - update_cache: yes - cache_valid_time: 43200 - tags: - - installation + state: "{{ nxinx__state }}" diff --git a/tasks/main.yml b/tasks/main.yml index b328ae6..8219933 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,19 +1,9 @@ --- - - name: Install nginx include_tasks: installation.yml - tags: - - repository - - installation - - name: Configure nginx include_tasks: nginx.yml - tags: - - configuration - - nginx - - dhparam - - name: Start nginx webserver service: @@ -24,7 +14,6 @@ - operation - nginx - - name: Configure nginx default site include_tasks: default_site.yml tags: @@ -32,7 +21,6 @@ - nginx - sites - - name: Configure nginx sites include_tasks: single_site.yml with_items: '{{ nginx_sites }}' @@ -43,12 +31,10 @@ - nginx - sites - # Restart nginx before doing acme stuff - name: Flush handlers to restart nginx now meta: flush_handlers - - name: Configure acmetool and obtain certificates include_tasks: acme.yml tags: