diff --git a/library/web_infrastructure/supervisorctl b/library/web_infrastructure/supervisorctl index d9f30be4c5..4d409dba41 100644 --- a/library/web_infrastructure/supervisorctl +++ b/library/web_infrastructure/supervisorctl @@ -37,7 +37,7 @@ options: - configuration file path, passed as -c to supervisorctl required: false default: null - serverurl: + server_url: description: - URL on which supervisord server is listening, passed as -s to supervisorctl required: false @@ -66,8 +66,11 @@ EXAMPLES = ''' # Manage the state of program to be in 'started' state. - supervisorctl: name=my_app state=started -# Restart another_app using an alternate config file -- supervisorctl: name=another_app state=restart config=/var/opt/my_project/supervisord.conf +# Restart my_app, reading supervisorctl configuration from a specified file. +- supervisorctl: name=my_app state=restart config=/var/opt/my_project/supervisord.conf + +# Restart my_app, connecting to supervisord with credentials and server URL. +- supervisorctl: name=my_app state=restart username=test password=testpass server_url=http://localhost:9001 ''' @@ -75,7 +78,7 @@ def main(): arg_spec = dict( name=dict(required=True), config=dict(required=False), - serverurl=dict(required=False), + server_url=dict(required=False), username=dict(required=False), password=dict(required=False), state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped']) @@ -86,15 +89,15 @@ def main(): name = module.params['name'] state = module.params['state'] config = module.params.get('config') - serverurl = module.params.get('serverurl') + server_url = module.params.get('server_url') username = module.params.get('username') password = module.params.get('password') supervisorctl_args = [ module.get_bin_path('supervisorctl', True) ] - if config: supervisorctl_args.extend(['-c', config]) - if serverurl: supervisorctl_args.extend(['-s', serverurl]) - if username: supervisorctl_args.extend(['-u', username]) - if password: supervisorctl_args.extend(['-p', password]) + if config: supervisorctl_args.extend(['-c', config]) + if server_url: supervisorctl_args.extend(['-s', server_url]) + if username: supervisorctl_args.extend(['-u', username]) + if password: supervisorctl_args.extend(['-p', password]) def run_supervisorctl(cmd, name=None, **kwargs): args = list(supervisorctl_args) # copy the master args