Move some other tasks to bootstrap role

Avoids an issue where the pvcnoded service is stopped on non-bootstrap
runs.
This commit is contained in:
Joshua Boniface 2023-09-01 15:42:25 -04:00
parent e53342474c
commit 027a819a83
3 changed files with 42 additions and 20 deletions

View File

@ -44,3 +44,8 @@
shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} &&{% endif %} systemctl restart pvcnoded.service" shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} &&{% endif %} systemctl restart pvcnoded.service"
ignore_errors: true ignore_errors: true
when: bootstrap is not defined when: bootstrap is not defined
- name: restart pvcapid
shell: "{% if is_coordinator %}sleep {{ 15 * (hostvars[inventory_hostname].ansible_local.host_id|int - 1) }} &&{% endif %} systemctl restart pvcapid.service"
ignore_errors: true
when: bootstrap is not defined

View File

@ -30,3 +30,22 @@
- name: remove floating IP address to upstream interface - name: remove floating IP address to upstream interface
command: ip address delete {{ pvc_upstream_floatingip }}/{{ pvc_upstream_netmask }} dev {{ pvc_upstream_device }} command: ip address delete {{ pvc_upstream_floatingip }}/{{ pvc_upstream_netmask }} dev {{ pvc_upstream_device }}
ignore_errors: yes ignore_errors: yes
- name: stop and disable unneccessary services
service:
name: "{{item }}"
state: stopped
enabled: no
with_items:
- pdns.service
- dnsmasq.service
- name: ensure services are enabled but stopped pending reboot
service:
name: "{{ item }}"
state: stopped
enabled: yes
with_items:
- pvc-flush.service
- pvcnoded.service
- pvc.target

View File

@ -11,7 +11,7 @@
- jq - jq
state: latest state: latest
- name: install pvc configurations - name: install pvc node daemon configuration
template: template:
src: pvc/{{ item }}.j2 src: pvc/{{ item }}.j2
dest: /etc/pvc/{{ item }} dest: /etc/pvc/{{ item }}
@ -19,6 +19,14 @@
- restart pvcnoded - restart pvcnoded
with_items: with_items:
- pvcnoded.yaml - pvcnoded.yaml
- name: install pvc api daemon configuration
template:
src: pvc/{{ item }}.j2
dest: /etc/pvc/{{ item }}
notify:
- restart pvcapid
with_items:
- pvcapid.yaml - pvcapid.yaml
- name: install API SSL certificate file - name: install API SSL certificate file
@ -37,29 +45,10 @@
no_log: True no_log: True
when: pvc_api_enable_ssl and not pvc_api_ssl_key_path when: pvc_api_enable_ssl and not pvc_api_ssl_key_path
- name: stop and disable unneccessary services
service:
name: "{{item }}"
state: stopped
enabled: no
with_items:
- pdns.service
- dnsmasq.service
- include: pvc/bootstrap.yml - include: pvc/bootstrap.yml
run_once: yes run_once: yes
when: bootstrap is defined and bootstrap and is_coordinator when: bootstrap is defined and bootstrap and is_coordinator
- name: enable daemon services but don't start them
service:
name: "{{ item }}"
state: stopped
enabled: yes
with_items:
- pvc-flush.service
- pvcnoded.service
- pvc.target
- name: install daily vacuum script - name: install daily vacuum script
template: template:
src: pvc/pvc-vacuum.j2 src: pvc/pvc-vacuum.j2
@ -67,3 +56,12 @@
mode: 0755 mode: 0755
- meta: flush_handlers - meta: flush_handlers
- name: ensure services are started and running
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- pvcnoded
when: bootstrap is not defined or not bootstrap