pvc-ansible/roles/pvc/tasks/main.yml

72 lines
1.5 KiB
YAML
Raw Normal View History

2023-09-01 15:42:19 -04:00
---
2023-09-01 15:42:19 -04:00
# Set this_node fact
- set_fact:
this_node: "{{ inventory_hostname.split('.')[0] }}"
tags: always
# Set coordinator state fact
- set_fact:
is_coordinator: "{% for node in pvc_nodes if node.hostname == this_node %}{{ node.is_coordinator }}{% endfor %}"
tags: always
2023-09-01 15:42:19 -04:00
# First-run check
- name: check if this is a new instance
shell: "echo 'bootstrapped' > /etc/pvc-install.pvc"
2023-09-01 15:42:19 -04:00
args:
creates: /etc/pvc-install.pvc
2023-09-01 15:42:19 -04:00
register: newhost_check
2023-09-01 15:42:19 -04:00
tags: always
2023-09-01 15:42:19 -04:00
- name: set newhost fact
set_fact:
newhost: yes
when: newhost_check.changed
2023-09-01 15:42:19 -04:00
tags: always
2023-09-01 15:42:19 -04:00
- include: common/add_cluster_ips.yml
when: newhost is defined and newhost
2023-09-01 15:42:19 -04:00
tags: always
2023-09-01 15:42:19 -04:00
# Install system tweaks
- include: system/main.yml
tags: pvc-system
2023-09-01 15:42:21 -04:00
# Install base databases (coordinators only)
2023-09-01 15:42:19 -04:00
- include: ceph/main.yml
2023-09-01 15:42:19 -04:00
tags: pvc-ceph
when: is_coordinator
2023-09-01 15:42:19 -04:00
2023-09-01 15:42:19 -04:00
- include: zookeeper/main.yml
2023-09-01 15:42:19 -04:00
tags: pvc-zookeeper
when: is_coordinator
2023-09-01 15:42:19 -04:00
2023-09-01 15:42:19 -04:00
- include: patroni/main.yml
tags: pvc-patroni
when: is_coordinator
2023-09-01 15:42:19 -04:00
2023-09-01 15:42:19 -04:00
# Install core services
- include: libvirt/main.yml
2023-09-01 15:42:19 -04:00
tags: pvc-libvirt
2023-09-01 15:42:19 -04:00
- include: frr/main.yml
2023-09-01 15:42:19 -04:00
tags: pvc-frr
# Install PVC daemon
2023-09-01 15:42:19 -04:00
- include: pvc/main.yml
2023-09-01 15:42:19 -04:00
tags: pvc-daemon
# Install CPU tuning
- include: cputuning/main.yml
tags: pvc-cputuning
when: cpu_tuning is defined
- name: restart server on first install
shell: 'sleep 3 && shutdown -r now "Ansible updates triggered"'
async: 1
poll: 0
ignore_errors: yes
become: yes
when: newhost is defined and newhost
tags: always