2022-08-05 20:16:36 +02:00
|
|
|
---
|
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: stop py1 service
|
|
|
|
supervisorctl:
|
|
|
|
name: 'pys:py1'
|
|
|
|
state: stopped
|
|
|
|
# test with 'server_url' parameter
|
2020-03-31 10:52:24 +02:00
|
|
|
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
|
2020-03-09 10:11:07 +01:00
|
|
|
register: result
|
|
|
|
when: credentials.username == ''
|
|
|
|
|
|
|
|
- name: stop py1 service
|
|
|
|
supervisorctl:
|
|
|
|
name: 'pys:py1'
|
|
|
|
state: stopped
|
|
|
|
# test with unix socket
|
2020-03-31 10:52:24 +02:00
|
|
|
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
|
2020-03-09 10:11:07 +01:00
|
|
|
username: '{{ credentials.username }}'
|
|
|
|
password: '{{ credentials.password }}'
|
|
|
|
register: result_with_auth
|
|
|
|
when: credentials.username != ''
|
|
|
|
|
2021-07-25 13:53:38 +02:00
|
|
|
- command: "supervisorctl -c {{ remote_dir }}/supervisord.conf {% if credentials.username %}-u {{ credentials.username }} -p {{ credentials.password }}{% endif %} status"
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: check that service is stopped
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
|
|
|
|
- (result is changed and result_with_auth is skip) or (result is skip and result_with_auth is changed)
|
|
|
|
|
|
|
|
- name: "check that service isn't running"
|
|
|
|
script: "files/sendProcessStdin.py 'pys:py1' 1 \
|
|
|
|
'{{ credentials.username }}' '{{ credentials.password }}'"
|
|
|
|
register: is_py1_alive
|
|
|
|
failed_when: is_py1_alive is success
|
|
|
|
|
|
|
|
- name: try again to stop py1 service (without auth)
|
|
|
|
supervisorctl:
|
|
|
|
name: pys:py1
|
|
|
|
state: stopped
|
|
|
|
# test with 'server_url' parameter
|
2020-03-31 10:52:24 +02:00
|
|
|
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
|
2020-03-09 10:11:07 +01:00
|
|
|
register: result
|
|
|
|
when: credentials.username == ''
|
|
|
|
|
|
|
|
- name: try again to stop py1 service (with auth)
|
|
|
|
supervisorctl:
|
|
|
|
name: pys:py1
|
|
|
|
state: stopped
|
|
|
|
# test with unix socket
|
2020-03-31 10:52:24 +02:00
|
|
|
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
|
2020-03-09 10:11:07 +01:00
|
|
|
username: '{{ credentials.username }}'
|
|
|
|
password: '{{ credentials.password }}'
|
|
|
|
register: result_with_auth
|
|
|
|
when: credentials.username != ''
|
|
|
|
|
|
|
|
- name: check that service is already stopped
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
|
|
|
|
- (result is not changed and result_with_auth is skip) or (result is skip and result_with_auth is not changed)
|