ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
---

- name: "[OpenRC] Restart service: acme-redirect (to deploy config changes)"
  service:
    name: acme-redirect
    state: restarted
  when:
    - ansible_service_mgr == "openrc"
  listen: "Restart acme-redirect"

- name: "[systemd] Restart service: acme-redirect (to deploy config changes)"
  systemd:
    name: acme-redirect
    state: restarted
  when:
    - ansible_service_mgr == "systemd"
  listen: "Restart acme-redirect"

- name: "Check that all defined domains are pointing to this server"
  command:
    cmd: acme-redirect check -q
  register: acme_check
  become: yes
  become_user: acme-redirect
  listen: "Restart acme-redirect"

- fail:
    msg: "Check of domains failed: {{acme_check.stdout}}"
  when:
    - acme_check.stdout | length > 0
  listen: "Restart acme-redirect"

- name: "Renew(or create) certs"
  command:
    cmd: acme-redirect renew -q
  register: acme_renew
  become: yes
  become_user: acme-redirect
  listen: "Restart acme-redirect"

- fail:
    msg: "Renew of certs failed: {{acme_renew.stdout}}"
  when:
    - acme_renew.stdout | length > 0
  listen: "Restart acme-redirect"