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 2021-05-13 10:14:57 -04:00 committed by Joshua Boniface
parent 7536732f30
commit 238449904f
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"
ignore_errors: true
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
command: ip address delete {{ pvc_upstream_floatingip }}/{{ pvc_upstream_netmask }} dev {{ pvc_upstream_device }}
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
state: latest
- name: install pvc configurations
- name: install pvc node daemon configuration
template:
src: pvc/{{ item }}.j2
dest: /etc/pvc/{{ item }}
@ -19,6 +19,14 @@
- restart pvcnoded
with_items:
- pvcnoded.yaml
- name: install pvc api daemon configuration
template:
src: pvc/{{ item }}.j2
dest: /etc/pvc/{{ item }}
notify:
- restart pvcapid
with_items:
- pvcapid.yaml
- name: install API SSL certificate file
@ -37,29 +45,10 @@
no_log: True
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
run_once: yes
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
template:
src: pvc/pvc-vacuum.j2
@ -67,3 +56,12 @@
mode: 0755
- 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