{"id":13752997,"url":"https://github.com/geerlingguy/ansible-role-backup","last_synced_at":"2025-04-09T23:19:01.221Z","repository":{"id":53211342,"uuid":"82487279","full_name":"geerlingguy/ansible-role-backup","owner":"geerlingguy","description":"Ansible Role - Backup for simple servers","archived":false,"fork":false,"pushed_at":"2024-07-16T19:21:09.000Z","size":43,"stargazers_count":156,"open_issues_count":0,"forks_count":54,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-10T04:06:31.303Z","etag":null,"topics":["ansible","backup","centos","data","debian","disaster-recovery","linux","redhat","role","server","ubuntu"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/geerlingguy/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/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"geerlingguy","patreon":"geerlingguy"}},"created_at":"2017-02-19T20:26:14.000Z","updated_at":"2024-10-09T21:36:25.000Z","dependencies_parsed_at":"2024-01-08T08:00:16.981Z","dependency_job_id":"9809b2cb-ce05-46fe-a42b-2282c3532c0b","html_url":"https://github.com/geerlingguy/ansible-role-backup","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/ansible-role-backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125646,"owners_count":21051778,"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","backup","centos","data","debian","disaster-recovery","linux","redhat","role","server","ubuntu"],"created_at":"2024-08-03T09:01:14.187Z","updated_at":"2025-04-09T23:19:01.191Z","avatar_url":"https://github.com/geerlingguy.png","language":"Shell","funding_links":["https://github.com/sponsors/geerlingguy","https://patreon.com/geerlingguy"],"categories":["Shell","ubuntu"],"sub_categories":[],"readme":"# Ansible Role: Backup for Simple Servers\n\n[![CI](https://github.com/geerlingguy/ansible-role-backup/actions/workflows/ci.yml/badge.svg)](https://github.com/geerlingguy/ansible-role-backup/actions/workflows/ci.yml)\n\nBack up Linux servers with a simple Rsync-and-Cron-based solution.\n\n## Requirements\n\nRequires the following to be installed:\n\n  - rsync\n  - cron\n\nMySQL or a MySQL-compatible database needs to be installed if you'd like to enable MySQL database backups.\n\nIt's also assumed you have a server running somewhere that can accept backup data via Rsync, and on this backup server, you need to install `rsync`, and configure accounts with SSH authentication that allows this role to deliver backups to a specific directory via SSH.\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see `defaults/main.yml`):\n\n    backup_cron_job_state: present\n    backup_hour: \"3\"\n    backup_minute: \"00\"\n\nControls whether the backup script is called via a managed cron job. You should stagger backup times among servers so your backup server doesn't get a huge influx of data at once.\n\n    backup_user: \"{{ ansible_env.SUDO_USER | default(ansible_env.USER, true) | default(ansible_user_id, true) }}\"\n\nUser under which backup jobs will run.\n\n    backup_path: /home/{{ backup_user }}/backups\n\nPath to where backups configuration will be stored. Generally speaking, you should use a special backup user account, but you can set this to whatever account has the proper access to the directories you need to back up.\n\n    backup_directories:\n      - /home/{{ backup_user }}/domains\n      - /home/{{ backup_user }}/repositories\n\nDirectories to back up. `{{ backup_user }}` must have read access to these dirs. Each directory will be synchronized to the backup server via a separate `rsync` command in the backup script.\n\n    backup_exclude_items:\n      - .DS_Store\n      - cache\n      - tmp\n\nItems to exclude from backups. Each item will be added as a new line in an excludes file used by the backup `rsync` command. Read [this article](http://articles.slicehost.com/2007/10/10/rsync-exclude-files-and-folders) for an explanation of how the `--exclude` option works.\n\n    backup_identifier: id_here\n    backup_remote_connection: user@backup.example.com\n\nOptions to control where the backup is delivered. It's assumed you'll be routing backups to a backup server via SSH. SSH key management and authentication should be managed separately from this role.\n\n    backup_remote_base_path: \"~/backups\"\n\nThe full path on the remote backup server where backups will be stored (all backups for each server are inside a directory named by the `backup_identifier`).\n\n    backup_remote_host_name: ''\n    backup_remote_host_key: ''\n\nAdd the remote host key details to ensure the host key is present and there are no SSH connection errors based on the key authentication. Leave blank if you've disabled host key checking or if the host key is already added to the server via some other mechanism.\n\n    backup_remote_connection_ssh_options: ''\n\nAdd SSH connection options (e.g. `-p [port]`), as documented in the [SSH command manual](http://man.openbsd.org/ssh).\n\n    backup_mysql: false\n    backup_mysql_user: dbdump\n    backup_mysql_password: password\n    backup_mysql_credential_file: ''\n\nOptions for backing up MySQL (or MySQL-compatible) databases. Note the `ansible_ssh_user` used when running this role must be able to add MySQL users for this functionality to be managed by this role.\nInstead of creating a new MySQL user account you can provide an existing one using `backup_mysql_credential_file` an option file as documented in the [End-User Guidelines for Password Security](https://dev.mysql.com/doc/refman/5.7/en/password-security-user.html).\n\n## Dependencies\n\nNone.\n\n## Example Playbook\n\n    - hosts: servers\n    \n      vars:\n        backup_identifier: \"{{ inventory_hostname|replace('.', '') }}\"\n        backup_user: \"backupuser\"\n        backup_remote_connection: user@backups.example.com\n        backup_hour: \"1\"\n        backup_minute: \"15\"\n        backup_mysql: false\n        backup_directories:\n          - /etc/myapp\n          - /var/myapp/data\n          - /home/myuser\n    \n      roles:\n        - geerlingguy.backup\n\n## License\n\nMIT / BSD\n\n## Author Information\n\nThis role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Fansible-role-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-backup/lists"}