Skip to content

Commit 0c3938e

Browse files
committed
Fix playbook failure due to invalid escaped character in service restart command
The playbook was failing when attempting to restart OpenStack services because of an invalid escaped character in the command that lists and restarts services. The original implementation used a shorthand systemctl flag (-a) along with a regular expression for egrep, which led to improper parsing and execution issues during the playbook run. This commit replaces the shorthand with a more explicit invocation that is confirmed to run without error: - Uses "systemctl list-units --type=service --all --no-legend --plain" to reliably list service units. - Adds the "-r" flag to xargs to avoid running systemctl restart without input, ensuring more predictable behavior. Note: This bug may be specific to hosts running Ubuntu Jammy
1 parent 8214ee4 commit 0c3938e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

etc/kayobe/ansible/rabbitmq-reset.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
register: inspection
3232

3333
- name: Ensure the {{ container_name }} container is running
34-
ansible.builtin.command: systemctl start kolla-{{ container_name }}-container.service # noqa command-instead-of-module
34+
ansible.builtin.command: systemctl start kolla-{{ container_name }}-container.service # noqa command-instead-of-module
3535
when: inspection.stdout == 'false'
3636

3737
- name: Wait for the {{ container_name }} container to reach state 'Running'
@@ -70,7 +70,8 @@
7070
ansible.builtin.shell:
7171
cmd: >-
7272
set -o pipefail &&
73-
systemctl -a | egrep 'kolla-(barbican|blazar|cinder|cloudkitty|designate|heat|ironic|keystone|magnum|manila|neutron|nova|octavia)' |
73+
systemctl list-units --type=service --all --no-legend --plain |
74+
egrep 'kolla-(barbican|blazar|cinder|cloudkitty|designate|heat|ironic|keystone|magnum|manila|neutron|nova|octavia)' |
7475
awk '{ print $1 }' |
75-
xargs systemctl restart
76+
xargs -r systemctl restart
7677
executable: "/bin/bash"

0 commit comments

Comments
 (0)