|
|
|
@ -2,21 +2,7 @@
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# (c) 2015, René Moser <mail@renemoser.net>
|
|
|
|
# (c) 2015, René Moser <mail@renemoser.net>
|
|
|
|
#
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# This file is part of Ansible
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
'status': ['stableinterface'],
|
|
|
|
'status': ['stableinterface'],
|
|
|
|
@ -30,80 +16,93 @@ short_description: Manages accounts on Apache CloudStack based clouds.
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Create, disable, lock, enable and remove accounts.
|
|
|
|
- Create, disable, lock, enable and remove accounts.
|
|
|
|
version_added: '2.0'
|
|
|
|
version_added: '2.0'
|
|
|
|
author: "René Moser (@resmo)"
|
|
|
|
author: René Moser (@resmo)
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
name:
|
|
|
|
name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of account.
|
|
|
|
- Name of account.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
username:
|
|
|
|
username:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Username of the user to be created if account did not exist.
|
|
|
|
- Username of the user to be created if account did not exist.
|
|
|
|
- Required on I(state=present).
|
|
|
|
- Required on I(state=present).
|
|
|
|
|
|
|
|
type: str
|
|
|
|
password:
|
|
|
|
password:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Password of the user to be created if account did not exist.
|
|
|
|
- Password of the user to be created if account did not exist.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
first_name:
|
|
|
|
first_name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- First name of the user to be created if account did not exist.
|
|
|
|
- First name of the user to be created if account did not exist.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
last_name:
|
|
|
|
last_name:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Last name of the user to be created if account did not exist.
|
|
|
|
- Last name of the user to be created if account did not exist.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
email:
|
|
|
|
email:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Email of the user to be created if account did not exist.
|
|
|
|
- Email of the user to be created if account did not exist.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
- Required on I(state=present) if I(ldap_domain) is not set.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
timezone:
|
|
|
|
timezone:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Timezone of the user to be created if account did not exist.
|
|
|
|
- Timezone of the user to be created if account did not exist.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
network_domain:
|
|
|
|
network_domain:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Network domain of the account.
|
|
|
|
- Network domain of the account.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
account_type:
|
|
|
|
account_type:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Type of the account.
|
|
|
|
- Type of the account.
|
|
|
|
default: 'user'
|
|
|
|
type: str
|
|
|
|
choices: [ 'user', 'root_admin', 'domain_admin' ]
|
|
|
|
choices: [ user, root_admin, domain_admin ]
|
|
|
|
|
|
|
|
default: user
|
|
|
|
domain:
|
|
|
|
domain:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Domain the account is related to.
|
|
|
|
- Domain the account is related to.
|
|
|
|
default: 'ROOT'
|
|
|
|
type: str
|
|
|
|
|
|
|
|
default: ROOT
|
|
|
|
role:
|
|
|
|
role:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Creates the account under the specified role name or id.
|
|
|
|
- Creates the account under the specified role name or id.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
version_added: 2.8
|
|
|
|
version_added: 2.8
|
|
|
|
ldap_domain:
|
|
|
|
ldap_domain:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of the LDAP group or OU to bind.
|
|
|
|
- Name of the LDAP group or OU to bind.
|
|
|
|
- If set, account will be linked to LDAP.
|
|
|
|
- If set, account will be linked to LDAP.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
version_added: 2.8
|
|
|
|
version_added: 2.8
|
|
|
|
ldap_type:
|
|
|
|
ldap_type:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Type of the ldap name. GROUP or OU, defaults to GROUP.
|
|
|
|
- Type of the ldap name. GROUP or OU, defaults to GROUP.
|
|
|
|
default: 'GROUP'
|
|
|
|
type: str
|
|
|
|
choices: [ 'GROUP', 'OU' ]
|
|
|
|
choices: [ GROUP, OU ]
|
|
|
|
|
|
|
|
default: GROUP
|
|
|
|
version_added: 2.8
|
|
|
|
version_added: 2.8
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- State of the account.
|
|
|
|
- State of the account.
|
|
|
|
- C(unlocked) is an alias for C(enabled).
|
|
|
|
- C(unlocked) is an alias for C(enabled).
|
|
|
|
default: 'present'
|
|
|
|
type: str
|
|
|
|
choices: [ 'present', 'absent', 'enabled', 'disabled', 'locked', 'unlocked' ]
|
|
|
|
choices: [ present, absent, enabled, disabled, locked, unlocked ]
|
|
|
|
|
|
|
|
default: present
|
|
|
|
poll_async:
|
|
|
|
poll_async:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Poll async jobs until job has finished.
|
|
|
|
- Poll async jobs until job has finished.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'yes'
|
|
|
|
default: yes
|
|
|
|
extends_documentation_fragment: cloudstack
|
|
|
|
extends_documentation_fragment: cloudstack
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
# create an account in domain 'CUSTOMERS'
|
|
|
|
- name: create an account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
username: customer_xy
|
|
|
|
username: customer_xy
|
|
|
|
password: S3Cur3
|
|
|
|
password: S3Cur3
|
|
|
|
@ -112,50 +111,51 @@ EXAMPLES = '''
|
|
|
|
email: john.doe@example.com
|
|
|
|
email: john.doe@example.com
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
role: Domain Admin
|
|
|
|
role: Domain Admin
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Lock an existing account in domain 'CUSTOMERS'
|
|
|
|
- name: Lock an existing account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
state: locked
|
|
|
|
state: locked
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Disable an existing account in domain 'CUSTOMERS'
|
|
|
|
- name: Disable an existing account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
state: disabled
|
|
|
|
state: disabled
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Enable an existing account in domain 'CUSTOMERS'
|
|
|
|
- name: Enable an existing account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
state: enabled
|
|
|
|
state: enabled
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Remove an account in domain 'CUSTOMERS'
|
|
|
|
- name: Remove an account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Create a single user LDAP account in domain 'CUSTOMERS'
|
|
|
|
- name: Create a single user LDAP account in domain 'CUSTOMERS'
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: customer_xy
|
|
|
|
name: customer_xy
|
|
|
|
username: customer_xy
|
|
|
|
username: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
ldap_domain: cn=customer_xy,cn=team_xy,ou=People,dc=domain,dc=local
|
|
|
|
ldap_domain: cn=customer_xy,cn=team_xy,ou=People,dc=domain,dc=local
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Create a LDAP account in domain 'CUSTOMERS' and bind it to a LDAP group
|
|
|
|
- name: Create a LDAP account in domain 'CUSTOMERS' and bind it to a LDAP group
|
|
|
|
- local_action:
|
|
|
|
cs_account:
|
|
|
|
module: cs_account
|
|
|
|
|
|
|
|
name: team_xy
|
|
|
|
name: team_xy
|
|
|
|
username: customer_xy
|
|
|
|
username: customer_xy
|
|
|
|
domain: CUSTOMERS
|
|
|
|
domain: CUSTOMERS
|
|
|
|
ldap_domain: cn=team_xy,ou=People,dc=domain,dc=local
|
|
|
|
ldap_domain: cn=team_xy,ou=People,dc=domain,dc=local
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = '''
|
|
|
|
|