nspawn: fix restart-service.yml service list filtering

The service list filtering is supposed to look for all services
that are prefixed with 'service_name', however, we are not doing
that in the regex.

When using nspawn and restarting a service such as 'nova', it matches
the systemd-nspawn service for the container and attempts to reload
it which fails.

This fixes it by forcing it to check for services *prefixed* with
that variable.

Change-Id: Ib1a3975f2722127eada2dd957300fd306abbe6d9
This commit is contained in:
Mohammed Naser 2019-02-01 14:57:02 -05:00
parent 8de5d35d2d
commit 270955fe0c
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@
# - service_action: The action to execute [stop, start, restart, reload].
- name: Gather service list
shell: "systemctl list-unit-files --state=enabled --type=service | awk '/{{ service_name }}.* enabled$/ {print $1}'"
shell: "systemctl list-unit-files --state=enabled --type=service | awk '/^{{ service_name }}.* enabled$/ {print $1}'"
args:
executable: "/bin/bash"
register: _enabled_services