From d6e14276c8183d6d4271e2183888ae053aa2e8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Sun, 31 Oct 2021 18:36:12 +0100 Subject: [PATCH] add the possibility to restart all supervisorctl programs and groups (#3598) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add the possibility to restart all supervisorctl programs and groups Signed-off-by: Thomas Sjögren * Update changelogs/fragments/3551-supervisor-all.yml Co-authored-by: Felix Fontein * add info about "all" in the name parameter description Signed-off-by: Thomas Sjögren * Update plugins/modules/web_infrastructure/supervisorctl.py Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/3551-supervisor-all.yml | 3 +++ plugins/modules/web_infrastructure/supervisorctl.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/3551-supervisor-all.yml diff --git a/changelogs/fragments/3551-supervisor-all.yml b/changelogs/fragments/3551-supervisor-all.yml new file mode 100644 index 0000000000..09d940b7e9 --- /dev/null +++ b/changelogs/fragments/3551-supervisor-all.yml @@ -0,0 +1,3 @@ +--- +minor_changes: +- supervisorctl - add the possibility to restart all programs and program groups (https://github.com/ansible-collections/community.general/issues/3551). diff --git a/plugins/modules/web_infrastructure/supervisorctl.py b/plugins/modules/web_infrastructure/supervisorctl.py index f44af0befe..bc4ef19af1 100644 --- a/plugins/modules/web_infrastructure/supervisorctl.py +++ b/plugins/modules/web_infrastructure/supervisorctl.py @@ -21,6 +21,7 @@ options: - The name of the supervisord program or group to manage. - The name will be taken as group name when it ends with a colon I(:) - Group support is only available in Ansible version 1.6 or later. + - If I(name=all), all programs and program groups will be managed. required: true config: type: path @@ -92,6 +93,11 @@ EXAMPLES = ''' name: my_app state: signalled signal: USR1 + +- name: Restart all programs and program groups + community.general.supervisorctl: + name: all + state: restarted ''' import os @@ -179,7 +185,7 @@ def main(): else: continue else: - if process_name != name: + if process_name != name and name != "all": continue matched.append((process_name, status))