--- - name: Create directory for helper scripts file: path: "{{ global_helper_directory }}" state: directory owner: root group: root mode: "u=rwx,g=rx,o=rx" tags: - backups - name: Upload helper scripts copy: src: "{{ item }}" dest: "{{ global_helper_directory }}/{{ item }}" owner: root group: root mode: "u=rwx,g=rx,o=rx" validate: "{{ global_validate_shell_script }}" loop: - backup_rename.sh - gpg_import_url_key.sh tags: - backups - name: Build and upload template helper scripts template: src: "{{ item }}" dest: "{{ global_helper_directory }}/{{ item }}" owner: root group: root mode: "u=rwx,g=rx,o=rx" validate: "{{ global_validate_shell_script }}" loop: - backup_autoremove.sh - backup_files.sh - backup_mysql_database.sh - nsupdate_keygen.sh tags: - backups - name: Configure auto remove older backups cron: hour: 0 minute: 30 job: "{{ global_helper_directory }}/backup_autoremove.sh" name: "Auto remove older backups" state: present tags: - backups