This project contains Ansible playbooks and roles for managing Kubernetes clusters, HashiCorp Vault integration, and Portworx backup operations. It utilizes the purepx collection for interacting with the Portworx backup API.
- Python (>= 3.9, <= 3.14)
- Docker (required as container runtime)
- Ansible Core 2.15 or higher
- Access to Kubernetes cluster
- Access to HashiCorp Vault
- Access to Portworx backup API
- Container Images: Uses either CentOS Stream or Fedora Stream base images
- Container Runtime: Docker (required)
- Execution Environment: Defined in
execution-environment.yml
-
Clone the repository:
git clone <repository-url> cd ansible-playground
-
Install Python dependencies:
python -m pip install -r requirements.txt
-
Install Ansible collections:
ansible-galaxy collection install -r requirements.yml
-
Build the execution environment:
chmod +x build.sh ./build.sh
Ensure your kubeconfig is properly set up with the required credentials and context.
Set up the following environment variables for Vault authentication:
- VAULT_ADDR: Your Vault server address
- VAULT_TOKEN: Your Vault authentication token
The project uses the purepx.px_backup collection to interact with Portworx backup API. Configure the following:
- Set up Portworx backup API credentials in your vault or as environment variables
- Ensure the target cluster is registered with Portworx backup
- Configure cloud credentials if using cloud storage
- Verify your inventory is correct
- Run the desired playbook using FQCN (Fully Qualified Collection Names):
ansible-playbook -i inventory/<inventory-file> <playbook-name>.ymlThe project includes several purepx modules for Portworx backup operations:
purepx.px_backup.cluster: Manage Portworx backup clusterspurepx.px_backup.cloud_credential: Manage cloud credentials
Example usage:
- name: Register cluster with Portworx backup
purepx.px_backup.cluster:
name: "my-cluster"
state: present
# additional parameters...This project uses several tools to maintain code quality:
- black: Code formatting
- flake8: Code linting
- mypy: Type checking
- pytest: Unit testing
Run the following commands before committing:
black .
flake8 .
mypy .
pytestCommon issues and their solutions will be documented here.
- Container runtime must be set to Docker in execution-environment.yml
- When using FQCN, ensure proper collection paths are set in ansible.cfg
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
See the LICENSE file in the root directory.