From 676eb4c7c51355ffd0630fbf18d049432833d1ca Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Mon, 24 Jan 2022 19:04:09 +0100 Subject: [PATCH] initial commit --- handlers/main.yml | 9 +++++++++ meta/main.yml | 4 ++++ tasks/main.yml | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml 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