{"id":21721468,"url":"https://github.com/informaticsmatters/bandr-ansible","last_synced_at":"2026-04-19T10:34:50.222Z","repository":{"id":80604585,"uuid":"337436058","full_name":"InformaticsMatters/bandr-ansible","owner":"InformaticsMatters","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-26T14:07:48.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-29T03:23:33.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InformaticsMatters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-09T14:45:31.000Z","updated_at":"2025-11-26T15:31:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"880da18e-122f-453b-b52b-ee23a5865429","html_url":"https://github.com/InformaticsMatters/bandr-ansible","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/InformaticsMatters/bandr-ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fbandr-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fbandr-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fbandr-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fbandr-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InformaticsMatters","download_url":"https://codeload.github.com/InformaticsMatters/bandr-ansible/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InformaticsMatters%2Fbandr-ansible/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32004041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-26T02:16:59.789Z","updated_at":"2026-04-19T10:34:50.212Z","avatar_url":"https://github.com/InformaticsMatters.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bandr-ansible\n\n![lint](https://github.com/InformaticsMatters/bandr-ansible/workflows/lint/badge.svg)\n\n![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/informaticsmatters/bandr-ansible)\n\n[![CodeFactor](https://www.codefactor.io/repository/github/informaticsmatters/bandr-ansible/badge)](https://www.codefactor.io/repository/github/informaticsmatters/bandr-ansible)\n\nAWX-compatible Ansible playbooks for the deployment of our backup and recovery\n([bandr]) container images as **CronJobs** (for Backup) and **Jobs**\n(for Recovery) to an existing **Namespace**.\n\nThere are two roles, `backup` and `recovery` and the playbooks assume\na suitable **ServiceAccount** exists in the corresponding  **Namespace**.\n\n\u003e   Refer to the [bandr] repository where you wil find ample documentation in the\n    corresponding `backup.py` and `recovery.py` modules relating to how the backup and\n    recovery containers work and how they are configured.\n\n## Running a CRON-based backup\nIf you have a Postgres database in a Kubernetes **Namespace** you can simplify the\ndeployment of a backup strategy using the `site-backup.yaml` playbook.\n\nAs with most of our Python repositories, create an environment and install the\nrelevant packages, and set your `KUBECONFIG` to an appropriate file for a cluster: -\n\n    python -m venv venv\n    source venv/bin/activate\n    pip install --upgrade pip\n    pip install -r requirements.txt\n\n    export KUBECONFIG=~/k8s-configs/config-local\n\n**A comprehensive example**\n\nIn this example let's setup a comprehensive backup strategy that backs up a\npostgres database every 4 hours, keeping daily backups for a week, weekly backups for a\nmonth and monthly backups for 2 years. This will result in a total of 38 backup files\n(6 hourly + 6 daily + 3 weekly + 23 monthly).\n\nCopy `parameters-cron-backup-template.yaml` and create a `parameters.yaml` file\n(this new file will be ignored from any git commit).\n\nAssuming your database has a **Service** called `database`, and your admin user is\n`postgres`, then the template variables are already setup to provide you with 2\nyear's worth of backups as described; you just need to provide: -\n\n- The **Namespace**\n- The **ServiceAccount**\n- The postgres administrator's password\n- The backup volume size\n\nWith this done, run the playbook: -\n\n    ansible-playbook -e @parameters.yaml site-backup.yaml\n\nThis example will install four **CronJob** objects.\n\n## Running a one-time backup\nFollow the instructions for the `Running a CRON-based backup` but instead\ncopy the parameters-once-template.yaml. Adjust the variables accordingly and then\nrun the playbook: -\n\n    ansible-playbook -e @parameters.yaml site-backup.yaml\n\n## Inspecting backups (in the cluster)\nUsing a parameter file from either a CRON-based or one-time backup,\nyou can use the `site-inspect.yaml` playbook to launch an Ubuntu Pod\nso that you can inspect the backups or use the Pod to copy backups to your\nKubernetes control host.\n\nLaunch an inspection Pod with: -\n\n    ansible-playbook -e @parameters.yaml site-inspect.yaml\n\nWith this done you can sell into the Pod: -\n\n    NAMESPACE=my-namespace\n    kubectl exec -it bandr-inspect bash -n ${NAMESPACE}\n\nOr copy a backup file from it...\n\n    NAMESPACE=my-namespace\n    BACKUP=backup-2023-01-26T12:28:31Z-dumpall.sql.gz\n    kubectl cp ${NAMESPACE}/bandr-inspect:/backup/hourly/${BACKUP} ${PWD}/backup.sql.gz\n\nWhen you're done, use kubectl to delete the Pod.\n\n## Recovery (of a database)\nYou can run the `site-recovery.yaml` playbook to recover data. What you need to do\ndepends on your specific situation but typically you'll need to set suitable\nkubernetes and AWS/S3 variables: -\n\n    export K8S_AUTH_HOST=https://????\n    export K8S_AUTH_API_KEY=????\n    export K8S_AUTH_VERIFY_SSL=false\n\n    export AWS_ACCESS_KEY_ID=????\n    export AWS_SECRET_ACCESS_KEY=????\n\nAnd then run the playbook with your chosen parameters: -\n\n    ansible-playbook -e @parameters.yaml site-recovery.yaml\n\n## Testing\nTo test this repository (Normally done via GitHib Actions)\nwe essentially employ yaml and ansible lint code. From a suitable\nenvironment...\n\n    python -m venv venv\n    source venv/bin/activate\n    pip install --upgrade pip\n    pip install -r requirements.txt\n    pip install -r build-requirements.txt\n\nRun the following: -\n\n    yamllint .\n    find . -type f -name '*.yaml.j2' -exec yamllint {} +\n    ansible-lint\n\n---\n\n[bandr]: https://github.com/InformaticsMatters/bandr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finformaticsmatters%2Fbandr-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finformaticsmatters%2Fbandr-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finformaticsmatters%2Fbandr-ansible/lists"}