diff --git a/tasks/main.yml b/tasks/main.yml index 143bfbf..d609aff 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,13 +6,10 @@ - nginx register: nginx_installed -- name: Remove default nginx directory. - tags: nginx - ansible.builtin.file: - path: /etc/nginx - state: absent - register: nginx_config_cleared +- name: Backup default nginx config + command: mv /etc/nginx /etc/nginx.orig when: nginx_installed.changed == true + register: nginx_original_config_backup - name: Clone h5bp nginx config. tags: nginx @@ -21,4 +18,15 @@ dest: /etc/nginx depth: 1 notify: restart nginx - when: nginx_config_cleared.changed == true + when: nginx_original_config_backup.changed == true + +- name: Copy default fastcgi_params back to h5bp nginx config. + command: cp /etc/nginx.orig/fastcgi_params /etc/nginx + when: nginx_original_config_backup.changed == true + +- name: Remove default nginx directory. + tags: nginx + ansible.builtin.file: + path: /etc/nginx.orig + state: absent + when: nginx_original_config_backup.changed == true