|
|
@ -1,6 +1,6 @@
|
|
|
|
#!/usr/bin/python
|
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
|
|
|
|
# (c) 2017, Vitaliy Zhhuta <zhhuta () gmail.com>
|
|
|
|
# Copyright: (c) 2017, Vitaliy Zhhuta <zhhuta () gmail.com>
|
|
|
|
# insipred by Kamil Szczygiel <kamil.szczygiel () intel.com> influxdb_database module
|
|
|
|
# insipred by Kamil Szczygiel <kamil.szczygiel () intel.com> influxdb_database module
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
|
|
|
@ -12,12 +12,12 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|
|
|
'status': ['preview'],
|
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: influxdb_user
|
|
|
|
module: influxdb_user
|
|
|
|
short_description: Manage InfluxDB users
|
|
|
|
short_description: Manage InfluxDB users
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Manage InfluxDB users
|
|
|
|
- Manage InfluxDB users.
|
|
|
|
version_added: 2.5
|
|
|
|
version_added: 2.5
|
|
|
|
author: "Vitaliy Zhhuta (@zhhuta)"
|
|
|
|
author: "Vitaliy Zhhuta (@zhhuta)"
|
|
|
|
requirements:
|
|
|
|
requirements:
|
|
|
@ -28,10 +28,12 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of the user.
|
|
|
|
- Name of the user.
|
|
|
|
required: True
|
|
|
|
required: True
|
|
|
|
|
|
|
|
type: str
|
|
|
|
user_password:
|
|
|
|
user_password:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Password to be set for the user.
|
|
|
|
- Password to be set for the user.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
|
|
|
|
type: str
|
|
|
|
admin:
|
|
|
|
admin:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Whether the user should be in the admin role or not.
|
|
|
|
- Whether the user should be in the admin role or not.
|
|
|
@ -41,19 +43,22 @@ options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- State of the user.
|
|
|
|
- State of the user.
|
|
|
|
choices: [ present, absent ]
|
|
|
|
choices: [ absent, present ]
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
|
|
|
|
type: str
|
|
|
|
grants:
|
|
|
|
grants:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Privileges to grant to this user. Takes a list of dicts containing the
|
|
|
|
- Privileges to grant to this user.
|
|
|
|
"database" and "privilege" keys.
|
|
|
|
- Takes a list of dicts containing the "database" and "privilege" keys.
|
|
|
|
- If this argument is not provided, the current grants will be left alone.
|
|
|
|
- If this argument is not provided, the current grants will be left alone.
|
|
|
|
If an empty list is provided, all grants for the user will be removed.
|
|
|
|
- If an empty list is provided, all grants for the user will be removed.
|
|
|
|
version_added: 2.8
|
|
|
|
version_added: 2.8
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
elements: dict
|
|
|
|
extends_documentation_fragment: influxdb
|
|
|
|
extends_documentation_fragment: influxdb
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = r'''
|
|
|
|
- name: Create a user on localhost using default login credentials
|
|
|
|
- name: Create a user on localhost using default login credentials
|
|
|
|
influxdb_user:
|
|
|
|
influxdb_user:
|
|
|
|
user_name: john
|
|
|
|
user_name: john
|
|
|
@ -95,7 +100,7 @@ EXAMPLES = '''
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = r'''
|
|
|
|
#only defaults
|
|
|
|
#only defaults
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -204,7 +209,7 @@ def main():
|
|
|
|
user_name=dict(required=True, type='str'),
|
|
|
|
user_name=dict(required=True, type='str'),
|
|
|
|
user_password=dict(required=False, type='str', no_log=True),
|
|
|
|
user_password=dict(required=False, type='str', no_log=True),
|
|
|
|
admin=dict(default='False', type='bool'),
|
|
|
|
admin=dict(default='False', type='bool'),
|
|
|
|
grants=dict(type='list')
|
|
|
|
grants=dict(type='list', elements='dict'),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
|