hcp-ansible/playbooks/deploy.yml
Bertrand Lanson 7f8d8654a4
All checks were successful
development / Check commit compliance (push) Successful in 6s
feat(deployment): Implement new structure for deploying components
This allows operators to target specific groups when deploying using the --tags flag of ansible. You can, for now, target consul, consul_servers, consul_agents, nomad, nomad_servers, nomad_clients, vault and haproxy
2024-07-14 16:15:21 +02:00

55 lines
1.3 KiB
YAML

---
# hashistack deployment playbook
- name: "Deploy"
hosts: "{{ target | default('all, !deployment') }}"
strategy: linear
gather_facts: true
any_errors_fatal: true
become: true
tasks:
- name: "Import variables"
ansible.builtin.import_tasks:
file: tasks/load_vars.yml
tags:
- always
# Consul nodes deployment
- name: "Deploy Consul"
tags:
- consul
when:
- enable_consul | bool
ansible.builtin.import_tasks:
file: tasks/consul/consul_deploy.yml
# Haproxy nodes deployment
- name: "Deploy Proxies"
tags:
- haproxy
when:
- enable_haproxy | bool
block:
- name: "Deploy Haproxy & Keepalived"
ansible.builtin.import_tasks:
file: tasks/haproxy/haproxy_deploy.yml
when:
- "'haproxy_servers' in group_names"
# Vault nodes deployment
- name: "Deploy Vault"
tags:
- vault
when:
- enable_vault | bool
ansible.builtin.import_tasks:
file: tasks/vault/vault_deploy.yml
# Nomad nodes deployment
- name: "Deploy Nomad"
tags:
- nomad
when:
- enable_nomad | bool
ansible.builtin.import_tasks:
file: tasks/nomad/nomad_deploy.yml