diff options
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/enable.yml | 14 | ||||
| -rw-r--r-- | tasks/install.yml | 15 | ||||
| -rw-r--r-- | tasks/main.yml | 23 |
3 files changed, 37 insertions, 15 deletions
diff --git a/tasks/enable.yml b/tasks/enable.yml new file mode 100644 index 0000000..8d9fcd7 --- /dev/null +++ b/tasks/enable.yml @@ -0,0 +1,14 @@ +- name: 'Enable Nginx [Void]' + file: + src: /etc/sv/nginx + dest: /var/service/nginx + owner: root + group: root + state: link + when: ansible_facts['distribution'].lower() == "void" +- name: 'Enable Nginx [Ubuntu]' + systemd: + enabled: yes + daemon_reload: yes + name: nginx + when: ansible_facts['distribution'].lower() == "ubuntu" diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..72787c0 --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,15 @@ +- name: 'Install Nginx [Void}' + xbps: + name: nginx + state: present + when: ansible_facts['distribution'].lower() == "void" +- name: 'Install Nginx [Alpine]' + apk: + name: nginx + state: present + when: ansible_facts['distribution'].lower() == "alpine" +- name: 'Install Nginx [Ubuntu]' + apt: + name: nginx + state: present + when: ansible_facts['distribution'].lower() == "ubuntu" diff --git a/tasks/main.yml b/tasks/main.yml index 23a424b..ab06c87 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,15 +1,8 @@ --- -- name: Install Nginx - xbps: - name: nginx - state: present -- name: Enable Nginx - file: - src: /etc/sv/nginx - dest: /var/service/nginx - owner: root - group: root - state: link +- name: Include install tasks + include_tasks: install.yml +- name: Include enable tasks + include_tasks: enable.yml - name: Lock down and setup configuration directories file: path: '{{item}}' @@ -18,8 +11,8 @@ group: "{{nginx_conf_group}}" mode: "{{nginx_conf_dir_mode}}" loop: - - /etc/nginx - - /etc/nginx/conf.d + - "{{nginx_conf_dir}}" + - "{{nginx_conf_dir}}/conf.d" - name: Create Acme Challenge directory file: path: /var/lib/acme-challenge @@ -30,7 +23,7 @@ - name: Install Main 'nginx.conf' template: src: nginx/nginx.conf - dest: /etc/nginx/nginx.conf + dest: "{{nginx_conf_dir}}/nginx.conf" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" @@ -39,7 +32,7 @@ - name: Install Other Nginx templates template: src: "nginx/{{item}}" - dest: "/etc/nginx/{{item}}" + dest: "{{nginx_conf_dir}}/{{item}}" owner: "{{nginx_conf_owner}}" group: "{{nginx_conf_group}}" mode: "{{nginx_conf_file_mode}}" |
