|
|
@ -11,7 +11,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
'supported_by': 'community'}
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: ipa_hbacrule
|
|
|
|
module: ipa_hbacrule
|
|
|
|
author: Thomas Krahn (@Nosmoht)
|
|
|
|
author: Thomas Krahn (@Nosmoht)
|
|
|
@ -25,72 +25,94 @@ options:
|
|
|
|
- Can not be changed as it is the unique identifier.
|
|
|
|
- Can not be changed as it is the unique identifier.
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
aliases: ["name"]
|
|
|
|
aliases: ["name"]
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
description: Description
|
|
|
|
description: Description
|
|
|
|
|
|
|
|
type: str
|
|
|
|
host:
|
|
|
|
host:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of host names to assign.
|
|
|
|
- List of host names to assign.
|
|
|
|
- If an empty list is passed all hosts will be removed from the rule.
|
|
|
|
- If an empty list is passed all hosts will be removed from the rule.
|
|
|
|
- If option is omitted hosts will not be checked or changed.
|
|
|
|
- If option is omitted hosts will not be checked or changed.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
hostcategory:
|
|
|
|
hostcategory:
|
|
|
|
description: Host category
|
|
|
|
description: Host category
|
|
|
|
choices: ['all']
|
|
|
|
choices: ['all']
|
|
|
|
|
|
|
|
type: str
|
|
|
|
hostgroup:
|
|
|
|
hostgroup:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of hostgroup names to assign.
|
|
|
|
- List of hostgroup names to assign.
|
|
|
|
- If an empty list is passed all hostgroups will be removed. from the rule
|
|
|
|
- If an empty list is passed all hostgroups will be removed. from the rule
|
|
|
|
- If option is omitted hostgroups will not be checked or changed.
|
|
|
|
- If option is omitted hostgroups will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
service:
|
|
|
|
service:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of service names to assign.
|
|
|
|
- List of service names to assign.
|
|
|
|
- If an empty list is passed all services will be removed from the rule.
|
|
|
|
- If an empty list is passed all services will be removed from the rule.
|
|
|
|
- If option is omitted services will not be checked or changed.
|
|
|
|
- If option is omitted services will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
servicecategory:
|
|
|
|
servicecategory:
|
|
|
|
description: Service category
|
|
|
|
description: Service category
|
|
|
|
choices: ['all']
|
|
|
|
choices: ['all']
|
|
|
|
|
|
|
|
type: str
|
|
|
|
servicegroup:
|
|
|
|
servicegroup:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of service group names to assign.
|
|
|
|
- List of service group names to assign.
|
|
|
|
- If an empty list is passed all assigned service groups will be removed from the rule.
|
|
|
|
- If an empty list is passed all assigned service groups will be removed from the rule.
|
|
|
|
- If option is omitted service groups will not be checked or changed.
|
|
|
|
- If option is omitted service groups will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
sourcehost:
|
|
|
|
sourcehost:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of source host names to assign.
|
|
|
|
- List of source host names to assign.
|
|
|
|
- If an empty list if passed all assigned source hosts will be removed from the rule.
|
|
|
|
- If an empty list if passed all assigned source hosts will be removed from the rule.
|
|
|
|
- If option is omitted source hosts will not be checked or changed.
|
|
|
|
- If option is omitted source hosts will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
sourcehostcategory:
|
|
|
|
sourcehostcategory:
|
|
|
|
description: Source host category
|
|
|
|
description: Source host category
|
|
|
|
choices: ['all']
|
|
|
|
choices: ['all']
|
|
|
|
|
|
|
|
type: str
|
|
|
|
sourcehostgroup:
|
|
|
|
sourcehostgroup:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of source host group names to assign.
|
|
|
|
- List of source host group names to assign.
|
|
|
|
- If an empty list if passed all assigned source host groups will be removed from the rule.
|
|
|
|
- If an empty list if passed all assigned source host groups will be removed from the rule.
|
|
|
|
- If option is omitted source host groups will not be checked or changed.
|
|
|
|
- If option is omitted source host groups will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description: State to ensure
|
|
|
|
description: State to ensure
|
|
|
|
default: "present"
|
|
|
|
default: "present"
|
|
|
|
choices: ["present", "absent", "enabled", "disabled"]
|
|
|
|
choices: ["absent", "disabled", "enabled","present"]
|
|
|
|
|
|
|
|
type: str
|
|
|
|
user:
|
|
|
|
user:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of user names to assign.
|
|
|
|
- List of user names to assign.
|
|
|
|
- If an empty list if passed all assigned users will be removed from the rule.
|
|
|
|
- If an empty list if passed all assigned users will be removed from the rule.
|
|
|
|
- If option is omitted users will not be checked or changed.
|
|
|
|
- If option is omitted users will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: str
|
|
|
|
usercategory:
|
|
|
|
usercategory:
|
|
|
|
description: User category
|
|
|
|
description: User category
|
|
|
|
choices: ['all']
|
|
|
|
choices: ['all']
|
|
|
|
|
|
|
|
type: str
|
|
|
|
usergroup:
|
|
|
|
usergroup:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- List of user group names to assign.
|
|
|
|
- List of user group names to assign.
|
|
|
|
- If an empty list if passed all assigned user groups will be removed from the rule.
|
|
|
|
- If an empty list if passed all assigned user groups will be removed from the rule.
|
|
|
|
- If option is omitted user groups will not be checked or changed.
|
|
|
|
- If option is omitted user groups will not be checked or changed.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
extends_documentation_fragment: ipa.documentation
|
|
|
|
extends_documentation_fragment: ipa.documentation
|
|
|
|
version_added: "2.3"
|
|
|
|
version_added: "2.3"
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = r'''
|
|
|
|
# Ensure rule to allow all users to access any host from any host
|
|
|
|
- name: Ensure rule to allow all users to access any host from any host
|
|
|
|
- ipa_hbacrule:
|
|
|
|
ipa_hbacrule:
|
|
|
|
name: allow_all
|
|
|
|
name: allow_all
|
|
|
|
description: Allow all users to access any host from any host
|
|
|
|
description: Allow all users to access any host from any host
|
|
|
|
hostcategory: all
|
|
|
|
hostcategory: all
|
|
|
@ -101,8 +123,8 @@ EXAMPLES = '''
|
|
|
|
ipa_user: admin
|
|
|
|
ipa_user: admin
|
|
|
|
ipa_pass: topsecret
|
|
|
|
ipa_pass: topsecret
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure rule with certain limitations
|
|
|
|
- name: Ensure rule with certain limitations
|
|
|
|
- ipa_hbacrule:
|
|
|
|
ipa_hbacrule:
|
|
|
|
name: allow_all_developers_access_to_db
|
|
|
|
name: allow_all_developers_access_to_db
|
|
|
|
description: Allow all developers to access any database from any host
|
|
|
|
description: Allow all developers to access any database from any host
|
|
|
|
hostgroup:
|
|
|
|
hostgroup:
|
|
|
@ -114,8 +136,8 @@ EXAMPLES = '''
|
|
|
|
ipa_user: admin
|
|
|
|
ipa_user: admin
|
|
|
|
ipa_pass: topsecret
|
|
|
|
ipa_pass: topsecret
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure rule is absent
|
|
|
|
- name: Ensure rule is absent
|
|
|
|
- ipa_hbacrule:
|
|
|
|
ipa_hbacrule:
|
|
|
|
name: rule_to_be_deleted
|
|
|
|
name: rule_to_be_deleted
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
ipa_host: ipa.example.com
|
|
|
|
ipa_host: ipa.example.com
|
|
|
@ -123,7 +145,7 @@ EXAMPLES = '''
|
|
|
|
ipa_pass: topsecret
|
|
|
|
ipa_pass: topsecret
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = r'''
|
|
|
|
hbacrule:
|
|
|
|
hbacrule:
|
|
|
|
description: HBAC rule as returned by IPA API.
|
|
|
|
description: HBAC rule as returned by IPA API.
|
|
|
|
returned: always
|
|
|
|
returned: always
|
|
|
@ -300,19 +322,19 @@ def main():
|
|
|
|
argument_spec = ipa_argument_spec()
|
|
|
|
argument_spec = ipa_argument_spec()
|
|
|
|
argument_spec.update(cn=dict(type='str', required=True, aliases=['name']),
|
|
|
|
argument_spec.update(cn=dict(type='str', required=True, aliases=['name']),
|
|
|
|
description=dict(type='str'),
|
|
|
|
description=dict(type='str'),
|
|
|
|
host=dict(type='list'),
|
|
|
|
host=dict(type='list', elements='str'),
|
|
|
|
hostcategory=dict(type='str', choices=['all']),
|
|
|
|
hostcategory=dict(type='str', choices=['all']),
|
|
|
|
hostgroup=dict(type='list'),
|
|
|
|
hostgroup=dict(type='list', elements='str'),
|
|
|
|
service=dict(type='list'),
|
|
|
|
service=dict(type='list', elements='str'),
|
|
|
|
servicecategory=dict(type='str', choices=['all']),
|
|
|
|
servicecategory=dict(type='str', choices=['all']),
|
|
|
|
servicegroup=dict(type='list'),
|
|
|
|
servicegroup=dict(type='list', elements='str'),
|
|
|
|
sourcehost=dict(type='list'),
|
|
|
|
sourcehost=dict(type='list', elements='str'),
|
|
|
|
sourcehostcategory=dict(type='str', choices=['all']),
|
|
|
|
sourcehostcategory=dict(type='str', choices=['all']),
|
|
|
|
sourcehostgroup=dict(type='list'),
|
|
|
|
sourcehostgroup=dict(type='list', elements='str'),
|
|
|
|
state=dict(type='str', default='present', choices=['present', 'absent', 'enabled', 'disabled']),
|
|
|
|
state=dict(type='str', default='present', choices=['present', 'absent', 'enabled', 'disabled']),
|
|
|
|
user=dict(type='list'),
|
|
|
|
user=dict(type='list', elements='str'),
|
|
|
|
usercategory=dict(type='str', choices=['all']),
|
|
|
|
usercategory=dict(type='str', choices=['all']),
|
|
|
|
usergroup=dict(type='list'))
|
|
|
|
usergroup=dict(type='list', elements='str'))
|
|
|
|
|
|
|
|
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec,
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec,
|
|
|
|
supports_check_mode=True
|
|
|
|
supports_check_mode=True
|
|
|
|