2023-09-01 15:42:19 -04:00
|
|
|
---
|
2023-09-01 15:42:19 -04:00
|
|
|
|
2023-09-01 15:42:28 -04:00
|
|
|
# Set this_node fact
|
2023-09-01 15:42:21 -04:00
|
|
|
- set_fact:
|
2023-09-01 15:42:28 -04:00
|
|
|
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 %}"
|
2023-09-01 15:42:21 -04:00
|
|
|
tags: always
|
|
|
|
|
2023-09-01 15:42:19 -04:00
|
|
|
# First-run check
|
|
|
|
- name: check if this is a new instance
|
2023-09-01 15:42:20 -04:00
|
|
|
shell: "echo 'bootstrapped' > /etc/pvc-install.pvc"
|
2023-09-01 15:42:19 -04:00
|
|
|
args:
|
2023-09-01 15:42:20 -04:00
|
|
|
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
|
|
|
|
2023-09-01 15:42:27 -04:00
|
|
|
# Install system tweaks
|
|
|
|
- include: system/main.yml
|
|
|
|
tags: pvc-system
|
2023-09-01 15:42:21 -04:00
|
|
|
|
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
|
2023-09-01 15:42:21 -04:00
|
|
|
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
|
2023-09-01 15:42:21 -04:00
|
|
|
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
|
2023-09-01 15:42:21 -04:00
|
|
|
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
|
|
|
|
|
2023-09-01 15:42:20 -04:00
|
|
|
# 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
|
2023-09-01 15:42:20 -04:00
|
|
|
|
2023-09-01 15:42:29 -04:00
|
|
|
# Install CPU tuning
|
|
|
|
- include: cputuning/main.yml
|
|
|
|
tags: pvc-cputuning
|
2023-09-01 15:42:29 -04:00
|
|
|
when: debian_version|int >= 11 and cpu_tuning is defined
|
2023-09-01 15:42:29 -04:00
|
|
|
|
2023-09-01 15:42:30 -04:00
|
|
|
- block:
|
|
|
|
- name: restart server on first install
|
|
|
|
reboot:
|
|
|
|
post_reboot_delay: 30
|
|
|
|
reboot_timeout: 1800
|
2023-09-01 15:42:30 -04:00
|
|
|
|
2023-09-01 15:42:30 -04:00
|
|
|
- name: wait 90 seconds for system to stabilize
|
|
|
|
pause:
|
|
|
|
seconds: 90
|
|
|
|
become: no
|
|
|
|
connection: local
|
2023-09-01 15:42:30 -04:00
|
|
|
|
2023-09-01 15:42:30 -04:00
|
|
|
- name: restart pvcnoded on first install
|
|
|
|
service:
|
|
|
|
name: pvcnoded
|
|
|
|
state: restarted
|
|
|
|
throttle: 1
|
|
|
|
ignore_errors: yes
|
2023-09-01 15:42:30 -04:00
|
|
|
|
2023-09-01 15:42:30 -04:00
|
|
|
- name: wait 30 seconds for system to stabilize
|
|
|
|
pause:
|
|
|
|
seconds: 30
|
|
|
|
become: no
|
|
|
|
connection: local
|
2023-09-01 15:42:30 -04:00
|
|
|
|
2023-09-01 15:42:30 -04:00
|
|
|
- name: set first node as primary coordinator on first install
|
2023-09-01 15:42:30 -04:00
|
|
|
command: "pvc node primary --wait {{ ansible_play_hosts[0].split('.')[0] }}"
|
2023-09-01 15:42:30 -04:00
|
|
|
run_once: yes
|
2023-09-01 15:42:30 -04:00
|
|
|
delegate_to: "{{ ansible_play_hosts[0] }}"
|
2023-09-01 15:42:30 -04:00
|
|
|
|
|
|
|
when: newhost is defined and newhost
|
|
|
|
tags: always
|