34 lines
731 B
Markdown
34 lines
731 B
Markdown
# Ansible Playbook Example
|
|
|
|
Setup roles
|
|
|
|
```
|
|
ansible-galaxy install -f -r galaxy-roles/requirements.yml
|
|
```
|
|
|
|
Create a cluster, this assumes you have real machines in the inventory.
|
|
|
|
```
|
|
ansible-playbook -i hosts deploy.yml --tags=k8s --limit=k8s_cluster
|
|
```
|
|
|
|
|
|
Deploy a specific role, you must have a local context activated, all tasks run locally using existing credentials.
|
|
|
|
```
|
|
ansible-playbook -i hosts deploy.yml --tags=redis
|
|
```
|
|
|
|
Select aspects of the k8s roles can be targed via tag
|
|
|
|
```
|
|
ansible-playbook -i hosts deploy.yml --tags=redis-env
|
|
ansible-playbook -i hosts deploy.yml --tags=redis-deploy
|
|
```
|
|
|
|
Deployments can be removed
|
|
|
|
```
|
|
ansible-playbook -i hosts deploy.yml --tags=redis --extra-vars "redis_state=absent"
|
|
```
|