| Removed in Ansible: | |
|---|---|
| version: 1.5.0 | |
| Why: | Alibaba Cloud module name prefix “ali” will be more concise. |
| Alternative: | Use ali_rds_account instead. |
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
|
account_name
required |
Operation account requiring a uniqueness check. It may consist of lower case letters, numbers and underlines, and must start with a letter and have no more than 16 characters.
aliases: name |
|
| account_password |
Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters, Required when
account_password != ""aliases: password |
|
| account_privilege |
|
Account permission.Required when
account_privilege != ""aliases: privilege |
| account_type |
|
Privilege type of account. Normal for Common privilege; Super for High privilege; Default value is Normal. This parameter is valid for MySQL 5.5/5.6 only
aliases: type |
| alicloud_access_key |
Aliyun Cloud access key. If not set then the value of environment variable
ALICLOUD_ACCESS_KEY, ALICLOUD_ACCESS_KEY_ID will be used instead.aliases: access_key_id, access_key |
|
| alicloud_region |
The Aliyun Cloud region to use. If not specified then the value of environment variable
ALICLOUD_REGION, ALICLOUD_REGION_ID will be used instead.aliases: region, region_id |
|
| alicloud_secret_key |
Aliyun Cloud secret key. If not set then the value of environment variable
ALICLOUD_SECRET_KEY, ALICLOUD_SECRET_ACCESS_KEY will be used instead.aliases: secret_access_key, secret_key |
|
| alicloud_security_token |
The Aliyun Cloud security token. If not specified then the value of environment variable
ALICLOUD_SECURITY_TOKEN will be used instead.aliases: security_token |
|
|
db_instance_id
required |
Id of rds instance.
|
|
| db_name |
Name of the database associated with this account, Required when
db_name != "". |
|
| description |
Account remarks, which cannot exceed 256 characters. It cannot begin with http:// , https:// . It must start with a Chinese character or English letter. It can include Chinese and English characters/letters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters,
|
|
| state |
|
The state of the account after operating.
|
Note
ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKENALICLOUD_REGION or ALICLOUD_REGION_ID can be typically be used to specify the ALICLOUD region, when required, but this can also be configured in the footmark config file# basic provisioning example to create account
- name: create account
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-beijing
db_instance_id: <your-rds-instance-id>
account_name: test
account_password: rohit@123
description: normal account
account_type: normal
tasks:
- name: create account
ali_rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
account_name: '{{ account_name }}'
account_password: '{{ account_password }}'
description: '{{ description }}'
account_type: '{{ account_type }}'
register: result
- debug: var=result
# basic provisioning example to modify account description
- name: modify description
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-beijing
db_instance_id: <your-rds-instance-id>
account_name: test
description: normal account
tasks:
- name: modify description
ali_rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
account_name: '{{ account_name }}'
description: '{{ description }}'
register: result
- debug: var=result
# basic provisioning example to reset an account password
- name: Reset an account password
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-beijing
db_instance_id: <your-rds-instance-id>
account_name: test
account_password: rohit@123
tasks:
- name: reset an account password
ali_rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
account_name: '{{ account_name }}'
account_password: '{{ account_password }}'
register: result
- debug: var=result
# basic provisioning example to delete an account
- name: Delete account
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-hongkong
state: absent
db_instance_id: <your-rds-instance-id>
account_name: test
tasks:
- name: delete account
rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
account_name: '{{ account_name }}'
register: result
- debug: var=result
# basic provisioning example to grant account permission
- name: grant account permission
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-hongkong
db_instance_id: <your-rds-instance-id>
db_name: test
account_name: account-test
account_privilege: ReadOnly
tasks:
- name: grant account permission
rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
db_name: '{{ db_name }}'
account_name: '{{ account_name }}'
account_privilege: '{{ account_privilege }}'
register: result
- debug: var=result
# basic provisioning example to revoke account permission
- name: revoke account permission
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-hongkong
db_instance_id: <your-rds-instance-id>
db_name: db-test
account_name: account-test
tasks:
- name: revoke account permission
rds_account:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: present
db_instance_id: '{{ db_instance_id }}'
db_name: '{{ db_name }}'
account_name: '{{ account_name }}'
register: result
- debug: var=result
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
|
account
dict
|
when success |
account info.
Sample:
{'account_type': 'Normal', 'account_status': 'Available', 'database_privileges': {'database_privilege': [{'account_privilege': 'ReadOnly', 'dbname': 'testtest'}]}, 'db_instance_id': 'rm-2zey7ir50261bmg42', 'account_description': '', 'account_name': 'testdemoaccount'}
|
|
account_name
str
|
when success |
name of account.
Sample:
testname
|
This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.
Hint
If you notice any issues in this documentation you can edit this document to improve it.