apache2-mod-proxy: make state option a list (#9600)
* apache2-mod-proxy: make state option a list * add changelog frag * Update plugins/modules/apache2_mod_proxy.py * Update changelogs/fragments/9600-apache2-mod-proxy-revamp2.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>pull/9612/head
parent
d7f067dd28
commit
a4562bced4
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- apache2_mod_proxy - change type of ``state`` to a list of strings. No change for the users (https://github.com/ansible-collections/community.general/pull/9600).
|
|
@ -43,11 +43,14 @@ options:
|
||||||
be specified here. If undefined, apache2_mod_proxy module will return a members list of dictionaries of all the current
|
be specified here. If undefined, apache2_mod_proxy module will return a members list of dictionaries of all the current
|
||||||
balancer pool members' attributes.
|
balancer pool members' attributes.
|
||||||
state:
|
state:
|
||||||
type: str
|
type: list
|
||||||
|
elements: str
|
||||||
|
choices: [present, absent, enabled, disabled, drained, hot_standby, ignore_errors]
|
||||||
description:
|
description:
|
||||||
- Desired state of the member host. (absent|disabled),drained,hot_standby,ignore_errors can be simultaneously invoked
|
- Desired state of the member host.
|
||||||
by separating them with a comma (for example V(state=drained,ignore_errors)).
|
- States can be simultaneously invoked by separating them with a comma (for example V(state=drained,ignore_errors)),
|
||||||
- 'Accepted state values: [V(present), V(absent), V(enabled), V(disabled), V(drained), V(hot_standby), V(ignore_errors)].'
|
but it is recommended to specify them as a proper YAML list.
|
||||||
|
- States V(present) and V(absent) must be used without any other state.
|
||||||
tls:
|
tls:
|
||||||
description:
|
description:
|
||||||
- Use https to access balancer management page.
|
- Use https to access balancer management page.
|
||||||
|
@ -369,7 +372,7 @@ def main():
|
||||||
balancer_vhost=dict(required=True, type='str'),
|
balancer_vhost=dict(required=True, type='str'),
|
||||||
balancer_url_suffix=dict(default="/balancer-manager/", type='str'),
|
balancer_url_suffix=dict(default="/balancer-manager/", type='str'),
|
||||||
member_host=dict(type='str'),
|
member_host=dict(type='str'),
|
||||||
state=dict(type='str'),
|
state=dict(type='list', elements='str', choices=['present', 'absent', 'enabled', 'disabled', 'drained', 'hot_standby', 'ignore_errors']),
|
||||||
tls=dict(default=False, type='bool'),
|
tls=dict(default=False, type='bool'),
|
||||||
validate_certs=dict(default=True, type='bool')
|
validate_certs=dict(default=True, type='bool')
|
||||||
),
|
),
|
||||||
|
@ -380,15 +383,9 @@ def main():
|
||||||
module.fail_json(msg=missing_required_lib('BeautifulSoup'), exception=BEAUTIFUL_SOUP_IMP_ERR)
|
module.fail_json(msg=missing_required_lib('BeautifulSoup'), exception=BEAUTIFUL_SOUP_IMP_ERR)
|
||||||
|
|
||||||
if module.params['state'] is not None:
|
if module.params['state'] is not None:
|
||||||
states = module.params['state'].split(',')
|
states = module.params['state']
|
||||||
if (len(states) > 1) and (("present" in states) or ("enabled" in states)):
|
if (len(states) > 1) and (("present" in states) or ("enabled" in states)):
|
||||||
module.fail_json(msg="state present/enabled is mutually exclusive with other states!")
|
module.fail_json(msg="state present/enabled is mutually exclusive with other states!")
|
||||||
else:
|
|
||||||
for _state in states:
|
|
||||||
if _state not in ['present', 'absent', 'enabled', 'disabled', 'drained', 'hot_standby', 'ignore_errors']:
|
|
||||||
module.fail_json(
|
|
||||||
msg="State can only take values amongst 'present', 'absent', 'enabled', 'disabled', 'drained', 'hot_standby', 'ignore_errors'."
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
states = ['None']
|
states = ['None']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue