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 
---

- name: create password file(s) for rest-server
  copy:
    content: "{{ lookup('community.general.passwordstore', 'Server/{{item}}/rest-server.plain returnall=true')}}"
    dest:    "/var/lib/restic-password-{{item}}"
    mode:    0700
    owner:   root
    group:   root
  loop:
    - desastro
    - lollo

- name: create password files for services
  copy:
    content: "{{ lookup('community.general.passwordstore', 'Server/{{system.hostname}}/restic/{{item}} returnall=true')}}"
    dest:    "/var/lib/{{item}}/restic-password"
    owner:   "{{item}}"
    group:   "{{item}}"
    mode:    0700
  loop:
    - synapse

- name: create password file for postgresql
  copy:
    content: "{{ lookup('community.general.passwordstore', 'Server/{{system.hostname}}/restic/postgresql returnall=true')}}"
    dest:    /var/lib/postgresql/restic-password
    owner:   postgres
    group:   postgres
    mode:    0700

- name: Copy backup-script to server
  copy:
    src: scripts/restic-backup/{{system.hostname}}.sh
    dest: /root/restic-backup.sh
    mode: 0755

- name: create crontab entry
  cron:
    name: "run restic-backups"
    special_time: daily
    user: root
    job: "/root/restic-backup.sh > /dev/null"
    state: present