{"id":18367827,"url":"https://github.com/gantsign/ansible_role_backup","last_synced_at":"2026-02-06T11:09:08.220Z","repository":{"id":39652396,"uuid":"145280182","full_name":"gantsign/ansible_role_backup","owner":"gantsign","description":"Ansible role for backing up and restoring files and directories","archived":false,"fork":false,"pushed_at":"2022-08-03T21:48:15.000Z","size":54,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T03:51:14.340Z","etag":null,"topics":["ansible","ansible-role","backup"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/gantsign/backup","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gantsign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-19T06:49:39.000Z","updated_at":"2022-06-18T02:00:36.000Z","dependencies_parsed_at":"2022-08-09T15:08:49.032Z","dependency_job_id":null,"html_url":"https://github.com/gantsign/ansible_role_backup","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible_role_backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible_role_backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible_role_backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gantsign%2Fansible_role_backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gantsign","download_url":"https://codeload.github.com/gantsign/ansible_role_backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522297,"owners_count":20952518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","backup"],"created_at":"2024-11-05T23:23:37.903Z","updated_at":"2026-02-06T11:09:08.183Z","avatar_url":"https://github.com/gantsign.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ansible Role: Backup\n====================\n\n[![Tests](https://github.com/gantsign/ansible_role_backup/workflows/Tests/badge.svg)](https://github.com/gantsign/ansible_role_backup/actions?query=workflow%3ATests)\n[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-gantsign.backup-blue.svg)](https://galaxy.ansible.com/gantsign/backup)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gantsign/ansible_role_backup/master/LICENSE)\n\nRole to backup and restore files and directories. Uses\n[rsync](https://rsync.samba.org/) but intended to be used with a locally\nmounted backup drive.\n\nDuring provisioning this role will restore any previously backed-up files and\ndirectories. Once restarted the OS will perform incremental backups every 5\nminutes and during shutdown.\n\nThe backup is a simple mirror of the source directory, previous file versions\nare discarded. The main purpose is to persist files between rebuilds of your\nlocal development VM. If you can't afford to lose/replace your files, use a\nremote backup solution with versioning instead.\n\nThis role is primarily indented for backing-up and restoring the contents of a\nusers home directory.\n\nRequirements\n------------\n\n* Ansible \u003e= 2.9\n\n* Linux Distribution\n\n    * Debian Family\n\n        * Ubuntu\n\n            * Bionic (18.04)\n            * Focal (20.04)\n\n    * Note: other versions are likely to work but have not been tested.\n\nRole Variables\n--------------\n\nThe following variables will change the behavior of this role:\n\n```yaml\n# The frequency to perform the backup\nbackup_frequency_minutes: 5\n\n# User who owns the files to backup/restore\nbackup_user: # Required\n\n# The source directory containing the files to backup (must end with a /)\nbackup_src:  # Required\n\n# The destination directory to backup the files to (must end with a /)\nbackup_dest: # Required\n\n# The rsync filter of files/directories to include/exclude\nbackup_filter: |\n  !\n  # Include everything\n  + /*\n\n# Directory for backup scripts\nbackup_script_dir: '~/.backup'\n\n# The name to use for cron\nbackup_cron_name: backup\n\n# The name to use for systemd service\nbackup_service_name: backup\n```\n\nExample Playbooks\n-----------------\n\nHere's a simple example playbook:\n\n\n```yaml\n- hosts: servers\n  roles:\n    - role: gantsign.backup\n      backup_user: example_username\n      backup_src: /home/example_username/\n      backup_dest: /mnt/backup/example_username/\n      backup_filter: |\n        # Reset filter\n        !\n        # Include file / directory\n        + /include_me\n        # Include subdirectory (only needed of you're going to exclude other sub-directories)\n        + /include_me/me_as_well\n        # Exclude everything but me_as_well\n        - /include_me/*\n        # Exclude by file/directory name\n        - tmp\n        # Exclude everything else\n        - /*\n```\n\nHere's a real world example playbook:\n\n```yaml\n- hosts: servers\n  roles:\n    - role: gantsign.backup\n      backup_user: vagrant\n      backup_src: /home/vagrant/\n      backup_dest: /var/persistent/home/vagrant/\n      backup_filter: |\n        !\n        + /.atom\n        + /.atom\n        + /.atom/config.cson\n        - /.atom/*\n        + /.bash_history\n        + /.config\n        + /.config/Code\n        + /.config/Code/User\n        + /.config/Code/User/settings.json\n        - /.config/Code/User/*\n        - /.config/Code/*\n        - /.config/*\n        + /.gitconfig\n        + /.gnupg\n        + /.m2\n        - /.m2/repository\n        - /.m2/wrapper\n        + /.ssh\n        - /.ssh/authorized_keys\n        + /workspace\n        + /.zsh_history\n        - target/*\n        - build/*\n        - node_modules\n        - /*\n```\n\n\nMore Roles From GantSign\n------------------------\n\nYou can find more roles from GantSign on\n[Ansible Galaxy](https://galaxy.ansible.com/gantsign).\n\nDevelopment \u0026 Testing\n---------------------\n\nThis project uses [Molecule](http://molecule.readthedocs.io/) to aid in the\ndevelopment and testing; the role is unit tested using\n[Testinfra](http://testinfra.readthedocs.io/) and\n[pytest](http://docs.pytest.org/).\n\nTo develop or test you'll need to have installed the following:\n\n* Linux (e.g. [Ubuntu](http://www.ubuntu.com/))\n* [Docker](https://www.docker.com/)\n* [Python](https://www.python.org/) (including python-pip)\n* [Ansible](https://www.ansible.com/)\n* [Molecule](http://molecule.readthedocs.io/)\n\nBecause the above can be tricky to install, this project includes\n[Molecule Wrapper](https://github.com/gantsign/molecule-wrapper). Molecule\nWrapper is a shell script that installs Molecule and it's dependencies (apart\nfrom Linux) and then executes Molecule with the command you pass it.\n\nTo test this role using Molecule Wrapper run the following command from the\nproject root:\n\n```bash\n./moleculew test\n```\n\nNote: some of the dependencies need `sudo` permission to install.\n\nLicense\n-------\n\nMIT\n\nAuthor Information\n------------------\n\nJohn Freeman\n\nGantSign Ltd.\nCompany No. 06109112 (registered in England)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgantsign%2Fansible_role_backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgantsign%2Fansible_role_backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgantsign%2Fansible_role_backup/lists"}