mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Sanity fixes to parameter types (#52325)
This commit is contained in:
parent
47190088b4
commit
677c04c01d
25 changed files with 445 additions and 404 deletions
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright: (c) 2017, Ansible Project
|
# Copyright: (c) 2017, Ansible Project
|
||||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||||
|
|
||||||
|
@ -49,17 +50,17 @@ class InfluxDb():
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def influxdb_argument_spec():
|
def influxdb_argument_spec():
|
||||||
return dict(
|
return dict(
|
||||||
hostname=dict(default='localhost', type='str'),
|
hostname=dict(type='str', default='localhost'),
|
||||||
port=dict(default=8086, type='int'),
|
port=dict(type='int', default=8086),
|
||||||
username=dict(default='root', type='str', aliases=['login_username']),
|
username=dict(type='str', default='root', aliases=['login_username']),
|
||||||
password=dict(default='root', type='str', no_log=True, aliases=['login_password']),
|
password=dict(type='str', default='root', no_log=True, aliases=['login_password']),
|
||||||
ssl=dict(default=False, type='bool'),
|
ssl=dict(type='bool', default=False),
|
||||||
validate_certs=dict(default=True, type='bool'),
|
validate_certs=dict(type='bool', default=True),
|
||||||
timeout=dict(type='int'),
|
timeout=dict(type='int'),
|
||||||
retries=dict(default=3, type='int'),
|
retries=dict(type='int', default=3),
|
||||||
proxies=dict(default={}, type='dict'),
|
proxies=dict(type='dict', default={}),
|
||||||
use_udp=dict(default=False, type='bool'),
|
use_udp=dict(type='bool', default=False),
|
||||||
udp_port=dict(type=int)
|
udp_port=dict(type='int'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def connect_to_influxdb(self):
|
def connect_to_influxdb(self):
|
||||||
|
|
|
@ -1,23 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (c) 2017 Cisco and/or its affiliates.
|
# Copyright: (c) 2017, Cisco and/or its affiliates.
|
||||||
#
|
# 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/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
|
@ -35,10 +19,10 @@ except NameError:
|
||||||
|
|
||||||
|
|
||||||
nso_argument_spec = dict(
|
nso_argument_spec = dict(
|
||||||
url=dict(required=True),
|
url=dict(type='str', required=True),
|
||||||
username=dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME']), required=True),
|
username=dict(type='str', required=True, fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])),
|
||||||
password=dict(fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), required=True, no_log=True),
|
password=dict(type='str', required=True, no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD'])),
|
||||||
timeout=dict(default=300, type=int)
|
timeout=dict(type='int', default=300),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: azure_rm_managed_disk_facts
|
module: azure_rm_managed_disk_facts
|
||||||
|
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
|
|
||||||
short_description: Get managed disk facts.
|
short_description: Get managed disk facts
|
||||||
|
|
||||||
description:
|
description:
|
||||||
- Get facts for a specific managed disk or all managed disks.
|
- Get facts for a specific managed disk or all managed disks.
|
||||||
|
@ -26,38 +26,42 @@ description:
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Limit results to a specific managed disk
|
- Limit results to a specific managed disk.
|
||||||
|
type: str
|
||||||
resource_group:
|
resource_group:
|
||||||
description:
|
description:
|
||||||
- Limit results to a specific resource group
|
- Limit results to a specific resource group.
|
||||||
|
type: str
|
||||||
tags:
|
tags:
|
||||||
description:
|
description:
|
||||||
- Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
|
- Limit results by providing a list of tags.
|
||||||
|
- Format tags as 'key' or 'key:value'.
|
||||||
|
type: list
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- azure
|
- azure
|
||||||
- azure_tags
|
- azure_tags
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- "Bruno Medina (@brusMX)"
|
- Bruno Medina (@brusMX)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
- name: Get facts for one managed disk
|
- name: Get facts for one managed disk
|
||||||
azure_rm_managed_disk_facts:
|
azure_rm_managed_disk_facts:
|
||||||
name: Testing
|
name: Testing
|
||||||
resource_group: TestRG
|
resource_group: TestRG
|
||||||
|
|
||||||
- name: Get facts for all managed disks
|
- name: Get facts for all managed disks
|
||||||
azure_rm_managed_disk_facts:
|
azure_rm_managed_disk_facts:
|
||||||
|
|
||||||
- name: Get facts by tags
|
- name: Get facts by tags
|
||||||
azure_rm_managed_disk_facts:
|
azure_rm_managed_disk_facts:
|
||||||
tags:
|
tags:
|
||||||
- testing
|
- testing
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r'''
|
||||||
azure_managed_disk:
|
azure_managed_disk:
|
||||||
description: List of managed disk dicts.
|
description: List of managed disk dicts.
|
||||||
returned: always
|
returned: always
|
||||||
|
@ -66,39 +70,46 @@ azure_managed_disk:
|
||||||
id:
|
id:
|
||||||
description:
|
description:
|
||||||
- Resource id.
|
- Resource id.
|
||||||
|
type: str
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name of the managed disk.
|
- Name of the managed disk.
|
||||||
|
type: str
|
||||||
location:
|
location:
|
||||||
description:
|
description:
|
||||||
- Valid Azure location.
|
- Valid Azure location.
|
||||||
|
type: str
|
||||||
storage_account_type:
|
storage_account_type:
|
||||||
description:
|
description:
|
||||||
- Type of storage for the managed disk
|
- Type of storage for the managed disk
|
||||||
sample: Standard_LRS
|
|
||||||
type: str
|
type: str
|
||||||
|
sample: Standard_LRS
|
||||||
create_option:
|
create_option:
|
||||||
description:
|
description:
|
||||||
- Create option of the disk
|
- Create option of the disk
|
||||||
sample: copy
|
|
||||||
type: str
|
type: str
|
||||||
|
sample: copy
|
||||||
source_uri:
|
source_uri:
|
||||||
description:
|
description:
|
||||||
- URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
|
- URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
|
||||||
|
type: str
|
||||||
os_type:
|
os_type:
|
||||||
description:
|
description:
|
||||||
- "Type of Operating System: C(linux) or C(windows)."
|
- "Type of Operating System: C(linux) or C(windows)."
|
||||||
|
type: str
|
||||||
disk_size_gb:
|
disk_size_gb:
|
||||||
description:
|
description:
|
||||||
- Size in GB of the managed disk to be created.
|
- Size in GB of the managed disk to be created.
|
||||||
|
type: str
|
||||||
managed_by:
|
managed_by:
|
||||||
description:
|
description:
|
||||||
- Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
|
- Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
|
||||||
|
type: str
|
||||||
tags:
|
tags:
|
||||||
description:
|
description:
|
||||||
- Tags to assign to the managed disk.
|
- Tags to assign to the managed disk.
|
||||||
sample: { "tag": "value" }
|
|
||||||
type: dict
|
type: dict
|
||||||
|
sample: { "tag": "value" }
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||||
|
@ -204,7 +215,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
||||||
try:
|
try:
|
||||||
response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group)
|
response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group)
|
||||||
except CloudError as exc:
|
except CloudError as exc:
|
||||||
self.fail('Failed to list items by resource group - {}'.format(str(exc)))
|
self.fail('Failed to list items by resource group - {0}'.format(str(exc)))
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for item in response:
|
for item in response:
|
||||||
|
|
|
@ -8,12 +8,10 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: openssl_certificate
|
module: openssl_certificate
|
||||||
|
@ -201,13 +199,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- A list of algorithms that you would accept the certificate to be signed with
|
- A list of algorithms that you would accept the certificate to be signed with
|
||||||
(e.g. ['sha256WithRSAEncryption', 'sha512WithRSAEncryption']).
|
(e.g. ['sha256WithRSAEncryption', 'sha512WithRSAEncryption']).
|
||||||
type: str
|
type: list
|
||||||
|
|
||||||
issuer:
|
issuer:
|
||||||
description:
|
description:
|
||||||
- The key/value pairs that must be present in the issuer name field of the certificate.
|
- The key/value pairs that must be present in the issuer name field of the certificate.
|
||||||
- If you need to specify more than one value with the same key, use a list as value.
|
- If you need to specify more than one value with the same key, use a list as value.
|
||||||
type: str
|
type: dict
|
||||||
|
|
||||||
issuer_strict:
|
issuer_strict:
|
||||||
description:
|
description:
|
||||||
|
@ -220,7 +218,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- The key/value pairs that must be present in the subject name field of the certificate.
|
- The key/value pairs that must be present in the subject name field of the certificate.
|
||||||
- If you need to specify more than one value with the same key, use a list as value.
|
- If you need to specify more than one value with the same key, use a list as value.
|
||||||
type: str
|
type: dict
|
||||||
|
|
||||||
subject_strict:
|
subject_strict:
|
||||||
description:
|
description:
|
||||||
|
@ -1092,7 +1090,7 @@ def main():
|
||||||
# provider: ownca
|
# provider: ownca
|
||||||
ownca_path=dict(type='path'),
|
ownca_path=dict(type='path'),
|
||||||
ownca_privatekey_path=dict(type='path'),
|
ownca_privatekey_path=dict(type='path'),
|
||||||
ownca_privatekey_passphrase=dict(type='path', no_log=True),
|
ownca_privatekey_passphrase=dict(type='str', no_log=True),
|
||||||
ownca_digest=dict(type='str', default='sha256'),
|
ownca_digest=dict(type='str', default='sha256'),
|
||||||
ownca_version=dict(type='int', default=3),
|
ownca_version=dict(type='int', default=3),
|
||||||
ownca_not_before=dict(type='str', default='+0s'),
|
ownca_not_before=dict(type='str', default='+0s'),
|
||||||
|
|
|
@ -67,7 +67,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- Key/value pairs that will be present in the subject name field of the certificate signing request.
|
- Key/value pairs that will be present in the subject name field of the certificate signing request.
|
||||||
- If you need to specify more than one value with the same key, use a list as value.
|
- If you need to specify more than one value with the same key, use a list as value.
|
||||||
type: str
|
type: dict
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
country_name:
|
country_name:
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
|
# Copyright: (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
|
||||||
# Sponsored by Four Kitchens http://fourkitchens.com.
|
# Sponsored by Four Kitchens http://fourkitchens.com.
|
||||||
# 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)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: mysql_db
|
module: mysql_db
|
||||||
short_description: Add or remove MySQL databases from a remote host.
|
short_description: Add or remove MySQL databases from a remote host.
|
||||||
|
@ -72,7 +70,7 @@ notes:
|
||||||
extends_documentation_fragment: mysql
|
extends_documentation_fragment: mysql
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
- name: Create a new database with name 'bobdata'
|
- name: Create a new database with name 'bobdata'
|
||||||
mysql_db:
|
mysql_db:
|
||||||
name: bobdata
|
name: bobdata
|
||||||
|
@ -250,26 +248,26 @@ def db_create(cursor, db, encoding, collation):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
login_user=dict(default=None),
|
login_user=dict(type='str'),
|
||||||
login_password=dict(default=None, no_log=True),
|
login_password=dict(type='str', no_log=True),
|
||||||
login_host=dict(default="localhost"),
|
login_host=dict(type='str', default='localhost'),
|
||||||
login_port=dict(default=3306, type='int'),
|
login_port=dict(type='int', default=3306),
|
||||||
login_unix_socket=dict(default=None),
|
login_unix_socket=dict(type='str'),
|
||||||
name=dict(required=True, aliases=['db']),
|
name=dict(type='str', required=True, aliases=['db']),
|
||||||
encoding=dict(default=""),
|
encoding=dict(type='str', default=''),
|
||||||
collation=dict(default=""),
|
collation=dict(type='str', default=''),
|
||||||
target=dict(default=None, type='path'),
|
target=dict(type='path'),
|
||||||
state=dict(default="present", choices=["absent", "present", "dump", "import"]),
|
state=dict(type='str', default='present', choices=['absent', 'dump', 'import', 'present']),
|
||||||
ssl_cert=dict(default=None, type='path'),
|
ssl_cert=dict(type='path'),
|
||||||
ssl_key=dict(default=None, type='path'),
|
ssl_key=dict(type='path'),
|
||||||
ssl_ca=dict(default=None, type='path'),
|
ssl_ca=dict(type='path'),
|
||||||
connect_timeout=dict(default=30, type='int'),
|
connect_timeout=dict(type='int', default=30),
|
||||||
config_file=dict(default="~/.my.cnf", type='path'),
|
config_file=dict(type='path', default='~/.my.cnf'),
|
||||||
single_transaction=dict(default=False, type='bool'),
|
single_transaction=dict(type='bool', default=False),
|
||||||
quick=dict(default=True, type='bool'),
|
quick=dict(type='bool', default=True),
|
||||||
ignore_tables=dict(default=[], type='list')
|
ignore_tables=dict(type='list', default=[]),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if mysql_driver is None:
|
if mysql_driver is None:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, Balazs Pocze <banyek@gawker.com>
|
# Copyright: (c) 2013, Balazs Pocze <banyek@gawker.com>
|
||||||
# Certain parts are taken from Mark Theunissen's mysqldb module
|
# Certain parts are taken from Mark Theunissen's mysqldb 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)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
@ -15,20 +14,21 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: mysql_replication
|
module: mysql_replication
|
||||||
|
|
||||||
short_description: Manage MySQL replication
|
short_description: Manage MySQL replication
|
||||||
description:
|
description:
|
||||||
- Manages MySQL server replication, slave, master status get and change master host.
|
- Manages MySQL server replication, slave, master status get and change master host.
|
||||||
version_added: "1.3"
|
version_added: "1.3"
|
||||||
author: "Balazs Pocze (@banyek)"
|
author:
|
||||||
|
- Balazs Pocze (@banyek)
|
||||||
options:
|
options:
|
||||||
mode:
|
mode:
|
||||||
description:
|
description:
|
||||||
- module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave
|
- module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave
|
||||||
(START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL)
|
(START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL)
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- getslave
|
- getslave
|
||||||
- getmaster
|
- getmaster
|
||||||
|
@ -40,59 +40,74 @@ options:
|
||||||
default: getslave
|
default: getslave
|
||||||
master_host:
|
master_host:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_user:
|
master_user:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_password:
|
master_password:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_port:
|
master_port:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: int
|
||||||
master_connect_retry:
|
master_connect_retry:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: int
|
||||||
master_log_file:
|
master_log_file:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_log_pos:
|
master_log_pos:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: int
|
||||||
relay_log_file:
|
relay_log_file:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
relay_log_pos:
|
relay_log_pos:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: int
|
||||||
master_ssl:
|
master_ssl:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
choices: [ 0, 1 ]
|
type: bool
|
||||||
master_ssl_ca:
|
master_ssl_ca:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_ssl_capath:
|
master_ssl_capath:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_ssl_cert:
|
master_ssl_cert:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_ssl_key:
|
master_ssl_key:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_ssl_cipher:
|
master_ssl_cipher:
|
||||||
description:
|
description:
|
||||||
- same as mysql variable
|
- Same as mysql variable.
|
||||||
|
type: str
|
||||||
master_auto_position:
|
master_auto_position:
|
||||||
description:
|
description:
|
||||||
- does the host uses GTID based replication or not
|
- Whether the host uses GTID based replication or not.
|
||||||
|
type: bool
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
|
extends_documentation_fragment:
|
||||||
extends_documentation_fragment: mysql
|
- mysql
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# Stop mysql slave thread
|
# Stop mysql slave thread
|
||||||
- mysql_replication:
|
- mysql_replication:
|
||||||
mode: stopslave
|
mode: stopslave
|
||||||
|
@ -180,33 +195,33 @@ def changemaster(cursor, chm, chm_params):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
login_user=dict(default=None),
|
login_user=dict(type='str'),
|
||||||
login_password=dict(default=None, no_log=True),
|
login_password=dict(type='str', no_log=True),
|
||||||
login_host=dict(default="localhost"),
|
login_host=dict(type='str', default='localhost'),
|
||||||
login_port=dict(default=3306, type='int'),
|
login_port=dict(type='int', default=3306),
|
||||||
login_unix_socket=dict(default=None),
|
login_unix_socket=dict(type='str'),
|
||||||
mode=dict(default="getslave", choices=["getmaster", "getslave", "changemaster", "stopslave", "startslave", "resetslave", "resetslaveall"]),
|
mode=dict(type='str', default='getslave', choices=['getmaster', 'getslave', 'changemaster', 'stopslave', 'startslave', 'resetslave', 'resetslaveall']),
|
||||||
master_auto_position=dict(default=False, type='bool'),
|
master_auto_position=dict(type='bool', default=False),
|
||||||
master_host=dict(default=None),
|
master_host=dict(type='str'),
|
||||||
master_user=dict(default=None),
|
master_user=dict(type='str'),
|
||||||
master_password=dict(default=None, no_log=True),
|
master_password=dict(type='str', no_log=True),
|
||||||
master_port=dict(default=None, type='int'),
|
master_port=dict(type='int'),
|
||||||
master_connect_retry=dict(default=None, type='int'),
|
master_connect_retry=dict(type='int'),
|
||||||
master_log_file=dict(default=None),
|
master_log_file=dict(type='str'),
|
||||||
master_log_pos=dict(default=None, type='int'),
|
master_log_pos=dict(type='int'),
|
||||||
relay_log_file=dict(default=None),
|
relay_log_file=dict(type='str'),
|
||||||
relay_log_pos=dict(default=None, type='int'),
|
relay_log_pos=dict(type='int'),
|
||||||
master_ssl=dict(default=False, type='bool'),
|
master_ssl=dict(type='bool', default=False),
|
||||||
master_ssl_ca=dict(default=None),
|
master_ssl_ca=dict(type='str'),
|
||||||
master_ssl_capath=dict(default=None),
|
master_ssl_capath=dict(type='str'),
|
||||||
master_ssl_cert=dict(default=None),
|
master_ssl_cert=dict(type='str'),
|
||||||
master_ssl_key=dict(default=None),
|
master_ssl_key=dict(type='str'),
|
||||||
master_ssl_cipher=dict(default=None),
|
master_ssl_cipher=dict(type='str'),
|
||||||
connect_timeout=dict(default=30, type='int'),
|
connect_timeout=dict(type='int', default=30),
|
||||||
config_file=dict(default="~/.my.cnf", type='path'),
|
config_file=dict(type='path', default='~/.my.cnf'),
|
||||||
ssl_cert=dict(default=None),
|
ssl_cert=dict(type='path'),
|
||||||
ssl_key=dict(default=None),
|
ssl_key=dict(type='path'),
|
||||||
ssl_ca=dict(default=None),
|
ssl_ca=dict(type='path'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
mode = module.params["mode"]
|
mode = module.params["mode"]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
|
# Copyright: (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
|
||||||
# Sponsored by Four Kitchens http://fourkitchens.com.
|
# Sponsored by Four Kitchens http://fourkitchens.com.
|
||||||
# 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)
|
||||||
|
|
||||||
|
@ -13,38 +14,40 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: mysql_user
|
module: mysql_user
|
||||||
short_description: Adds or removes a user from a MySQL database.
|
short_description: Adds or removes a user from a MySQL database
|
||||||
description:
|
description:
|
||||||
- Adds or removes a user from a MySQL database.
|
- Adds or removes a user from a MySQL database.
|
||||||
version_added: "0.6"
|
version_added: "0.6"
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- name of the user (role) to add or remove
|
- Name of the user (role) to add or remove.
|
||||||
|
type: str
|
||||||
required: true
|
required: true
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- set the user's password.
|
- Set the user's password..
|
||||||
|
type: str
|
||||||
encrypted:
|
encrypted:
|
||||||
description:
|
description:
|
||||||
- Indicate that the 'password' field is a `mysql_native_password` hash
|
- Indicate that the 'password' field is a `mysql_native_password` hash.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
host:
|
host:
|
||||||
description:
|
description:
|
||||||
- the 'host' part of the MySQL username
|
- The 'host' part of the MySQL username.
|
||||||
|
type: str
|
||||||
default: localhost
|
default: localhost
|
||||||
host_all:
|
host_all:
|
||||||
description:
|
description:
|
||||||
- override the host option, making ansible apply changes to
|
- Override the host option, making ansible apply changes to all hostnames for a given user.
|
||||||
all hostnames for a given user. This option cannot be used
|
- This option cannot be used when creating users.
|
||||||
when creating users
|
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
version_added: "2.1"
|
version_added: "2.1"
|
||||||
priv:
|
priv:
|
||||||
description:
|
description:
|
||||||
|
@ -57,37 +60,41 @@ options:
|
||||||
exactly as returned by a C(SHOW GRANT) statement. If not followed,
|
exactly as returned by a C(SHOW GRANT) statement. If not followed,
|
||||||
the module will always report changes. It includes grouping columns
|
the module will always report changes. It includes grouping columns
|
||||||
by permission (C(SELECT(col1,col2)) instead of C(SELECT(col1),SELECT(col2))).
|
by permission (C(SELECT(col1,col2)) instead of C(SELECT(col1),SELECT(col2))).
|
||||||
|
type: str
|
||||||
append_privs:
|
append_privs:
|
||||||
description:
|
description:
|
||||||
- Append the privileges defined by priv to the existing ones for this
|
- Append the privileges defined by priv to the existing ones for this
|
||||||
user instead of overwriting existing ones.
|
user instead of overwriting existing ones.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
version_added: "1.4"
|
version_added: "1.4"
|
||||||
sql_log_bin:
|
sql_log_bin:
|
||||||
description:
|
description:
|
||||||
- Whether binary logging should be enabled or disabled for the connection.
|
- Whether binary logging should be enabled or disabled for the connection.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'yes'
|
default: yes
|
||||||
version_added: "2.1"
|
version_added: "2.1"
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether the user should exist. When C(absent), removes
|
- Whether the user should exist.
|
||||||
the user.
|
- When C(absent), removes the user.
|
||||||
|
type: str
|
||||||
|
choices: [ absent, present ]
|
||||||
default: present
|
default: present
|
||||||
choices: [ "present", "absent" ]
|
|
||||||
check_implicit_admin:
|
check_implicit_admin:
|
||||||
description:
|
description:
|
||||||
- Check if mysql allows login as root/nopassword before trying supplied credentials.
|
- Check if mysql allows login as root/nopassword before trying supplied credentials.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
version_added: "1.3"
|
version_added: "1.3"
|
||||||
update_password:
|
update_password:
|
||||||
default: always
|
|
||||||
choices: ['always', 'on_create']
|
|
||||||
version_added: "2.0"
|
|
||||||
description:
|
description:
|
||||||
- C(always) will update passwords if they differ. C(on_create) will only set the password for newly created users.
|
- C(always) will update passwords if they differ.
|
||||||
|
- C(on_create) will only set the password for newly created users.
|
||||||
|
type: str
|
||||||
|
choices: [ always, on_create ]
|
||||||
|
default: always
|
||||||
|
version_added: "2.0"
|
||||||
notes:
|
notes:
|
||||||
- "MySQL server installs with default login_user of 'root' and no password. To secure this user
|
- "MySQL server installs with default login_user of 'root' and no password. To secure this user
|
||||||
as part of an idempotent playbook, you must create at least two tasks: the first must change the root user's password,
|
as part of an idempotent playbook, you must create at least two tasks: the first must change the root user's password,
|
||||||
|
@ -96,74 +103,76 @@ notes:
|
||||||
the file."
|
the file."
|
||||||
- Currently, there is only support for the `mysql_native_password` encrypted password hash module.
|
- Currently, there is only support for the `mysql_native_password` encrypted password hash module.
|
||||||
|
|
||||||
author: "Jonathan Mainguy (@Jmainguy)"
|
author:
|
||||||
|
- Jonathan Mainguy (@Jmainguy)
|
||||||
extends_documentation_fragment: mysql
|
extends_documentation_fragment: mysql
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r'''
|
||||||
# Removes anonymous user account for localhost
|
- name: Removes anonymous user account for localhost
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: ''
|
name: ''
|
||||||
host: localhost
|
host: localhost
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Removes all anonymous user accounts
|
- name: Removes all anonymous user accounts
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: ''
|
name: ''
|
||||||
host_all: yes
|
host_all: yes
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Create database user with name 'bob' and password '12345' with all database privileges
|
- name: Create database user with name 'bob' and password '12345' with all database privileges
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
password: 12345
|
password: 12345
|
||||||
priv: '*.*:ALL'
|
priv: '*.*:ALL'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Create database user with name 'bob' and previously hashed mysql native password '*EE0D72C1085C46C5278932678FBE2C6A782821B4' with all database privileges
|
- name: Create database user using hashed password with all database privileges
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
password: '*EE0D72C1085C46C5278932678FBE2C6A782821B4'
|
password: '*EE0D72C1085C46C5278932678FBE2C6A782821B4'
|
||||||
encrypted: yes
|
encrypted: yes
|
||||||
priv: '*.*:ALL'
|
priv: '*.*:ALL'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Creates database user 'bob' and password '12345' with all database privileges and 'WITH GRANT OPTION'
|
- name: Create database user with password and all database privileges and 'WITH GRANT OPTION'
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
password: 12345
|
password: 12345
|
||||||
priv: '*.*:ALL,GRANT'
|
priv: '*.*:ALL,GRANT'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Modify user Bob to require SSL connections. Note that REQUIRESSL is a special privilege that should only apply to *.* by itself.
|
# Note that REQUIRESSL is a special privilege that should only apply to *.* by itself.
|
||||||
- mysql_user:
|
- name: Modify user to require SSL connections.
|
||||||
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
append_privs: true
|
append_privs: yes
|
||||||
priv: '*.*:REQUIRESSL'
|
priv: '*.*:REQUIRESSL'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
|
- name: Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials.
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
login_user: root
|
login_user: root
|
||||||
login_password: 123456
|
login_password: 123456
|
||||||
name: sally
|
name: sally
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Ensure no user named 'sally' exists at all
|
- name: Ensure no user named 'sally' exists at all
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: sally
|
name: sally
|
||||||
host_all: yes
|
host_all: yes
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Specify grants composed of more than one word
|
- name: Specify grants composed of more than one word
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: replication
|
name: replication
|
||||||
password: 12345
|
password: 12345
|
||||||
priv: "*.*:REPLICATION CLIENT"
|
priv: "*.*:REPLICATION CLIENT"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Revoke all privileges for user 'bob' and password '12345'
|
- name: Revoke all privileges for user 'bob' and password '12345'
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
password: 12345
|
password: 12345
|
||||||
priv: "*.*:USAGE"
|
priv: "*.*:USAGE"
|
||||||
|
@ -172,14 +181,14 @@ EXAMPLES = """
|
||||||
# Example privileges string format
|
# Example privileges string format
|
||||||
# mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
|
# mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
|
||||||
|
|
||||||
# Example using login_unix_socket to connect to server
|
- name: Example using login_unix_socket to connect to server
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: root
|
name: root
|
||||||
password: abc123
|
password: abc123
|
||||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
# Example of skipping binary logging while adding user 'bob'
|
- name: Example of skipping binary logging while adding user 'bob'
|
||||||
- mysql_user:
|
mysql_user:
|
||||||
name: bob
|
name: bob
|
||||||
password: 12345
|
password: 12345
|
||||||
priv: "*.*:USAGE"
|
priv: "*.*:USAGE"
|
||||||
|
@ -190,11 +199,10 @@ EXAMPLES = """
|
||||||
# [client]
|
# [client]
|
||||||
# user=root
|
# user=root
|
||||||
# password=n<_665{vS43y
|
# password=n<_665{vS43y
|
||||||
"""
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.database import SQLParseError
|
from ansible.module_utils.database import SQLParseError
|
||||||
|
@ -535,29 +543,29 @@ def privileges_grant(cursor, user, host, db_table, priv):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
login_user=dict(default=None),
|
login_user=dict(type='str'),
|
||||||
login_password=dict(default=None, no_log=True),
|
login_password=dict(type='str', no_log=True),
|
||||||
login_host=dict(default="localhost"),
|
login_host=dict(type='str', default='localhost'),
|
||||||
login_port=dict(default=3306, type='int'),
|
login_port=dict(type='int', default=3306),
|
||||||
login_unix_socket=dict(default=None),
|
login_unix_socket=dict(type='str'),
|
||||||
user=dict(required=True, aliases=['name']),
|
user=dict(type='str', required=True, aliases=['name']),
|
||||||
password=dict(default=None, no_log=True, type='str'),
|
password=dict(type='str', no_log=True),
|
||||||
encrypted=dict(default=False, type='bool'),
|
encrypted=dict(type='bool', default=False),
|
||||||
host=dict(default="localhost"),
|
host=dict(type='str', default='localhost'),
|
||||||
host_all=dict(type="bool", default="no"),
|
host_all=dict(type="bool", default=False),
|
||||||
state=dict(default="present", choices=["absent", "present"]),
|
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||||
priv=dict(default=None),
|
priv=dict(type='str'),
|
||||||
append_privs=dict(default=False, type='bool'),
|
append_privs=dict(type='bool', default=False),
|
||||||
check_implicit_admin=dict(default=False, type='bool'),
|
check_implicit_admin=dict(type='bool', default=False),
|
||||||
update_password=dict(default="always", choices=["always", "on_create"]),
|
update_password=dict(type='str', default='always', choices=['always', 'on_create']),
|
||||||
connect_timeout=dict(default=30, type='int'),
|
connect_timeout=dict(type='int', default=30),
|
||||||
config_file=dict(default="~/.my.cnf", type='path'),
|
config_file=dict(type='path', default='~/.my.cnf'),
|
||||||
sql_log_bin=dict(default=True, type='bool'),
|
sql_log_bin=dict(type='bool', default=True),
|
||||||
ssl_cert=dict(default=None, type='path'),
|
ssl_cert=dict(type='path'),
|
||||||
ssl_key=dict(default=None, type='path'),
|
ssl_key=dict(type='path'),
|
||||||
ssl_ca=dict(default=None, type='path'),
|
ssl_ca=dict(type='path'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
login_user = module.params["login_user"]
|
login_user = module.params["login_user"]
|
||||||
login_password = module.params["login_password"]
|
login_password = module.params["login_password"]
|
||||||
|
@ -605,7 +613,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
mode = get_mode(cursor)
|
mode = get_mode(cursor)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=to_native(e))
|
||||||
try:
|
try:
|
||||||
priv = privileges_unpack(priv, mode)
|
priv = privileges_unpack(priv, mode)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -620,14 +628,14 @@ def main():
|
||||||
changed = user_mod(cursor, user, host, host_all, None, encrypted, priv, append_privs, module)
|
changed = user_mod(cursor, user, host, host_all, None, encrypted, priv, append_privs, module)
|
||||||
|
|
||||||
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
|
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=to_native(e))
|
||||||
else:
|
else:
|
||||||
if host_all:
|
if host_all:
|
||||||
module.fail_json(msg="host_all parameter cannot be used when adding a user")
|
module.fail_json(msg="host_all parameter cannot be used when adding a user")
|
||||||
try:
|
try:
|
||||||
changed = user_add(cursor, user, host, host_all, password, encrypted, priv, module.check_mode)
|
changed = user_add(cursor, user, host, host_all, password, encrypted, priv, module.check_mode)
|
||||||
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
|
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=to_native(e))
|
||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
if user_exists(cursor, user, host, host_all):
|
if user_exists(cursor, user, host, host_all):
|
||||||
changed = user_delete(cursor, user, host, host_all, module.check_mode)
|
changed = user_delete(cursor, user, host, host_all, module.check_mode)
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, Balazs Pocze <banyek@gawker.com>
|
# Copyright: (c) 2013, Balazs Pocze <banyek@gawker.com>
|
||||||
# Certain parts are taken from Mark Theunissen's mysqldb module
|
# Certain parts are taken from Mark Theunissen's mysqldb 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)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: mysql_variables
|
module: mysql_variables
|
||||||
|
|
||||||
short_description: Manage MySQL global variables
|
short_description: Manage MySQL global variables
|
||||||
description:
|
description:
|
||||||
- Query / Set MySQL variables
|
- Query / Set MySQL variables.
|
||||||
version_added: 1.3
|
version_added: 1.3
|
||||||
author: "Balazs Pocze (@banyek)"
|
author:
|
||||||
|
- Balazs Pocze (@banyek)
|
||||||
options:
|
options:
|
||||||
variable:
|
variable:
|
||||||
description:
|
description:
|
||||||
- Variable name to operate
|
- Variable name to operate
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
value:
|
value:
|
||||||
description:
|
description:
|
||||||
- If set, then sets variable value to this
|
- If set, then sets variable value to this
|
||||||
required: False
|
type: str
|
||||||
extends_documentation_fragment: mysql
|
extends_documentation_fragment:
|
||||||
|
- mysql
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# Check for sync_binlog setting
|
- name: Check for sync_binlog setting
|
||||||
- mysql_variables:
|
- mysql_variables:
|
||||||
variable: sync_binlog
|
variable: sync_binlog
|
||||||
|
|
||||||
# Set read_only variable to 1
|
- name: Set read_only variable to 1
|
||||||
- mysql_variables:
|
- mysql_variables:
|
||||||
variable: read_only
|
variable: read_only
|
||||||
value: 1
|
value: 1
|
||||||
|
@ -112,19 +112,19 @@ def setvariable(cursor, mysqlvar, value):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
login_user=dict(default=None),
|
login_user=dict(type='str'),
|
||||||
login_password=dict(default=None, no_log=True),
|
login_password=dict(type='str', no_log=True),
|
||||||
login_host=dict(default="localhost"),
|
login_host=dict(type='str', default='localhost'),
|
||||||
login_port=dict(default=3306, type='int'),
|
login_port=dict(type='int', default=3306),
|
||||||
login_unix_socket=dict(default=None),
|
login_unix_socket=dict(type='str'),
|
||||||
variable=dict(default=None),
|
variable=dict(type='str'),
|
||||||
value=dict(default=None),
|
value=dict(type='str'),
|
||||||
ssl_cert=dict(default=None),
|
ssl_cert=dict(type='path'),
|
||||||
ssl_key=dict(default=None),
|
ssl_key=dict(type='path'),
|
||||||
ssl_ca=dict(default=None),
|
ssl_ca=dict(type='path'),
|
||||||
connect_timeout=dict(default=30, type='int'),
|
connect_timeout=dict(type='int', default=30),
|
||||||
config_file=dict(default="~/.my.cnf", type="path")
|
config_file=dict(type='path', default='~/.my.cnf'),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
user = module.params["login_user"]
|
user = module.params["login_user"]
|
||||||
password = module.params["login_password"]
|
password = module.params["login_password"]
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright: Ansible Project
|
# Copyright: Ansible Project
|
||||||
# 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)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: postgresql_db
|
module: postgresql_db
|
||||||
short_description: Add or remove PostgreSQL databases from a remote host.
|
short_description: Add or remove PostgreSQL databases from a remote host.
|
||||||
|
@ -23,87 +22,100 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- name of the database to add or remove
|
- name of the database to add or remove
|
||||||
|
type: str
|
||||||
required: true
|
required: true
|
||||||
aliases: [ db ]
|
aliases: [ db ]
|
||||||
owner:
|
owner:
|
||||||
description:
|
description:
|
||||||
- Name of the role to set as owner of the database
|
- Name of the role to set as owner of the database
|
||||||
|
type: str
|
||||||
template:
|
template:
|
||||||
description:
|
description:
|
||||||
- Template used to create the database
|
- Template used to create the database
|
||||||
|
type: str
|
||||||
encoding:
|
encoding:
|
||||||
description:
|
description:
|
||||||
- Encoding of the database
|
- Encoding of the database
|
||||||
|
type: str
|
||||||
lc_collate:
|
lc_collate:
|
||||||
description:
|
description:
|
||||||
- Collation order (LC_COLLATE) to use in the database. Must match collation order of template database unless C(template0) is used as template.
|
- Collation order (LC_COLLATE) to use in the database. Must match collation order of template database unless C(template0) is used as template.
|
||||||
|
type: str
|
||||||
lc_ctype:
|
lc_ctype:
|
||||||
description:
|
description:
|
||||||
- Character classification (LC_CTYPE) to use in the database (e.g. lower, upper, ...) Must match LC_CTYPE of template database unless C(template0)
|
- Character classification (LC_CTYPE) to use in the database (e.g. lower, upper, ...) Must match LC_CTYPE of template database unless C(template0)
|
||||||
is used as template.
|
is used as template.
|
||||||
|
type: str
|
||||||
session_role:
|
session_role:
|
||||||
|
description:
|
||||||
|
- Switch to session_role after connecting. The specified session_role must be a role that the current login_user is a member of.
|
||||||
|
- Permissions checking for SQL commands is carried out as though the session_role were the one that had logged in originally.
|
||||||
|
type: str
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
description: |
|
|
||||||
Switch to session_role after connecting. The specified session_role must be a role that the current login_user is a member of.
|
|
||||||
Permissions checking for SQL commands is carried out as though the session_role were the one that had logged in originally.
|
|
||||||
state:
|
state:
|
||||||
description: |
|
description:
|
||||||
The database state. present implies that the database should be created if necessary.
|
- The database state.
|
||||||
absent implies that the database should be removed if present.
|
- C(present) implies that the database should be created if necessary.
|
||||||
dump requires a target definition to which the database will be backed up.
|
- C(absent) implies that the database should be removed if present.
|
||||||
(Added in 2.4) restore also requires a target definition from which the database will be restored.
|
- C(dump) requires a target definition to which the database will be backed up. (Added in Ansible 2.4)
|
||||||
(Added in 2.4) The format of the backup will be detected based on the target name.
|
- C(restore) also requires a target definition from which the database will be restored. (Added in Ansible 2.4)
|
||||||
Supported compression formats for dump and restore are: .bz2, .gz, and .xz
|
- The format of the backup will be detected based on the target name.
|
||||||
Supported formats for dump and restore are: .sql and .tar
|
- Supported compression formats for dump and restore include C(.bz2), C(.gz) and C(.xz)
|
||||||
|
- Supported formats for dump and restore include C(.sql) and C(.tar)
|
||||||
|
type: str
|
||||||
|
choices: [ absent, dump, present, restore ]
|
||||||
default: present
|
default: present
|
||||||
choices: [ "present", "absent", "dump", "restore" ]
|
|
||||||
target:
|
target:
|
||||||
version_added: "2.4"
|
|
||||||
description:
|
description:
|
||||||
- File to back up or restore from. Used when state is "dump" or "restore"
|
- File to back up or restore from.
|
||||||
|
- Used when I(state) is C(dump) or C(restore).
|
||||||
|
type: path
|
||||||
|
version_added: "2.4"
|
||||||
target_opts:
|
target_opts:
|
||||||
version_added: "2.4"
|
|
||||||
description:
|
description:
|
||||||
- Further arguments for pg_dump or pg_restore. Used when state is "dump" or "restore"
|
- Further arguments for pg_dump or pg_restore.
|
||||||
|
- Used when I(state) is C(dump) or C(restore).
|
||||||
|
type: str
|
||||||
|
version_added: "2.4"
|
||||||
maintenance_db:
|
maintenance_db:
|
||||||
version_added: "2.5"
|
|
||||||
description:
|
description:
|
||||||
- The value specifies the initial database (which is also called as maintenance DB) that Ansible connects to.
|
- The value specifies the initial database (which is also called as maintenance DB) that Ansible connects to.
|
||||||
|
type: str
|
||||||
default: postgres
|
default: postgres
|
||||||
|
version_added: "2.5"
|
||||||
author: "Ansible Core Team"
|
author: "Ansible Core Team"
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- postgres
|
- postgres
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# Create a new database with name "acme"
|
- name: Create a new database with name "acme"
|
||||||
- postgresql_db:
|
postgresql_db:
|
||||||
name: acme
|
name: acme
|
||||||
|
|
||||||
# Create a new database with name "acme" and specific encoding and locale
|
# Note: If a template different from "template0" is specified, encoding and locale settings must match those of the template.
|
||||||
# settings. If a template different from "template0" is specified, encoding
|
- name: Create a new database with name "acme" and specific encoding and locale # settings.
|
||||||
# and locale settings must match those of the template.
|
postgresql_db:
|
||||||
- postgresql_db:
|
|
||||||
name: acme
|
name: acme
|
||||||
encoding: UTF-8
|
encoding: UTF-8
|
||||||
lc_collate: de_DE.UTF-8
|
lc_collate: de_DE.UTF-8
|
||||||
lc_ctype: de_DE.UTF-8
|
lc_ctype: de_DE.UTF-8
|
||||||
template: template0
|
template: template0
|
||||||
|
|
||||||
# Dump an existing database to a file
|
- name: Dump an existing database to a file
|
||||||
- postgresql_db:
|
postgresql_db:
|
||||||
name: acme
|
name: acme
|
||||||
state: dump
|
state: dump
|
||||||
target: /tmp/acme.sql
|
target: /tmp/acme.sql
|
||||||
|
|
||||||
# Dump an existing database to a file (with compression)
|
- name: Dump an existing database to a file (with compression)
|
||||||
- postgresql_db:
|
postgresql_db:
|
||||||
name: acme
|
name: acme
|
||||||
state: dump
|
state: dump
|
||||||
target: /tmp/acme.sql.gz
|
target: /tmp/acme.sql.gz
|
||||||
|
|
||||||
# Dump a single schema for an existing database
|
- name: Dump a single schema for an existing database
|
||||||
- postgresql_db:
|
postgresql_db:
|
||||||
name: acme
|
name: acme
|
||||||
state: dump
|
state: dump
|
||||||
target: /tmp/acme.sql
|
target: /tmp/acme.sql
|
||||||
|
@ -366,19 +378,19 @@ def do_with_password(module, cmd, password):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = pgutils.postgres_common_argument_spec()
|
argument_spec = pgutils.postgres_common_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(
|
||||||
db=dict(required=True, aliases=['name']),
|
db=dict(type='str', required=True, aliases=['name']),
|
||||||
owner=dict(default=""),
|
owner=dict(type='str', default=''),
|
||||||
template=dict(default=""),
|
template=dict(type='str', default=''),
|
||||||
encoding=dict(default=""),
|
encoding=dict(type='str', default=''),
|
||||||
lc_collate=dict(default=""),
|
lc_collate=dict(type='str', default=''),
|
||||||
lc_ctype=dict(default=""),
|
lc_ctype=dict(type='str', default=''),
|
||||||
state=dict(default="present", choices=["absent", "present", "dump", "restore"]),
|
state=dict(type='str', default='present', choices=['absent', 'dump', 'present', 'restore']),
|
||||||
target=dict(default="", type="path"),
|
target=dict(type='path', default=''),
|
||||||
target_opts=dict(default=""),
|
target_opts=dict(type='str', default=''),
|
||||||
maintenance_db=dict(default="postgres"),
|
maintenance_db=dict(type='str', default="postgres"),
|
||||||
session_role=dict(),
|
session_role=dict(type='str'),
|
||||||
))
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
|
|
@ -159,6 +159,17 @@ options:
|
||||||
type: bool
|
type: bool
|
||||||
default: no
|
default: no
|
||||||
version_added: '2.7'
|
version_added: '2.7'
|
||||||
|
force:
|
||||||
|
description:
|
||||||
|
- If C(yes) do not get a cached copy.
|
||||||
|
type: bool
|
||||||
|
default: no
|
||||||
|
aliases: [ thirsty ]
|
||||||
|
use_proxy:
|
||||||
|
description:
|
||||||
|
- If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts.
|
||||||
|
type: bool
|
||||||
|
default: yes
|
||||||
notes:
|
notes:
|
||||||
- The dependency on httplib2 was removed in Ansible 2.1.
|
- The dependency on httplib2 was removed in Ansible 2.1.
|
||||||
- The module returns all the HTTP headers in lower-case.
|
- The module returns all the HTTP headers in lower-case.
|
||||||
|
@ -489,7 +500,7 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = url_argument_spec()
|
argument_spec = url_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(
|
||||||
dest=dict(type='path'),
|
dest=dict(type='path'),
|
||||||
url_username=dict(type='str', aliases=['user']),
|
url_username=dict(type='str', aliases=['user']),
|
||||||
url_password=dict(type='str', aliases=['password'], no_log=True),
|
url_password=dict(type='str', aliases=['password'], no_log=True),
|
||||||
|
@ -503,8 +514,8 @@ def main():
|
||||||
removes=dict(type='path'),
|
removes=dict(type='path'),
|
||||||
status_code=dict(type='list', default=[200]),
|
status_code=dict(type='list', default=[200]),
|
||||||
timeout=dict(type='int', default=30),
|
timeout=dict(type='int', default=30),
|
||||||
headers=dict(type='dict', default={})
|
headers=dict(type='dict', default={}),
|
||||||
))
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
|
|
@ -24,28 +24,35 @@ options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Create or modify an organization.
|
- Create or modify an organization.
|
||||||
|
type: str
|
||||||
|
choices: [ present, query ]
|
||||||
default: present
|
default: present
|
||||||
choices: [present, query]
|
|
||||||
org_name:
|
org_name:
|
||||||
description:
|
description:
|
||||||
- Name of organization.
|
- Name of organization.
|
||||||
|
type: str
|
||||||
org_id:
|
org_id:
|
||||||
description:
|
description:
|
||||||
- ID of organization.
|
- ID of organization.
|
||||||
|
type: int
|
||||||
net_name:
|
net_name:
|
||||||
description:
|
description:
|
||||||
- Name of network containing access points.
|
- Name of network containing access points.
|
||||||
|
type: str
|
||||||
net_id:
|
net_id:
|
||||||
description:
|
description:
|
||||||
- ID of network containing access points.
|
- ID of network containing access points.
|
||||||
|
type: str
|
||||||
number:
|
number:
|
||||||
description:
|
description:
|
||||||
- Number of SSID to apply firewall rule to.
|
- Number of SSID to apply firewall rule to.
|
||||||
aliases: [ssid_number]
|
type: int
|
||||||
|
aliases: [ ssid_number ]
|
||||||
ssid_name:
|
ssid_name:
|
||||||
description:
|
description:
|
||||||
- Name of SSID to apply firewall rule to.
|
- Name of SSID to apply firewall rule to.
|
||||||
aliases: [ssid]
|
type: str
|
||||||
|
aliases: [ ssid ]
|
||||||
allow_lan_access:
|
allow_lan_access:
|
||||||
description:
|
description:
|
||||||
- Sets whether devices can talk to other devices on the same LAN.
|
- Sets whether devices can talk to other devices on the same LAN.
|
||||||
|
@ -54,24 +61,30 @@ options:
|
||||||
rules:
|
rules:
|
||||||
description:
|
description:
|
||||||
- List of firewall rules.
|
- List of firewall rules.
|
||||||
|
type: list
|
||||||
suboptions:
|
suboptions:
|
||||||
policy:
|
policy:
|
||||||
description:
|
description:
|
||||||
- Specifies the action that should be taken when rule is hit.
|
- Specifies the action that should be taken when rule is hit.
|
||||||
choices: [allow, deny]
|
type: str
|
||||||
|
choices: [ allow, deny ]
|
||||||
protocol:
|
protocol:
|
||||||
description:
|
description:
|
||||||
- Specifies protocol to match against.
|
- Specifies protocol to match against.
|
||||||
choices: [any, icmp, tcp, udp]
|
type: str
|
||||||
|
choices: [ any, icmp, tcp, udp ]
|
||||||
dest_port:
|
dest_port:
|
||||||
description:
|
description:
|
||||||
- Comma separated list of destination ports to match.
|
- Comma-seperated list of destination ports to match.
|
||||||
|
type: str
|
||||||
dest_cidr:
|
dest_cidr:
|
||||||
description:
|
description:
|
||||||
- Comma separated list of CIDR notation networks to match.
|
- Comma-separated list of CIDR notation networks to match.
|
||||||
|
type: str
|
||||||
comment:
|
comment:
|
||||||
description:
|
description:
|
||||||
- Optional comment describing the firewall rule.
|
- Optional comment describing the firewall rule.
|
||||||
|
type: str
|
||||||
author:
|
author:
|
||||||
- Kevin Breit (@kbreit)
|
- Kevin Breit (@kbreit)
|
||||||
extends_documentation_fragment: meraki
|
extends_documentation_fragment: meraki
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
# -*- coding: utf-8 -*-
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# 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': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'network'}
|
'supported_by': 'network'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
---
|
||||||
module: nxos_pim_interface
|
module: nxos_pim_interface
|
||||||
extends_documentation_fragment: nxos
|
extends_documentation_fragment: nxos
|
||||||
|
@ -47,82 +33,92 @@ options:
|
||||||
interface:
|
interface:
|
||||||
description:
|
description:
|
||||||
- Full name of the interface such as Ethernet1/33.
|
- Full name of the interface such as Ethernet1/33.
|
||||||
|
type: str
|
||||||
required: true
|
required: true
|
||||||
sparse:
|
sparse:
|
||||||
description:
|
description:
|
||||||
- Enable/disable sparse-mode on the interface.
|
- Enable/disable sparse-mode on the interface.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
dr_prio:
|
dr_prio:
|
||||||
description:
|
description:
|
||||||
- Configures priority for PIM DR election on interface.
|
- Configures priority for PIM DR election on interface.
|
||||||
|
type: str
|
||||||
hello_auth_key:
|
hello_auth_key:
|
||||||
description:
|
description:
|
||||||
- Authentication for hellos on this interface.
|
- Authentication for hellos on this interface.
|
||||||
|
type: str
|
||||||
hello_interval:
|
hello_interval:
|
||||||
description:
|
description:
|
||||||
- Hello interval in milliseconds for this interface.
|
- Hello interval in milliseconds for this interface.
|
||||||
type: bool
|
type: int
|
||||||
jp_policy_out:
|
jp_policy_out:
|
||||||
description:
|
description:
|
||||||
- Policy for join-prune messages (outbound).
|
- Policy for join-prune messages (outbound).
|
||||||
|
type: str
|
||||||
jp_policy_in:
|
jp_policy_in:
|
||||||
description:
|
description:
|
||||||
- Policy for join-prune messages (inbound).
|
- Policy for join-prune messages (inbound).
|
||||||
|
type: str
|
||||||
jp_type_out:
|
jp_type_out:
|
||||||
description:
|
description:
|
||||||
- Type of policy mapped to C(jp_policy_out).
|
- Type of policy mapped to C(jp_policy_out).
|
||||||
choices: ['prefix', 'routemap']
|
type: str
|
||||||
|
choices: [ prefix, routemap ]
|
||||||
jp_type_in:
|
jp_type_in:
|
||||||
description:
|
description:
|
||||||
- Type of policy mapped to C(jp_policy_in).
|
- Type of policy mapped to C(jp_policy_in).
|
||||||
choices: ['prefix', 'routemap']
|
type: str
|
||||||
|
choices: [ prefix, routemap ]
|
||||||
border:
|
border:
|
||||||
description:
|
description:
|
||||||
- Configures interface to be a boundary of a PIM domain.
|
- Configures interface to be a boundary of a PIM domain.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: no
|
||||||
neighbor_policy:
|
neighbor_policy:
|
||||||
description:
|
description:
|
||||||
- Configures a neighbor policy for filtering adjacencies.
|
- Configures a neighbor policy for filtering adjacencies.
|
||||||
|
type: str
|
||||||
neighbor_type:
|
neighbor_type:
|
||||||
description:
|
description:
|
||||||
- Type of policy mapped to neighbor_policy.
|
- Type of policy mapped to neighbor_policy.
|
||||||
choices: ['prefix', 'routemap']
|
type: str
|
||||||
|
choices: [ prefix, routemap ]
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Manages desired state of the resource.
|
- Manages desired state of the resource.
|
||||||
|
type: str
|
||||||
|
choices: [ present, default ]
|
||||||
default: present
|
default: present
|
||||||
choices: ['present', 'default']
|
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# ensure PIM is not running on the interface
|
- name: Ensure PIM is not running on the interface
|
||||||
- nxos_pim_interface:
|
nxos_pim_interface:
|
||||||
interface: eth1/33
|
interface: eth1/33
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# ensure the interface has pim-sm enabled with the appropriate priority and hello interval
|
- name: Ensure the interface has pim-sm enabled with the appropriate priority and hello interval
|
||||||
- nxos_pim_interface:
|
nxos_pim_interface:
|
||||||
interface: eth1/33
|
interface: eth1/33
|
||||||
dr_prio: 10
|
dr_prio: 10
|
||||||
hello_interval: 40
|
hello_interval: 40
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# ensure join-prune policies exist
|
- name: Ensure join-prune policies exist
|
||||||
- nxos_pim_interface:
|
nxos_pim_interface:
|
||||||
interface: eth1/33
|
interface: eth1/33
|
||||||
jp_policy_in: JPIN
|
jp_policy_in: JPIN
|
||||||
jp_policy_out: JPOUT
|
jp_policy_out: JPOUT
|
||||||
jp_type_in: routemap
|
jp_type_in: routemap
|
||||||
jp_type_out: routemap
|
jp_type_out: routemap
|
||||||
|
|
||||||
# ensure defaults are in place
|
- name: Ensure defaults are in place
|
||||||
- nxos_pim_interface:
|
nxos_pim_interface:
|
||||||
interface: eth1/33
|
interface: eth1/33
|
||||||
state: default
|
state: default
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = r'''
|
||||||
commands:
|
commands:
|
||||||
description: command sent to the device
|
description: command sent to the device
|
||||||
returned: always
|
returned: always
|
||||||
|
@ -436,19 +432,19 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
interface=dict(required=True),
|
interface=dict(type='str', required=True),
|
||||||
sparse=dict(type='bool', default=False),
|
sparse=dict(type='bool', default=False),
|
||||||
dr_prio=dict(type='str'),
|
dr_prio=dict(type='str'),
|
||||||
hello_auth_key=dict(type='str'),
|
hello_auth_key=dict(type='str'),
|
||||||
hello_interval=dict(type='int'),
|
hello_interval=dict(type='int'),
|
||||||
jp_policy_out=dict(type='str'),
|
jp_policy_out=dict(type='str'),
|
||||||
jp_policy_in=dict(type='str'),
|
jp_policy_in=dict(type='str'),
|
||||||
jp_type_out=dict(choices=['prefix', 'routemap']),
|
jp_type_out=dict(type='str', choices=['prefix', 'routemap']),
|
||||||
jp_type_in=dict(choices=['prefix', 'routemap']),
|
jp_type_in=dict(type='str', choices=['prefix', 'routemap']),
|
||||||
border=dict(type='bool', default=False),
|
border=dict(type='bool', default=False),
|
||||||
neighbor_policy=dict(type='str'),
|
neighbor_policy=dict(type='str'),
|
||||||
neighbor_type=dict(choices=['prefix', 'routemap']),
|
neighbor_type=dict(type='str', choices=['prefix', 'routemap']),
|
||||||
state=dict(choices=['present', 'absent', 'default'], default='present'),
|
state=dict(type='str', default='present', choices=['absent', 'default', 'present']),
|
||||||
)
|
)
|
||||||
argument_spec.update(nxos_argument_spec)
|
argument_spec.update(nxos_argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2019, NetApp, Inc
|
# Copyright: (c) 2019, NetApp, Inc
|
||||||
# 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)
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
@ -10,64 +11,65 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'supported_by': 'certified'}
|
'supported_by': 'certified'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
author: NetApp Ansible Team (@carchi8py) (ng-ansibleteam@netapp.com)
|
module: na_ontap_nvme
|
||||||
|
short_description: NetApp ONTAP Manage NVMe Service
|
||||||
description:
|
description:
|
||||||
- Create/Delete NVMe Service
|
- Create/Delete NVMe Service
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- netapp.na_ontap
|
- netapp.na_ontap
|
||||||
module: na_ontap_nvme
|
author:
|
||||||
|
- NetApp Ansible Team (@carchi8py) (ng-ansibleteam@netapp.com)
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
choices: ['present', 'absent']
|
|
||||||
description:
|
description:
|
||||||
- Whether the specified NVMe should exist or not.
|
- Whether the specified NVMe should exist or not.
|
||||||
|
type: str
|
||||||
|
choices: [ absent, present ]
|
||||||
default: present
|
default: present
|
||||||
vserver:
|
vserver:
|
||||||
description:
|
description:
|
||||||
- Name of the vserver to use.
|
- Name of the vserver to use.
|
||||||
|
type: str
|
||||||
required: true
|
required: true
|
||||||
status_admin:
|
status_admin:
|
||||||
description:
|
description:
|
||||||
- Whether the status of NVMe should be up or down
|
- Whether the status of NVMe should be up or down.
|
||||||
type: bool
|
type: bool
|
||||||
short_description: "NetApp ONTAP Manage NVMe Service"
|
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r'''
|
||||||
|
- name: Create NVMe
|
||||||
|
na_ontap_nvme:
|
||||||
|
hostname: '{{ hostname }}'
|
||||||
|
username: '{{ username }}'
|
||||||
|
password: '{{ password }}'
|
||||||
|
vserver: '{{ vserver }}'
|
||||||
|
status_admin: no
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Create NVMe
|
- name: Modify NVMe
|
||||||
na_ontap_nvme:
|
na_ontap_nvme:
|
||||||
state: present
|
vserver: '{{ vserver }}'
|
||||||
status_admin: False
|
hostname: '{{ hostname }}'
|
||||||
vserver: "{{ vserver }}"
|
username: '{{ username }}'
|
||||||
hostname: "{{ hostname }}"
|
password: '{{ password }}'
|
||||||
username: "{{ username }}"
|
status_admin: yes
|
||||||
password: "{{ password }}"
|
state: present
|
||||||
|
|
||||||
- name: Modify NVMe
|
- name: Delete NVMe
|
||||||
na_ontap_nvme:
|
na_ontap_nvme:
|
||||||
state: present
|
hostname: '{{ hostname }}'
|
||||||
status_admin: True
|
username: '{{ username }}'
|
||||||
vserver: "{{ vserver }}"
|
password: '{{ password }}'
|
||||||
hostname: "{{ hostname }}"
|
vserver: '{{ vserver }}'
|
||||||
username: "{{ username }}"
|
state: absent
|
||||||
password: "{{ password }}"
|
'''
|
||||||
|
|
||||||
- name: Delete NVMe
|
RETURN = r'''
|
||||||
na_ontap_nvme:
|
'''
|
||||||
state: absent
|
|
||||||
vserver: "{{ vserver }}"
|
|
||||||
hostname: "{{ hostname }}"
|
|
||||||
username: "{{ username }}"
|
|
||||||
password: "{{ password }}"
|
|
||||||
"""
|
|
||||||
|
|
||||||
RETURN = """
|
|
||||||
"""
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
import ansible.module_utils.netapp as netapp_utils
|
import ansible.module_utils.netapp as netapp_utils
|
||||||
|
@ -84,15 +86,15 @@ class NetAppONTAPNVMe(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
|
self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
|
||||||
self.argument_spec.update(dict(
|
self.argument_spec.update(
|
||||||
state=dict(required=False, type='str', choices=['present', 'absent'], default='present'),
|
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||||
vserver=dict(required=True, type='str'),
|
vserver=dict(type='str', required=True),
|
||||||
status_admin=dict(required=False, type=bool)
|
status_admin=dict(type='bool'),
|
||||||
))
|
)
|
||||||
|
|
||||||
self.module = AnsibleModule(
|
self.module = AnsibleModule(
|
||||||
argument_spec=self.argument_spec,
|
argument_spec=self.argument_spec,
|
||||||
supports_check_mode=True
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.na_helper = NetAppModule()
|
self.na_helper = NetAppModule()
|
||||||
|
@ -120,8 +122,7 @@ class NetAppONTAPNVMe(object):
|
||||||
try:
|
try:
|
||||||
result = self.server.invoke_successfully(nvme_get, enable_tunneling=False)
|
result = self.server.invoke_successfully(nvme_get, enable_tunneling=False)
|
||||||
except netapp_utils.zapi.NaApiError as error:
|
except netapp_utils.zapi.NaApiError as error:
|
||||||
self.module.fail_json(msg='Error fetching nvme info: %s' % to_native(error),
|
self.module.fail_json(msg='Error fetching nvme info: %s' % to_native(error))
|
||||||
exception=traceback.format_exc())
|
|
||||||
if result.get_child_by_name('num-records') and int(result.get_child_content('num-records')) >= 1:
|
if result.get_child_by_name('num-records') and int(result.get_child_content('num-records')) >= 1:
|
||||||
attributes_list = result.get_child_by_name('attributes-list')
|
attributes_list = result.get_child_by_name('attributes-list')
|
||||||
nvme_info = attributes_list.get_child_by_name('nvme-target-service-info')
|
nvme_info = attributes_list.get_child_by_name('nvme-target-service-info')
|
||||||
|
@ -141,8 +142,7 @@ class NetAppONTAPNVMe(object):
|
||||||
self.server.invoke_successfully(nvme_create, enable_tunneling=True)
|
self.server.invoke_successfully(nvme_create, enable_tunneling=True)
|
||||||
except netapp_utils.zapi.NaApiError as error:
|
except netapp_utils.zapi.NaApiError as error:
|
||||||
self.module.fail_json(msg='Error creating nvme for vserver %s: %s'
|
self.module.fail_json(msg='Error creating nvme for vserver %s: %s'
|
||||||
% (self.parameters['vserver'], to_native(error)),
|
% (self.parameters['vserver'], to_native(error)))
|
||||||
exception=traceback.format_exc())
|
|
||||||
|
|
||||||
def delete_nvme(self):
|
def delete_nvme(self):
|
||||||
"""
|
"""
|
||||||
|
@ -153,8 +153,7 @@ class NetAppONTAPNVMe(object):
|
||||||
self.server.invoke_successfully(nvme_delete, enable_tunneling=True)
|
self.server.invoke_successfully(nvme_delete, enable_tunneling=True)
|
||||||
except netapp_utils.zapi.NaApiError as error:
|
except netapp_utils.zapi.NaApiError as error:
|
||||||
self.module.fail_json(msg='Error deleting nvme for vserver %s: %s'
|
self.module.fail_json(msg='Error deleting nvme for vserver %s: %s'
|
||||||
% (self.parameters['vserver'], to_native(error)),
|
% (self.parameters['vserver'], to_native(error)))
|
||||||
exception=traceback.format_exc())
|
|
||||||
|
|
||||||
def modify_nvme(self, status=None):
|
def modify_nvme(self, status=None):
|
||||||
"""
|
"""
|
||||||
|
@ -169,8 +168,7 @@ class NetAppONTAPNVMe(object):
|
||||||
self.server.invoke_successfully(nvme_modify, enable_tunneling=True)
|
self.server.invoke_successfully(nvme_modify, enable_tunneling=True)
|
||||||
except netapp_utils.zapi.NaApiError as error:
|
except netapp_utils.zapi.NaApiError as error:
|
||||||
self.module.fail_json(msg='Error modifying nvme for vserver %s: %s'
|
self.module.fail_json(msg='Error modifying nvme for vserver %s: %s'
|
||||||
% (self.parameters['vserver'], to_native(error)),
|
% (self.parameters['vserver'], to_native(error)))
|
||||||
exception=traceback.format_exc())
|
|
||||||
|
|
||||||
def apply(self):
|
def apply(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -43,13 +43,13 @@ options:
|
||||||
avi_credentials:
|
avi_credentials:
|
||||||
description:
|
description:
|
||||||
- Avi Credentials dictionary which can be used in lieu of enumerating Avi Controller login details.
|
- Avi Credentials dictionary which can be used in lieu of enumerating Avi Controller login details.
|
||||||
type: str
|
type: dict
|
||||||
version_added: "2.5"
|
version_added: "2.5"
|
||||||
api_context:
|
api_context:
|
||||||
description:
|
description:
|
||||||
- Avi API context that includes current session ID and CSRF Token.
|
- Avi API context that includes current session ID and CSRF Token.
|
||||||
- This allows user to perform single login and re-use the session.
|
- This allows user to perform single login and re-use the session.
|
||||||
type: str
|
type: dict
|
||||||
version_added: "2.5"
|
version_added: "2.5"
|
||||||
notes:
|
notes:
|
||||||
- For more information on using Ansible to manage Avi Network devices see U(https://www.ansible.com/ansible-avi-networks).
|
- For more information on using Ansible to manage Avi Network devices see U(https://www.ansible.com/ansible-avi-networks).
|
||||||
|
|
|
@ -15,7 +15,7 @@ options:
|
||||||
- Dictionary of string:string pairs to assign as metadata to the object.
|
- Dictionary of string:string pairs to assign as metadata to the object.
|
||||||
- Metadata tags on the object will be updated with any provided values.
|
- Metadata tags on the object will be updated with any provided values.
|
||||||
- To remove tags set append_tags option to false.
|
- To remove tags set append_tags option to false.
|
||||||
type: str
|
type: dict
|
||||||
append_tags:
|
append_tags:
|
||||||
description:
|
description:
|
||||||
- Use to control if tags field is canonical or just appends to existing tags.
|
- Use to control if tags field is canonical or just appends to existing tags.
|
||||||
|
|
|
@ -15,7 +15,7 @@ options:
|
||||||
template file and each response from the device are saved here.
|
template file and each response from the device are saved here.
|
||||||
Usually the location is the results folder, but you can
|
Usually the location is the results folder, but you can
|
||||||
choose another location based on your write permission.
|
choose another location based on your write permission.
|
||||||
type: path
|
type: str
|
||||||
required: true
|
required: true
|
||||||
version_added: '2.3'
|
version_added: '2.3'
|
||||||
host:
|
host:
|
||||||
|
|
|
@ -72,6 +72,6 @@ options:
|
||||||
proxies:
|
proxies:
|
||||||
description:
|
description:
|
||||||
- HTTP(S) proxy to use for Requests to connect to InfluxDB server.
|
- HTTP(S) proxy to use for Requests to connect to InfluxDB server.
|
||||||
type: str
|
type: dict
|
||||||
version_added: "2.5"
|
version_added: "2.5"
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -55,5 +55,5 @@ options:
|
||||||
org_id:
|
org_id:
|
||||||
description:
|
description:
|
||||||
- ID of organization.
|
- ID of organization.
|
||||||
type: str
|
type: int
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -25,7 +25,7 @@ options:
|
||||||
login_port:
|
login_port:
|
||||||
description:
|
description:
|
||||||
- Port of the MySQL server. Requires I(login_host) be defined as other than localhost if login_port is used.
|
- Port of the MySQL server. Requires I(login_host) be defined as other than localhost if login_port is used.
|
||||||
type: str
|
type: int
|
||||||
default: 3306
|
default: 3306
|
||||||
login_unix_socket:
|
login_unix_socket:
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -42,7 +42,7 @@ options:
|
||||||
nitro_timeout:
|
nitro_timeout:
|
||||||
description:
|
description:
|
||||||
- Time in seconds until a timeout error is thrown when establishing a new session with Netscaler
|
- Time in seconds until a timeout error is thrown when establishing a new session with Netscaler
|
||||||
type: int
|
type: float
|
||||||
default: 310
|
default: 310
|
||||||
|
|
||||||
state:
|
state:
|
||||||
|
|
|
@ -18,7 +18,7 @@ options:
|
||||||
or if OpenStack OS_* environment variables are present.
|
or if OpenStack OS_* environment variables are present.
|
||||||
If I(cloud) is a dict, it contains a complete cloud configuration like
|
If I(cloud) is a dict, it contains a complete cloud configuration like
|
||||||
would be in a section of clouds.yaml.
|
would be in a section of clouds.yaml.
|
||||||
type: str
|
type: raw
|
||||||
auth:
|
auth:
|
||||||
description:
|
description:
|
||||||
- Dictionary containing auth information as needed by the cloud's auth
|
- Dictionary containing auth information as needed by the cloud's auth
|
||||||
|
@ -28,7 +28,7 @@ options:
|
||||||
this param will need to contain whatever parameters that auth plugin
|
this param will need to contain whatever parameters that auth plugin
|
||||||
requires. This parameter is not needed if a named cloud is provided or
|
requires. This parameter is not needed if a named cloud is provided or
|
||||||
OpenStack OS_* environment variables are present.
|
OpenStack OS_* environment variables are present.
|
||||||
type: str
|
type: dict
|
||||||
auth_type:
|
auth_type:
|
||||||
description:
|
description:
|
||||||
- Name of the auth plugin to use. If the cloud uses something other than
|
- Name of the auth plugin to use. If the cloud uses something other than
|
||||||
|
@ -65,15 +65,15 @@ options:
|
||||||
description:
|
description:
|
||||||
- A path to a CA Cert bundle that can be used as part of verifying
|
- A path to a CA Cert bundle that can be used as part of verifying
|
||||||
SSL API requests.
|
SSL API requests.
|
||||||
type: path
|
type: str
|
||||||
cert:
|
cert:
|
||||||
description:
|
description:
|
||||||
- A path to a client certificate to use as part of the SSL transaction.
|
- A path to a client certificate to use as part of the SSL transaction.
|
||||||
type: path
|
type: str
|
||||||
key:
|
key:
|
||||||
description:
|
description:
|
||||||
- A path to a client key to use as part of the SSL transaction.
|
- A path to a client key to use as part of the SSL transaction.
|
||||||
type: path
|
type: str
|
||||||
interface:
|
interface:
|
||||||
description:
|
description:
|
||||||
- Endpoint URL type to fetch from the service catalog.
|
- Endpoint URL type to fetch from the service catalog.
|
||||||
|
|
|
@ -23,7 +23,7 @@ options:
|
||||||
login_unix_socket:
|
login_unix_socket:
|
||||||
description:
|
description:
|
||||||
- Path to a Unix domain socket for local connections.
|
- Path to a Unix domain socket for local connections.
|
||||||
type: path
|
type: str
|
||||||
port:
|
port:
|
||||||
description:
|
description:
|
||||||
- Database port to connect to.
|
- Database port to connect to.
|
||||||
|
@ -42,7 +42,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of a file containing SSL certificate authority (CA) certificate(s).
|
- Specifies the name of a file containing SSL certificate authority (CA) certificate(s).
|
||||||
- If the file exists, the server's certificate will be verified to be signed by one of these authorities.
|
- If the file exists, the server's certificate will be verified to be signed by one of these authorities.
|
||||||
type: path
|
type: str
|
||||||
version_added: '2.3'
|
version_added: '2.3'
|
||||||
notes:
|
notes:
|
||||||
- The default authentication assumes that you are either logging in as or sudo'ing to the C(postgres) account on the host.
|
- The default authentication assumes that you are either logging in as or sudo'ing to the C(postgres) account on the host.
|
||||||
|
|
|
@ -16,10 +16,9 @@ options:
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- If C(yes) do not get a cached copy.
|
- If C(yes) do not get a cached copy.
|
||||||
aliases:
|
|
||||||
- thirsty
|
|
||||||
type: bool
|
type: bool
|
||||||
default: no
|
default: no
|
||||||
|
aliases: [ thirsty ]
|
||||||
http_agent:
|
http_agent:
|
||||||
description:
|
description:
|
||||||
- Header to identify as, generally appears in web server logs.
|
- Header to identify as, generally appears in web server logs.
|
||||||
|
|
|
@ -369,8 +369,6 @@ lib/ansible/modules/database/mongodb/mongodb_parameter.py E317
|
||||||
lib/ansible/modules/database/mongodb/mongodb_parameter.py E323
|
lib/ansible/modules/database/mongodb/mongodb_parameter.py E323
|
||||||
lib/ansible/modules/database/mongodb/mongodb_parameter.py E326
|
lib/ansible/modules/database/mongodb/mongodb_parameter.py E326
|
||||||
lib/ansible/modules/database/mongodb/mongodb_user.py E322
|
lib/ansible/modules/database/mongodb/mongodb_user.py E322
|
||||||
lib/ansible/modules/database/mysql/mysql_replication.py E325
|
|
||||||
lib/ansible/modules/database/mysql/mysql_replication.py E326
|
|
||||||
lib/ansible/modules/database/mysql/mysql_user.py E322
|
lib/ansible/modules/database/mysql/mysql_user.py E322
|
||||||
lib/ansible/modules/database/mysql/mysql_db.py E210
|
lib/ansible/modules/database/mysql/mysql_db.py E210
|
||||||
lib/ansible/modules/database/postgresql/postgresql_ext.py E322
|
lib/ansible/modules/database/postgresql/postgresql_ext.py E322
|
||||||
|
@ -455,7 +453,6 @@ lib/ansible/modules/net_tools/basics/slurp.py E322
|
||||||
lib/ansible/modules/net_tools/basics/uri.py E322
|
lib/ansible/modules/net_tools/basics/uri.py E322
|
||||||
lib/ansible/modules/net_tools/basics/uri.py E323
|
lib/ansible/modules/net_tools/basics/uri.py E323
|
||||||
lib/ansible/modules/net_tools/basics/uri.py E324
|
lib/ansible/modules/net_tools/basics/uri.py E324
|
||||||
lib/ansible/modules/net_tools/basics/uri.py E325
|
|
||||||
lib/ansible/modules/net_tools/basics/uri.py E326
|
lib/ansible/modules/net_tools/basics/uri.py E326
|
||||||
lib/ansible/modules/net_tools/cloudflare_dns.py E317
|
lib/ansible/modules/net_tools/cloudflare_dns.py E317
|
||||||
lib/ansible/modules/net_tools/cloudflare_dns.py E327
|
lib/ansible/modules/net_tools/cloudflare_dns.py E327
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue