diff --git a/handlers/main.yml b/handlers/main.yml index d95a11e6..7112d00e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -27,6 +27,7 @@ listen: - "Restart cinder services" - "venv changed" + - "systemd service changed" - name: Start services service: @@ -42,6 +43,7 @@ listen: - "Restart cinder services" - "venv changed" + - "systemd service changed" - name: Ensure tgt service restarted service: diff --git a/tasks/cinder_install.yml b/tasks/cinder_install.yml index f6d46a16..6886703e 100644 --- a/tasks/cinder_install.yml +++ b/tasks/cinder_install.yml @@ -55,22 +55,7 @@ systemd_BlockIOAccounting: true systemd_MemoryAccounting: true systemd_TasksAccounting: true - systemd_services: |- - {% set services = [] %} - {% for service in filtered_cinder_services %} - {% - set _ = service.update( - { - 'enabled': 'yes', - 'state': 'started', - 'config_overrides': cinder_environment_overrides | combine(service.init_config_overrides, recursive=True) - } - ) - %} - {% set _ = service.pop('init_config_overrides') -%} - {% set _ = services.append(service) -%} - {% endfor %} - {{ services }} + systemd_services: "{{ filtered_cinder_services }}" tags: - cinder-config - systemd-service diff --git a/vars/main.yml b/vars/main.yml index 53c33053..ee9c883d 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -34,7 +34,15 @@ filtered_cinder_services: |- (('condition' not in value) or ('condition' in value and value['condition'])) and not ('wsgi_app' in value and value['wsgi_app']) %} - {% set _ = value.update({'service_key': key}) %} + {% set _ = value.update( + { + 'service_key': key, + 'enabled': value['enabled'] | default(True), + 'state': value['state'] | default('started'), + 'config_overrides': cinder_environment_overrides | combine(value.init_config_overrides, recursive=True) + } + ) %} + {% set _ = value.pop('init_config_overrides') -%} {% set _ = services.append(value) %} {% endif %} {% endfor %}