Keep sushy-emulator state directory in /var/lib
By default it's in /tmp, which means that it can be removed on reboot or even during normal operation (after some time). Change-Id: Ib8e55dc9909381740d79fc660e46ecd329b89283
This commit is contained in:
parent
dfa9eddb3f
commit
3696933285
@ -19,6 +19,7 @@ test_vm_node_driver: ipmi
|
||||
|
||||
redfish_emulator_host: localhost
|
||||
redfish_emulator_port: 9132
|
||||
redfish_emulator_state_dir: /var/lib/redfish-emulator
|
||||
|
||||
# NOTE(pas-ha) name and default are chosen to be the same
|
||||
# as in 'bifrost-ironic-install' role
|
||||
|
@ -217,6 +217,15 @@
|
||||
vars:
|
||||
package: sushy-tools
|
||||
|
||||
- name: create Redfish Emulator state directory
|
||||
file:
|
||||
name: "{{ redfish_emulator_state_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
become: true
|
||||
|
||||
- name: ensure Redfish Emulator systemd service is configured
|
||||
template:
|
||||
src: redfish-emulator.service.j2
|
||||
@ -227,6 +236,10 @@
|
||||
become: true
|
||||
register: redfish_emulator_service_file
|
||||
|
||||
- name: reload systemd units if needed
|
||||
systemd:
|
||||
daemon_reload: "{{ redfish_emulator_service_file.changed }}"
|
||||
|
||||
- name: find OVMF firmware
|
||||
set_fact:
|
||||
efi_loader_path: "{{ item }}"
|
||||
@ -260,10 +273,28 @@
|
||||
become: true
|
||||
register: redfish_emulator_config_file
|
||||
|
||||
# NOTE(dtantsur): the migration can be removed after Xena
|
||||
|
||||
- name: check for the old state directory
|
||||
stat:
|
||||
path: /tmp/sushy-emulator
|
||||
register: redfish_emulator_old_state_dir
|
||||
|
||||
- block:
|
||||
- name: stop Redfish Emulator before migrating its state directory
|
||||
systemd:
|
||||
name: redfish-emulator
|
||||
state: stopped
|
||||
- name: migrate existing Redfish Emulator state directory
|
||||
shell: mv /tmp/sushy-emulator/*.sqlite "{{ redfish_emulator_state_dir }}"
|
||||
become: true
|
||||
ignore_errors: true
|
||||
when: redfish_emulator_old_state_dir.stat.exists
|
||||
and redfish_emulator_state_dir != '/tmp/sushy-emulator'
|
||||
|
||||
- name: ensure Redfish Emulator systemd service is started and enabled
|
||||
systemd:
|
||||
name: redfish-emulator
|
||||
enabled: yes
|
||||
state: "{{ 'restarted' if redfish_emulator_config_file.changed else 'started' }}"
|
||||
daemon_reload: "{{ redfish_emulator_service_file.changed }}"
|
||||
become: true
|
||||
|
@ -11,3 +11,4 @@ SUSHY_EMULATOR_BOOT_LOADER_MAP = {
|
||||
|
||||
SUSHY_EMULATOR_LISTEN_IP = '{{ redfish_emulator_host }}'
|
||||
SUSHY_EMULATOR_LISTEN_PORT = {{ redfish_emulator_port }}
|
||||
SUSHY_EMULATOR_STATE_DIR = '{{ redfish_emulator_state_dir }}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user