community.general.cs_user (0.1.1) — module

Manages users on Apache CloudStack based clouds.

Authors: René Moser (@resmo)

stableinterface | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Create, update, disable, lock, enable and remove users.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create an user in domain 'CUSTOMERS'
  cs_user:
    account: developers
    username: johndoe
    password: S3Cur3
    last_name: Doe
    first_name: John
    email: john.doe@example.com
    domain: CUSTOMERS
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Lock an existing user in domain 'CUSTOMERS'
  cs_user:
    username: johndoe
    domain: CUSTOMERS
    state: locked
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable an existing user in domain 'CUSTOMERS'
  cs_user:
    username: johndoe
    domain: CUSTOMERS
    state: disabled
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable/unlock an existing user in domain 'CUSTOMERS'
  cs_user:
    username: johndoe
    domain: CUSTOMERS
    state: enabled
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove an user in domain 'CUSTOMERS'
  cs_user:
    name: customer_xy
    domain: CUSTOMERS
    state: absent
  delegate_to: localhost

Inputs

    
email:
    description:
    - Email of the user.
    - Required on I(state=present).
    type: str

state:
    choices:
    - present
    - absent
    - enabled
    - disabled
    - locked
    - unlocked
    default: present
    description:
    - State of the user.
    - C(unlocked) is an alias for C(enabled).
    type: str

domain:
    default: ROOT
    description:
    - Domain the user is related to.
    type: str

account:
    description:
    - Account the user will be created under.
    - Required on I(state=present).
    type: str

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

api_url:
    description:
    - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

password:
    description:
    - Password of the user to be created.
    - Required on I(state=present).
    - Only considered on creation and will not be updated if user exists.
    type: str

timezone:
    description:
    - Timezone of the user.
    type: str

username:
    description:
    - Username of the user.
    required: true
    type: str

last_name:
    description:
    - Last name of the user.
    - Required on I(state=present).
    type: str

api_region:
    default: cloudstack
    description:
    - Name of the ini section in the C(cloustack.ini) file.
    - If not given, the C(CLOUDSTACK_REGION) env variable is considered.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

first_name:
    description:
    - First name of the user.
    - Required on I(state=present).
    type: str

poll_async:
    default: true
    description:
    - Poll async jobs until job has finished.
    type: bool

api_timeout:
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    - Fallback value is 10 seconds if not specified.
    type: int

api_http_method:
    choices:
    - get
    - post
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    - Fallback value is C(get) if not specified.
    type: str

keys_registered:
    default: false
    description:
    - If API keys of the user should be generated.
    - 'Note: Keys can not be removed by the API again.'
    type: bool

Outputs

account:
  description: Account name of the user.
  returned: success
  sample: developers
  type: str
account_type:
  description: Type of the account.
  returned: success
  sample: user
  type: str
created:
  description: Date the user was created.
  returned: success
  sample: Doe
  type: str
domain:
  description: Domain the user is related.
  returned: success
  sample: ROOT
  type: str
email:
  description: Emailof the user.
  returned: success
  sample: john.doe@example.com
  type: str
fist_name:
  description: First name of the user.
  returned: success
  sample: John
  type: str
id:
  description: UUID of the user.
  returned: success
  sample: 87b1e0ce-4e01-11e4-bb66-0050569e64b8
  type: str
last_name:
  description: Last name of the user.
  returned: success
  sample: Doe
  type: str
state:
  description: State of the user.
  returned: success
  sample: enabled
  type: str
timezone:
  description: Timezone of the user.
  returned: success
  sample: enabled
  type: str
user_api_key:
  description: API key of the user.
  returned: success
  sample: JLhcg8VWi8DoFqL2sSLZMXmGojcLnFrOBTipvBHJjySODcV4mCOo29W2duzPv5cALaZnXj5QxDx3xQfaQt3DKg
  type: str
user_api_secret:
  description: API secret of the user.
  returned: success
  sample: FUELo3LB9fa1UopjTLPdqLv_6OXQMJZv9g9N4B_Ao3HFz8d6IGFCV9MbPFNM8mwz00wbMevja1DoUNDvI8C9-g
  type: str
username:
  description: Username of the user.
  returned: success
  sample: johndoe
  type: str