]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/dehydrated/tasks/main.yml
d6d7ed815ac28cc8cefe2263bf4e0571718cfbef
[ansible.git] / playbooks / debian / roles / dehydrated / tasks / main.yml
1 - name: Test if dehydrated is already cloned
2   local_action:
3     module: stat
4     path: /usr/local/src/LetsEncrypt/dehydrated/.git/config
5   register: dehydrated
6   changed_when: not dehydrated.stat.exists
7
8 - block:
9     - name: Install git
10       become: true
11       local_action:
12         module: apt
13         autoclean: yes
14         autoremove: yes
15         cache_valid_time: 3600
16         install_recommends: no
17         name: git
18         state: latest
19         update_cache: yes
20
21     - name: Prepare to clone dehydrated
22       local_action:
23         module: file
24         path: /usr/local/src/LetsEncrypt
25         state: directory
26
27     - name: Clone dehydrated
28       local_action:
29         module: git
30         repo: https://github.com/lukas2511/dehydrated.git
31         dest: /usr/local/src/LetsEncrypt/dehydrated
32   when: not dehydrated.stat.exists
33
34 - name: Prepare the server to synchronize dehydrated
35   become: true
36   file:
37     path: /usr/local/src/LetsEncrypt
38     state: directory
39     owner: root
40     group: staff
41     mode: "ug+rwx,o+rx,g+s"
42
43 - name: Synchronize dehydrated to the server
44   synchronize:
45     src: /usr/local/src/LetsEncrypt/dehydrated
46     dest: /usr/local/src/LetsEncrypt
47
48 - name: Configure dehydrated weekly run
49   become: true
50   copy:
51     src: dehydrated
52     dest: /etc/cron.weekly
53     owner: root
54     group: root
55     mode: '0700'