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