init backup CR files

This commit is contained in:
Christian M. Adams
2021-03-23 15:33:03 -04:00
parent fdcc745f11
commit bcd1410438
9 changed files with 315 additions and 19 deletions

81
roles/backup/README.md Normal file
View File

@@ -0,0 +1,81 @@
Role Name
=========
The purpose of this role is to create a backup of your AWX deployment. This includes:
- backup of the postgresql database
- secret_key
- custom user config files
- manual projects
Requirements
------------
This role assumes you are authenticated with an Openshift or Kubernetes cluster which:
- The awx-operator has been deployed to
- AWX is deployed to via the operator
Usage
----------------
Then create a file named `backup-awx.yml` with the following contents:
```yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: Backup
metadata:
name: awx
namespace: my-namespace
```
Finally, use `kubectl` to create the awx instance in your cluster:
```bash
#> kubectl apply -f backup-awx.yml
```
Role Variables
--------------
A custom, pre-created pvc can be used by setting the following variables.
```
tower_backup_pvc: 'awx-backup-volume-claim'
```
This role will automatically create a pvc using a Storage Class if provided:
```
tower_postgres_storage_class: 'standard'
tower_backup_size: '20Gi'
```
If a custom postgres configuration secret was used when deploying AWX, it must be set:
```
tower_postgres_configuration_secret: 'awx-postgres-configuration'
```
Testing
----------------
You can test this role directly by creating and running the following playbook with the appropriate variables:
```
---
- name: Backup Tower
hosts: localhost
gather_facts: false
roles:
- backup
```
License
-------
MIT

View File

@@ -1,18 +1,3 @@
---
deployment_type: "{{ meta.name | default('awx', true)}}"
# Secret to lookup that provide the secret key
#
tower_secret_key_secret: ''
tower_postgres_storage_class: ''
tower_postgres_data_path: '/var/lib/postgresql/data/pgdata'
# Secret to lookup that provide the PostgreSQL configuration
#
tower_postgres_configuration_secret: ''
tower_old_postgres_configuration_secret: ''
tower_postgres_image: postgres:12
tower_backup_pvc: ''
tower_backup_size: ''

View File

@@ -0,0 +1,30 @@
---
galaxy_info:
author: Ansible
description: AWX role for AWX Operator for Kubernetes.
company: Red Hat, Inc.
license: MIT
min_ansible_version: 2.8
platforms:
- name: EL
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- tower
- awx
- ansible
- backup
- automation
dependencies: []
collections:
- community.kubernetes
- operator_sdk.util

View File

@@ -7,7 +7,7 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
storageClassName: {{ tower_postgres_storage_class }}
resources:
requests:
storage: {{ tower_backup_size | default('5Gi', true) }}

View File

@@ -0,0 +1,13 @@
---
# Specify a pre-created PVC (name) to backup to
tower_backup_pvc: ''
# Size of backup PVC if created dynamically
tower_backup_size: ''
# Specify storage class to determine how to dynamically create PVC's with
tower_postgres_storage_class: ''
# Secret to lookup that provide the PostgreSQL configuration
tower_postgres_configuration_secret: ''