commit 676eb4c7c51355ffd0630fbf18d049432833d1ca Author: Patrick Neff Date: Mon Jan 24 19:04:09 2022 +0100 initial commit diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..9eb6341 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,9 @@ +- name: reload nginx + ansible.builtin.service: + name: nginx + state: reloaded + +- name: restart nginx + ansible.builtin.service: + name: nginx + state: restarted diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..0a3875f --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,4 @@ +galaxy_info: + role_name: nginx + +dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..143bfbf --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,24 @@ +- name: Install packages. + tags: nginx + ansible.builtin.package: + state: present + name: + - nginx + register: nginx_installed + +- name: Remove default nginx directory. + tags: nginx + ansible.builtin.file: + path: /etc/nginx + state: absent + register: nginx_config_cleared + when: nginx_installed.changed == true + +- name: Clone h5bp nginx config. + tags: nginx + ansible.builtin.git: + repo: https://github.com/h5bp/server-configs-nginx + dest: /etc/nginx + depth: 1 + notify: restart nginx + when: nginx_config_cleared.changed == true