Handlers; service => systemd; shell => command
This commit is contained in:
parent
598650db85
commit
a068ca6d6a
|
@ -1,2 +1,11 @@
|
||||||
---
|
---
|
||||||
# handlers file for mastodon
|
# handlers file for etherpad
|
||||||
|
- name: reload nginx
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: nginx
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: restart etherpad
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "{{ service }}.service"
|
||||||
|
state: restarted
|
||||||
|
|
|
@ -58,16 +58,13 @@
|
||||||
src: "etherpad.service.j2"
|
src: "etherpad.service.j2"
|
||||||
dest: "/etc/systemd/system/{{ service }}.service"
|
dest: "/etc/systemd/system/{{ service }}.service"
|
||||||
|
|
||||||
- name: Enable systemd units
|
- name: Enable systemd unit
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ service }}.service"
|
name: "{{ service }}.service"
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
notify:
|
||||||
- name: Start service
|
- restart etherpad
|
||||||
ansible.builtin.service:
|
|
||||||
name: "{{ service }}.service"
|
|
||||||
state: restarted
|
|
||||||
|
|
||||||
- name: Template nginx snippet for Let's Encrypt/Certbot
|
- name: Template nginx snippet for Let's Encrypt/Certbot
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -90,17 +87,18 @@
|
||||||
src: "/etc/nginx/sites-available/{{ service }}.conf"
|
src: "/etc/nginx/sites-available/{{ service }}.conf"
|
||||||
dest: "/etc/nginx/sites-enabled/{{ service }}.conf"
|
dest: "/etc/nginx/sites-enabled/{{ service }}.conf"
|
||||||
state: link
|
state: link
|
||||||
- name: Reload nginx conf
|
notify:
|
||||||
ansible.builtin.service:
|
- reload nginx
|
||||||
name: nginx
|
- name: Flush handlers
|
||||||
state: reloaded
|
ansible.builtin.meta: flush_handlers
|
||||||
- name: Make sure /var/lib/letsencrypt exists and has correct permissions
|
- name: Make sure /var/lib/letsencrypt exists and has correct permissions
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /var/lib/letsencrypt
|
path: /var/lib/letsencrypt
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
- name: Generate certificate with certbot
|
- name: Generate certificate with certbot
|
||||||
ansible.builtin.shell: certbot certonly --webroot --webroot-path /var/lib/letsencrypt --non-interactive --agree-tos --email {{ etherpad_certbot_admin_email }} -d {{ etherpad_domains |first }}
|
ansible.builtin.command:
|
||||||
|
cmd: certbot certonly --webroot --webroot-path /var/lib/letsencrypt --non-interactive --agree-tos --email {{ etherpad_certbot_admin_email }} -d {{ etherpad_domains |first }}
|
||||||
- name: Create the ssl dir if needed
|
- name: Create the ssl dir if needed
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /etc/nginx/ssl
|
path: /etc/nginx/ssl
|
||||||
|
@ -121,14 +119,13 @@
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "vhost.conf.j2"
|
src: "vhost.conf.j2"
|
||||||
dest: "/etc/nginx/sites-available/{{ service }}.conf"
|
dest: "/etc/nginx/sites-available/{{ service }}.conf"
|
||||||
|
notify:
|
||||||
|
- reload nginx
|
||||||
|
|
||||||
- name: Enable nginx vhost for etherpad
|
- name: Enable nginx vhost for etherpad
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: "/etc/nginx/sites-available/{{ service }}.conf"
|
src: "/etc/nginx/sites-available/{{ service }}.conf"
|
||||||
dest: "/etc/nginx/sites-enabled/{{ service }}.conf"
|
dest: "/etc/nginx/sites-enabled/{{ service }}.conf"
|
||||||
state: link
|
state: link
|
||||||
|
notify:
|
||||||
- name: Reload nginx conf
|
- reload nginx
|
||||||
ansible.builtin.service:
|
|
||||||
name: nginx
|
|
||||||
state: reloaded
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
target: "~/{{ service }}.sql.gz"
|
target: "~/{{ service }}.sql.gz"
|
||||||
|
|
||||||
- name: Stop service
|
- name: Stop service
|
||||||
ansible.builtin.service:
|
ansible.builtin.systemd:
|
||||||
name: "{{ service }}.service"
|
name: "{{ service }}.service"
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
become_user: "{{ service }}"
|
become_user: "{{ service }}"
|
||||||
|
|
||||||
- name: Start service
|
- name: Start service
|
||||||
ansible.builtin.service:
|
ansible.builtin.systemd:
|
||||||
name: "{{ service }}.service"
|
name: "{{ service }}.service"
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
|
@ -49,8 +49,4 @@
|
||||||
state: absent
|
state: absent
|
||||||
when: keep_db_dump is undefined
|
when: keep_db_dump is undefined
|
||||||
tags: clean
|
tags: clean
|
||||||
|
notify: reload nginx
|
||||||
- name: Reload nginx conf
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: nginx
|
|
||||||
state: reloaded
|
|
||||||
|
|
Loading…
Reference in a new issue