diff --git a/host_vars/cameron.adm.crans.org b/host_vars/cameron.adm.crans.org index f68e04f9f23f910d7ecee2728671e244a11abac5..82ca172c7f328a099b74f205bb2c4e1b71422efa 100644 --- a/host_vars/cameron.adm.crans.org +++ b/host_vars/cameron.adm.crans.org @@ -3,3 +3,43 @@ loc_borg: to_exclude: - /var/mail - /var/lib/lxcfs + +loc_service_home: + name: home + install_dir: /var/local/services/home + cron: + frequency: "* * * * *" + dependencies: + - python3-jinja2 + - python3-ldap + git: + remote: https://gitlab.adm.crans.org/nounous/home.git + version: master + config: + ldap_server: ldap://re2o-ldap.adm.crans.org + binddn: cn=home,ou=service-users,dc=crans,dc=org + password: "{{ vault.ldap_home_password }}" + rootdn: cn=Utilisateurs,dc=crans,dc=org + home_dir: /pool/home + mail_dir: /pool/mail + home_quota: /usr/sbin/zfs set userquota@{user}=30G pool/home + mail_quota: /usr/sbin/zfs set userquota@{user}=10G pool/mail + +loc_service_backup: + name: backup + install_dir: /var/local/services/backup + cron: + frequency: "0 0 * * *" + dependencies: + - python3-jinja2 + - python3-ldap + generated: yes + git: + remote: https://gitlab.adm.crans.org/nounous/backup.git + version: master + config: + binddn: cn=home,ou=service-users,dc=crans,dc=org + password: "{{ vault.ldap_home_password }}" + rootdn: cn=Utilisateurs,dc=crans,dc=org + ldap_server: ldap://re2o-ldap.adm.crans.org + borg_key: "{{ vault.borgbackup_passwd }}" diff --git a/plays/home.yml b/plays/home.yml index 866016c6b34a20d7c2c477764bf4c1d926533b59..6af8f2200213e8c298f132d739598469fd534662 100755 --- a/plays/home.yml +++ b/plays/home.yml @@ -2,11 +2,12 @@ --- - hosts: cameron.adm.crans.org vars: - home: - ldap_server: ldap://re2o-ldap.adm.crans.org - ldap_password: "{{ vault.ldap_home_password }}" - binddn: cn=home,ou=service-users,dc=crans,dc=org - rootdn: cn=Utilisateurs,dc=crans,dc=org - borg_key: "{{ vault.borgbackup_passwd }}" + service: "{{ glob_service_home | default({}) | combine(loc_service_home | default({})) }}" roles: - - home + - service + +- hosts: cameron.adm.crans.org + vars: + service: "{{ glob_service_backup | default({}) | combine(loc_service_backup | default({})) }}" + roles: + - service diff --git a/roles/home/tasks/main.yml b/roles/home/tasks/main.yml deleted file mode 100644 index 21f192c067259357fb751a12a8bbfd91d3f96161..0000000000000000000000000000000000000000 --- a/roles/home/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: Install home dependencies - apt: - update_cache: true - install_recommends: false - name: - - python3-jinja2 - - python3-ldap - register: apt_result - retries: 3 - until: apt_result is succeeded - -- name: Create home directory - file: - path: /var/local/home - state: directory - mode: '2775' - owner: root - group: _nounou - -- name: Set ACL for home directory - acl: - path: /var/local/home - default: true - entity: _nounou - etype: group - permissions: rwx - state: query - -- name: Clone home repository - git: - repo: 'http://gitlab.adm.crans.org/nounous/home.git' - dest: /var/local/home - umask: '002' - -- name: Deploy home config - template: - src: home/home.json.j2 - dest: /var/local/home/home.json - mode: 0600 - owner: root - group: root - -- name: Deploy cron for home - template: - src: cron.d/home.j2 - dest: /etc/cron.d/home diff --git a/roles/home/templates/cron.d/home.j2 b/roles/home/templates/cron.d/home.j2 deleted file mode 100644 index b64d9a8790f527e3ede8c13a902c38d304828b7a..0000000000000000000000000000000000000000 --- a/roles/home/templates/cron.d/home.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{{ ansible_header | comment }} -* * * * * root /usr/bin/python3 /var/local/home/home.py diff --git a/roles/home/templates/home/home.json.j2 b/roles/home/templates/home/home.json.j2 deleted file mode 100644 index ada269e1d98ddf57de8e073cb235368a436aa61f..0000000000000000000000000000000000000000 --- a/roles/home/templates/home/home.json.j2 +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ldap_server": "{{ home.ldap_server }}" - "binddn": "{{ home.binddn }}" - "password": "{{ home.ldap_password }}" - "rootdn": "{{ home.rootdn }}" - "home_dir": "/pool/home" - "mail_dir": "/pool/mail" - "home_quota": "/usr/sbin/zfs set userquota@{user}=30G pool/home" - "mail_quota": "/usr/sbin/zfs set userquota@{user}=10G pool/mail" - "borg_key": "{{ home.borg_key }}" -}