PEP 8 W291 whitespace cleanup.
This commit is contained in:
parent
95789f3949
commit
d913f69ba1
166 changed files with 493 additions and 565 deletions
|
@ -18,7 +18,7 @@ This script generates an Ansible hosts file with these host groups:
|
|||
|
||||
ABQ_xxx: Defines a hosts itself by Abiquo VM name label
|
||||
all: Contains all hosts defined in Abiquo user's enterprise
|
||||
virtualdatecenter: Creates a host group for each virtualdatacenter containing all hosts defined on it
|
||||
virtualdatecenter: Creates a host group for each virtualdatacenter containing all hosts defined on it
|
||||
virtualappliance: Creates a host group for each virtualappliance containing all hosts defined on it
|
||||
imagetemplate: Creates a host group for each image template containing all hosts using it
|
||||
|
||||
|
@ -110,7 +110,7 @@ def cache_available(config):
|
|||
|
||||
return False
|
||||
|
||||
def generate_inv_from_api(enterprise_entity,config):
|
||||
def generate_inv_from_api(enterprise_entity,config):
|
||||
try:
|
||||
inventory['all'] = {}
|
||||
inventory['all']['children'] = []
|
||||
|
@ -165,7 +165,7 @@ def generate_inv_from_api(enterprise_entity,config):
|
|||
meta_entity = next(link for link in (vmcollection['links']) if (link['rel']=='metadata'))
|
||||
try:
|
||||
metadata = api_get(meta_entity,config)
|
||||
if (config.getfloat("api","version") >= 3.0):
|
||||
if (config.getfloat("api","version") >= 3.0):
|
||||
vm_metadata = metadata['metadata']
|
||||
else:
|
||||
vm_metadata = metadata['metadata']['metadata']
|
||||
|
|
|
@ -133,7 +133,7 @@ class LibcloudInventory(object):
|
|||
if config.has_option('driver', 'path'):
|
||||
self.path = config.get('driver', 'path')
|
||||
if config.has_option('driver', 'api_version'):
|
||||
self.api_version = config.get('driver', 'api_version')
|
||||
self.api_version = config.get('driver', 'api_version')
|
||||
|
||||
Driver = get_driver(getattr(Provider, self.provider))
|
||||
|
||||
|
@ -163,8 +163,8 @@ class LibcloudInventory(object):
|
|||
|
||||
|
||||
def do_api_calls_update_cache(self):
|
||||
'''
|
||||
Do API calls to a location, and save data in cache files
|
||||
'''
|
||||
Do API calls to a location, and save data in cache files
|
||||
'''
|
||||
|
||||
self.get_nodes()
|
||||
|
@ -193,7 +193,7 @@ class LibcloudInventory(object):
|
|||
def add_node(self, node):
|
||||
'''
|
||||
Adds a node to the inventory and index, as long as it is
|
||||
addressable
|
||||
addressable
|
||||
'''
|
||||
|
||||
# Only want running instances
|
||||
|
|
|
@ -32,7 +32,7 @@ The order of precedence is command line arguments, environment variables,
|
|||
and finally the [default] profile found in ~/.azure/credentials.
|
||||
|
||||
If using a credentials file, it should be an ini formatted file with one or
|
||||
more sections, which we refer to as profiles. The script looks for a
|
||||
more sections, which we refer to as profiles. The script looks for a
|
||||
[default] section, if a profile is not specified either on the command line
|
||||
or with an environment variable. The keys in a profile will match the
|
||||
list of command line arguments below.
|
||||
|
@ -42,7 +42,7 @@ in your ~/.azure/credentials file, or a service principal or Active Directory
|
|||
user.
|
||||
|
||||
Command line arguments:
|
||||
- profile
|
||||
- profile
|
||||
- client_id
|
||||
- secret
|
||||
- subscription_id
|
||||
|
@ -61,7 +61,7 @@ Environment variables:
|
|||
|
||||
Run for Specific Host
|
||||
-----------------------
|
||||
When run for a specific host using the --host option, a resource group is
|
||||
When run for a specific host using the --host option, a resource group is
|
||||
required. For a specific host, this script returns the following variables:
|
||||
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ import json
|
|||
def initialize():
|
||||
'''
|
||||
This function initializes the FreeIPA/IPA API. This function requires
|
||||
no arguments. A kerberos key must be present in the users keyring in
|
||||
no arguments. A kerberos key must be present in the users keyring in
|
||||
order for this to work.
|
||||
'''
|
||||
|
||||
|
@ -68,8 +68,8 @@ def parse_args():
|
|||
|
||||
def print_host(host):
|
||||
'''
|
||||
This function is really a stub, it could return variables to be used in
|
||||
a playbook. However, at this point there are no variables stored in
|
||||
This function is really a stub, it could return variables to be used in
|
||||
a playbook. However, at this point there are no variables stored in
|
||||
FreeIPA/IPA.
|
||||
|
||||
This function expects one string, this hostname to lookup variables for.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
SoftLayer external inventory script.
|
||||
|
||||
The SoftLayer Python API client is required. Use `pip install softlayer` to install it.
|
||||
You have a few different options for configuring your username and api_key. You can pass
|
||||
You have a few different options for configuring your username and api_key. You can pass
|
||||
environment variables (SL_USERNAME and SL_API_KEY). You can also write INI file to
|
||||
~/.softlayer or /etc/softlayer.conf. For more information see the SL API at:
|
||||
- https://softlayer-python.readthedocs.org/en/latest/config_file.html
|
||||
|
|
|
@ -18,10 +18,10 @@ output of "spacewalk-report system-groups-systems|inventory".
|
|||
|
||||
Tested with Ansible 1.9.2 and spacewalk 2.3
|
||||
"""
|
||||
#
|
||||
#
|
||||
# Author:: Jon Miller <jonEbird@gmail.com>
|
||||
# Copyright:: Copyright (c) 2013, Jon Miller
|
||||
#
|
||||
#
|
||||
# Extended for support of multiple organizations and
|
||||
# adding the "_meta" dictionary to --list output by
|
||||
# Bernhard Lichtinger <bernhard.lichtinger@lrz.de> 2015
|
||||
|
@ -30,15 +30,15 @@ Tested with Ansible 1.9.2 and spacewalk 2.3
|
|||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
@ -109,7 +109,7 @@ parser.add_option('--host', default=None, dest="host",
|
|||
parser.add_option('-H', '--human', dest="human",
|
||||
default=False, action="store_true",
|
||||
help="Produce a friendlier version of either server list or host detail")
|
||||
parser.add_option('-o', '--org', default=None, dest="org_number",
|
||||
parser.add_option('-o', '--org', default=None, dest="org_number",
|
||||
help="Limit to spacewalk organization number")
|
||||
parser.add_option('-p', default=False, dest="prefix_org_name", action="store_true",
|
||||
help="Prefix the group name with the organization number")
|
||||
|
|
|
@ -102,7 +102,7 @@ pygments_style = 'sphinx'
|
|||
|
||||
highlight_language = 'YAML+Jinja'
|
||||
|
||||
#Substitutions, variables, entities, & shortcuts for text which do not need to link to anything.
|
||||
#Substitutions, variables, entities, & shortcuts for text which do not need to link to anything.
|
||||
#For titles which should be a link, use the intersphinx anchors set at the index, chapter, and section levels, such as qi_start_:
|
||||
rst_epilog = """
|
||||
.. |acapi| replace:: *Ansible Core API Guide*
|
||||
|
|
|
@ -102,7 +102,7 @@ pygments_style = 'sphinx'
|
|||
|
||||
highlight_language = 'YAML+Jinja'
|
||||
|
||||
#Substitutions, variables, entities, & shortcuts for text which do not need to link to anything.
|
||||
#Substitutions, variables, entities, & shortcuts for text which do not need to link to anything.
|
||||
#For titles which should be a link, use the intersphinx anchors set at the index, chapter, and section levels, such as qi_start_:
|
||||
rst_epilog = """
|
||||
.. |acapi| replace:: *Ansible Core API Guide*
|
||||
|
|
|
@ -54,12 +54,12 @@ class GalaxyLogin(object):
|
|||
self.get_credentials()
|
||||
|
||||
def get_credentials(self):
|
||||
display.display(u'\n\n' + "We need your " + stringc("Github login",'bright cyan') +
|
||||
display.display(u'\n\n' + "We need your " + stringc("Github login",'bright cyan') +
|
||||
" to identify you.", screen_only=True)
|
||||
display.display("This information will " + stringc("not be sent to Galaxy",'bright cyan') +
|
||||
display.display("This information will " + stringc("not be sent to Galaxy",'bright cyan') +
|
||||
", only to " + stringc("api.github.com.","yellow"), screen_only=True)
|
||||
display.display("The password will not be displayed." + u'\n\n', screen_only=True)
|
||||
display.display("Use " + stringc("--github-token",'yellow') +
|
||||
display.display("Use " + stringc("--github-token",'yellow') +
|
||||
" if you do not want to enter your password." + u'\n\n', screen_only=True)
|
||||
|
||||
try:
|
||||
|
@ -90,7 +90,7 @@ class GalaxyLogin(object):
|
|||
for token in tokens:
|
||||
if token['note'] == 'ansible-galaxy login':
|
||||
display.vvvvv('removing token: %s' % token['token_last_eight'])
|
||||
try:
|
||||
try:
|
||||
open_url('https://api.github.com/authorizations/%d' % token['id'], url_username=self.github_username,
|
||||
url_password=self.github_password, method='DELETE', force_basic_auth=True,)
|
||||
except HTTPError as e:
|
||||
|
|
|
@ -244,7 +244,7 @@ class GalaxyRole(object):
|
|||
elif role_data.get('github_branch', None):
|
||||
self.version = role_data['github_branch']
|
||||
else:
|
||||
self.version = 'master'
|
||||
self.version = 'master'
|
||||
elif self.version != 'master':
|
||||
if role_versions and str(self.version) not in [a.get('name', None) for a in role_versions]:
|
||||
raise AnsibleError("- the specified version (%s) of %s was not found in the list of available versions (%s)." % (self.version, self.name, role_versions))
|
||||
|
|
|
@ -51,10 +51,10 @@ class GalaxyToken(object):
|
|||
f = open(self.file,'w')
|
||||
f.close()
|
||||
os.chmod(self.file,S_IRUSR|S_IWUSR) # owner has +rw
|
||||
display.vvv('Created %s' % self.file)
|
||||
display.vvv('Created %s' % self.file)
|
||||
return open(self.file, 'r')
|
||||
|
||||
def set(self, token):
|
||||
def set(self, token):
|
||||
self.config['token'] = token
|
||||
self.save()
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class InventoryParser(object):
|
|||
self.groups[group] = Group(name=group)
|
||||
|
||||
if isinstance(group_data, dict):
|
||||
#make sure they are dicts
|
||||
#make sure they are dicts
|
||||
for section in ['vars', 'children', 'hosts']:
|
||||
if section in group_data and isinstance(group_data[section], string_types):
|
||||
group_data[section] = { group_data[section]: None}
|
||||
|
|
|
@ -375,10 +375,10 @@ class AzureRMModuleBase(object):
|
|||
'''
|
||||
dependencies = dict()
|
||||
if enum_modules:
|
||||
for module_name in enum_modules:
|
||||
for module_name in enum_modules:
|
||||
mod = importlib.import_module(module_name)
|
||||
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass):
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
self.log("dependencies: ");
|
||||
self.log(str(dependencies))
|
||||
serializer = Serializer(classes=dependencies)
|
||||
|
|
|
@ -209,7 +209,7 @@ def _get_gcp_credentials(module, require_valid_json=True, check_libcloud=False):
|
|||
'project_id': project_id}
|
||||
|
||||
def _validate_credentials_file(module, credentials_file, require_valid_json=True, check_libcloud=False):
|
||||
"""
|
||||
"""
|
||||
Check for valid credentials file.
|
||||
|
||||
Optionally check for JSON format and if libcloud supports JSON.
|
||||
|
@ -276,7 +276,7 @@ def gcp_connect(module, provider, get_driver, user_agent_product, user_agent_ver
|
|||
|
||||
|
||||
def get_google_cloud_credentials(module, scopes=[]):
|
||||
"""
|
||||
"""
|
||||
Get credentials object for use with Google Cloud client.
|
||||
|
||||
To connect via libcloud, don't use this function, use gcp_connect instead. For
|
||||
|
@ -297,7 +297,7 @@ def get_google_cloud_credentials(module, scopes=[]):
|
|||
:param scopes: list of scopes
|
||||
:type module: ``list`` of URIs
|
||||
|
||||
:returns: A tuple containing (google authorized) credentials object and
|
||||
:returns: A tuple containing (google authorized) credentials object and
|
||||
params dict {'service_account_email': '...', 'credentials_file': '...', 'project_id': ...}
|
||||
:rtype: ``tuple``
|
||||
"""
|
||||
|
@ -326,7 +326,7 @@ def get_google_api_auth(module, scopes=[], user_agent_product='ansible-python-ap
|
|||
"""
|
||||
Authentication for use with google-python-api-client.
|
||||
|
||||
Function calls get_google_cloud_credentials, which attempts to assemble the credentials
|
||||
Function calls get_google_cloud_credentials, which attempts to assemble the credentials
|
||||
from various locations. Next it attempts to authenticate with Google.
|
||||
|
||||
This function returns an httplib2 (compatible) object that can be provided to the Google Python API client.
|
||||
|
|
|
@ -87,7 +87,7 @@ options:
|
|||
description:
|
||||
- Optional attribute which with to sort the results.
|
||||
- If specifying 'tag', the 'tag_name' parameter is required.
|
||||
- Starting at version 2.1, additional sort choices of architecture, block_device_mapping, creationDate, hypervisor, is_public, location, owner_id, platform, root_device_name, root_device_type, state, and virtualization_type are supported.
|
||||
- Starting at version 2.1, additional sort choices of architecture, block_device_mapping, creationDate, hypervisor, is_public, location, owner_id, platform, root_device_name, root_device_type, state, and virtualization_type are supported.
|
||||
choices: ['name', 'description', 'tag', 'architecture', 'block_device_mapping', 'creationDate', 'hypervisor', 'is_public', 'location', 'owner_id', 'platform', 'root_device_name', 'root_device_type', 'state', 'virtualization_type']
|
||||
default: null
|
||||
required: false
|
||||
|
|
|
@ -43,7 +43,7 @@ options:
|
|||
name:
|
||||
description:
|
||||
- Name of the customer gateway.
|
||||
required: true
|
||||
required: true
|
||||
state:
|
||||
description:
|
||||
- Create or terminate the Customer Gateway.
|
||||
|
@ -108,7 +108,7 @@ gateway.customer_gateways:
|
|||
type:
|
||||
description: encryption type.
|
||||
returned: when gateway exists and is available.
|
||||
sample: ipsec.1
|
||||
sample: ipsec.1
|
||||
type: string
|
||||
'''
|
||||
|
||||
|
@ -178,13 +178,13 @@ class Ec2CustomerGatewayManager:
|
|||
DryRun=False,
|
||||
Filters=[
|
||||
{
|
||||
'Name': 'state',
|
||||
'Name': 'state',
|
||||
'Values': [
|
||||
'available',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Name': 'ip-address',
|
||||
'Name': 'ip-address',
|
||||
'Values': [
|
||||
ip_address,
|
||||
]
|
||||
|
|
|
@ -129,7 +129,7 @@ class ElbManager:
|
|||
to report it out-of-service"""
|
||||
|
||||
for lb in self.lbs:
|
||||
initial_state = self._get_instance_health(lb)
|
||||
initial_state = self._get_instance_health(lb)
|
||||
if initial_state is None:
|
||||
# Instance isn't registered with this load
|
||||
# balancer. Ignore it and try the next one.
|
||||
|
|
|
@ -163,7 +163,7 @@ def main():
|
|||
if key:
|
||||
# existing key found
|
||||
if key_material:
|
||||
# EC2's fingerprints are non-trivial to generate, so push this key
|
||||
# EC2's fingerprints are non-trivial to generate, so push this key
|
||||
# to a temporary name and make ec2 calculate the fingerprint for us.
|
||||
#
|
||||
# http://blog.jbrowne.com/?p=23
|
||||
|
@ -186,7 +186,7 @@ def main():
|
|||
if key.fingerprint != tmpfingerprint:
|
||||
if not module.check_mode:
|
||||
key.delete()
|
||||
key = ec2.import_key_pair(name, key_material)
|
||||
key = ec2.import_key_pair(name, key_material)
|
||||
|
||||
if wait:
|
||||
start = time.time()
|
||||
|
@ -211,7 +211,7 @@ def main():
|
|||
key = ec2.import_key_pair(name, key_material)
|
||||
else:
|
||||
'''
|
||||
No material provided, let AWS handle the key creation and
|
||||
No material provided, let AWS handle the key creation and
|
||||
retrieve the private key
|
||||
'''
|
||||
key = ec2.create_key_pair(name)
|
||||
|
|
|
@ -113,7 +113,7 @@ options:
|
|||
extends_documentation_fragment:
|
||||
- aws
|
||||
- ec2
|
||||
requires:
|
||||
requires:
|
||||
- "boto >= 2.39.0"
|
||||
"""
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ ANSIBLE_METADATA = {'status': ['stableinterface'],
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ec2_tag
|
||||
module: ec2_tag
|
||||
short_description: create and remove tag(s) to ec2 resources.
|
||||
description:
|
||||
- Creates, removes and lists tags from any EC2 resource. The resource is referenced by its resource id (e.g. an instance being i-XXXXXXX). It is designed to be used with complex args (tags), see the examples. This module has a dependency on python-boto.
|
||||
|
@ -28,9 +28,9 @@ version_added: "1.3"
|
|||
options:
|
||||
resource:
|
||||
description:
|
||||
- The EC2 resource id.
|
||||
- The EC2 resource id.
|
||||
required: true
|
||||
default: null
|
||||
default: null
|
||||
aliases: []
|
||||
state:
|
||||
description:
|
||||
|
@ -97,10 +97,10 @@ EXAMPLES = '''
|
|||
region: eu-west-1
|
||||
resource: '{{ item.id }}'
|
||||
state: present
|
||||
tags:
|
||||
tags:
|
||||
Name: dbserver
|
||||
Env: production
|
||||
with_subelements:
|
||||
with_subelements:
|
||||
- ec2_vol.results
|
||||
- volumes
|
||||
|
||||
|
@ -164,7 +164,7 @@ def main():
|
|||
if set(tags.items()).issubset(set(tagdict.items())):
|
||||
module.exit_json(msg="Tags already exists in %s." %resource, changed=False)
|
||||
else:
|
||||
for (key, value) in set(tags.items()):
|
||||
for (key, value) in set(tags.items()):
|
||||
if (key, value) not in set(tagdict.items()):
|
||||
dictadd[key] = value
|
||||
tagger = ec2.create_tags(resource, dictadd)
|
||||
|
|
|
@ -101,7 +101,7 @@ options:
|
|||
description:
|
||||
- The resource_id of an existing DHCP options set.
|
||||
If this is specified, then it will override other settings, except tags
|
||||
(which will be updated to match)
|
||||
(which will be updated to match)
|
||||
required: False
|
||||
default: None
|
||||
version_added: "2.1"
|
||||
|
|
|
@ -357,11 +357,11 @@ def remove_network_acl(client, module):
|
|||
changed = True
|
||||
result[nacl_id] = "Successfully deleted"
|
||||
return changed, result
|
||||
if not assoc_ids:
|
||||
if not assoc_ids:
|
||||
delete_network_acl(nacl_id, client, module)
|
||||
changed = True
|
||||
result[nacl_id] = "Successfully deleted"
|
||||
return changed, result
|
||||
return changed, result
|
||||
return changed, result
|
||||
|
||||
|
||||
|
@ -510,7 +510,7 @@ def subnets_to_associate(nacl, client, module):
|
|||
{'Name': 'tag:Name', 'Values': params}])
|
||||
except botocore.exceptions.ClientError as e:
|
||||
module.fail_json(msg=str(e))
|
||||
return [s['SubnetId'] for s in subnets['Subnets'] if s['SubnetId']]
|
||||
return [s['SubnetId'] for s in subnets['Subnets'] if s['SubnetId']]
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -44,7 +44,7 @@ options:
|
|||
tags:
|
||||
description:
|
||||
- Dictionary of tags to look for and apply when creating a Peering Connection.
|
||||
required: false
|
||||
required: false
|
||||
state:
|
||||
description:
|
||||
- Create, delete, accept, reject a peering connection.
|
||||
|
@ -67,7 +67,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: Accept local VPC peering request
|
||||
|
@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: delete a local VPC peering Connection
|
||||
|
@ -108,7 +108,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: Accept peering connection from remote account
|
||||
|
@ -129,7 +129,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: Reject a local VPC peering Connection
|
||||
|
@ -149,7 +149,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: Accept a cross account VPC peering connection request
|
||||
|
@ -174,7 +174,7 @@ EXAMPLES = '''
|
|||
tags:
|
||||
Name: Peering connection for VPC 21 to VPC 22
|
||||
CostCode: CC1234
|
||||
Project: phoenix
|
||||
Project: phoenix
|
||||
register: vpc_peer
|
||||
|
||||
- name: Reject a cross account VPC peering Connection
|
||||
|
@ -269,7 +269,7 @@ def create_peer_connection(client, module):
|
|||
changed = True
|
||||
return (changed, peering_conn['VpcPeeringConnection']['VpcPeeringConnectionId'])
|
||||
except botocore.exceptions.ClientError as e:
|
||||
module.fail_json(msg=str(e))
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
def peer_status(client, module):
|
||||
|
|
|
@ -432,7 +432,7 @@ def ensure_vgw_present(client, module):
|
|||
else:
|
||||
# attach the vgw to the supplied vpc
|
||||
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
|
||||
vgw = find_vgw(client, module, [vpn_gateway_id])
|
||||
vgw = find_vgw(client, module, [vpn_gateway_id])
|
||||
changed = True
|
||||
|
||||
# if params['VpcId'] is not provided, check the vgw is attached to a vpc. if so, detach it.
|
||||
|
@ -443,7 +443,7 @@ def ensure_vgw_present(client, module):
|
|||
if existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
|
||||
# detach the vpc from the vgw
|
||||
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId']
|
||||
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
|
||||
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
|
||||
changed = True
|
||||
|
||||
vgw = find_vgw(client, module, [vpn_gateway_id])
|
||||
|
@ -492,16 +492,16 @@ def ensure_vgw_absent(client, module):
|
|||
if existing_vgw[0]['VpcAttachments'] != [] and existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
|
||||
if params['VpcId']:
|
||||
if params['VpcId'] != existing_vgw[0]['VpcAttachments'][0]['VpcId']:
|
||||
module.fail_json(msg='The vpc-id provided does not match the vpc-id currently attached - please check the AWS console')
|
||||
module.fail_json(msg='The vpc-id provided does not match the vpc-id currently attached - please check the AWS console')
|
||||
|
||||
else:
|
||||
# detach the vpc from the vgw
|
||||
# detach the vpc from the vgw
|
||||
detach_vgw(client, module, params['VpnGatewayIds'], params['VpcId'])
|
||||
deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds'])
|
||||
changed = True
|
||||
|
||||
else:
|
||||
# attempt to detach any attached vpcs
|
||||
# attempt to detach any attached vpcs
|
||||
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId']
|
||||
detach_vgw(client, module, params['VpnGatewayIds'], vpc_to_detach)
|
||||
deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds'])
|
||||
|
@ -519,7 +519,7 @@ def ensure_vgw_absent(client, module):
|
|||
else:
|
||||
#Check that a name and type argument has been supplied if no vgw-id
|
||||
if not module.params.get('name') or not module.params.get('type'):
|
||||
module.fail_json(msg='A name and type is required when no vgw-id and a status of \'absent\' is suppled')
|
||||
module.fail_json(msg='A name and type is required when no vgw-id and a status of \'absent\' is suppled')
|
||||
|
||||
existing_vgw = find_vgw(client, module)
|
||||
if existing_vgw != [] and existing_vgw[0]['State'] != 'deleted':
|
||||
|
@ -527,10 +527,10 @@ def ensure_vgw_absent(client, module):
|
|||
if existing_vgw[0]['VpcAttachments'] != [] and existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
|
||||
if params['VpcId']:
|
||||
if params['VpcId'] != existing_vgw[0]['VpcAttachments'][0]['VpcId']:
|
||||
module.fail_json(msg='The vpc-id provided does not match the vpc-id currently attached - please check the AWS console')
|
||||
module.fail_json(msg='The vpc-id provided does not match the vpc-id currently attached - please check the AWS console')
|
||||
|
||||
else:
|
||||
# detach the vpc from the vgw
|
||||
# detach the vpc from the vgw
|
||||
detach_vgw(client, module, vpn_gateway_id, params['VpcId'])
|
||||
|
||||
#now that the vpc has been detached, delete the vgw
|
||||
|
@ -538,7 +538,7 @@ def ensure_vgw_absent(client, module):
|
|||
changed = True
|
||||
|
||||
else:
|
||||
# attempt to detach any attached vpcs
|
||||
# attempt to detach any attached vpcs
|
||||
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId']
|
||||
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
|
||||
changed = True
|
||||
|
@ -562,7 +562,7 @@ def ensure_vgw_absent(client, module):
|
|||
def main():
|
||||
argument_spec = ec2_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
region=dict(required=True),
|
||||
name=dict(),
|
||||
vpn_gateway_id=dict(),
|
||||
|
|
|
@ -36,7 +36,7 @@ options:
|
|||
default: None
|
||||
vpn_gateway_ids:
|
||||
description:
|
||||
- Get details of a specific Virtual Gateway ID. This value should be provided as a list.
|
||||
- Get details of a specific Virtual Gateway ID. This value should be provided as a list.
|
||||
required: false
|
||||
default: None
|
||||
author: "Nick Aslanidis (@naslanidis)"
|
||||
|
@ -66,7 +66,7 @@ EXAMPLES = '''
|
|||
ec2_vpc_vgw_facts:
|
||||
region: ap-southeast-2
|
||||
profile: production
|
||||
vpn_gateway_ids: vgw-c432f6a7
|
||||
vpn_gateway_ids: vgw-c432f6a7
|
||||
register: vgw_facts
|
||||
'''
|
||||
|
||||
|
@ -83,7 +83,7 @@ virtual_gateways:
|
|||
"key": "Name",
|
||||
"value": "TEST-VGW"
|
||||
}
|
||||
],
|
||||
],
|
||||
"type": "ipsec.1",
|
||||
"vpc_attachments": [
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ author: "Rick Mendes (@rickmendes)"
|
|||
options:
|
||||
instance_id:
|
||||
description:
|
||||
- The instance id to get the password data from.
|
||||
- The instance id to get the password data from.
|
||||
required: true
|
||||
key_file:
|
||||
description:
|
||||
|
@ -37,7 +37,7 @@ options:
|
|||
key_passphrase:
|
||||
version_added: "2.0"
|
||||
description:
|
||||
- The passphrase for the instance key pair. The key must use DES or 3DES encryption for this module to decrypt it. You can use openssl to convert your password protected keys if they do not use DES or 3DES. ex) openssl rsa -in current_key -out new_key -des3.
|
||||
- The passphrase for the instance key pair. The key must use DES or 3DES encryption for this module to decrypt it. You can use openssl to convert your password protected keys if they do not use DES or 3DES. ex) openssl rsa -in current_key -out new_key -des3.
|
||||
required: false
|
||||
default: null
|
||||
wait:
|
||||
|
|
|
@ -166,7 +166,7 @@ options:
|
|||
default: null
|
||||
aws_secret_key:
|
||||
description:
|
||||
- AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
|
||||
- AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
|
||||
required: false
|
||||
aliases: [ 'ec2_secret_key', 'secret_key' ]
|
||||
aws_access_key:
|
||||
|
@ -296,7 +296,7 @@ EXAMPLES = '''
|
|||
wait: yes
|
||||
wait_timeout: 600
|
||||
tags:
|
||||
Name: pg1_test_name_tag
|
||||
Name: pg1_test_name_tag
|
||||
register: rds
|
||||
|
||||
- local_action:
|
||||
|
|
|
@ -30,7 +30,7 @@ options:
|
|||
description:
|
||||
- "Name of the s3 bucket"
|
||||
required: true
|
||||
default: null
|
||||
default: null
|
||||
error_key:
|
||||
description:
|
||||
- "The object key name to use when a 4XX class error occurs. To remove an error key, set to None."
|
||||
|
|
|
@ -81,16 +81,16 @@ EXAMPLES = """
|
|||
name: "alarms"
|
||||
state: present
|
||||
display_name: "alarm SNS topic"
|
||||
delivery_policy:
|
||||
delivery_policy:
|
||||
http:
|
||||
defaultHealthyRetryPolicy:
|
||||
defaultHealthyRetryPolicy:
|
||||
minDelayTarget: 2
|
||||
maxDelayTarget: 4
|
||||
numRetries: 3
|
||||
numMaxDelayRetries: 5
|
||||
backoffFunction: "<linear|arithmetic|geometric|exponential>"
|
||||
disableSubscriptionOverrides: True
|
||||
defaultThrottlePolicy:
|
||||
defaultThrottlePolicy:
|
||||
maxReceivesPerSecond: 10
|
||||
subscriptions:
|
||||
- endpoint: "my_email_address@example.com"
|
||||
|
|
|
@ -86,19 +86,19 @@ extends_documentation_fragment:
|
|||
"""
|
||||
|
||||
RETURN = '''
|
||||
default_visibility_timeout:
|
||||
default_visibility_timeout:
|
||||
description: The default visibility timeout in seconds.
|
||||
returned: always
|
||||
sample: 30
|
||||
delivery_delay:
|
||||
delivery_delay:
|
||||
description: The delivery delay in seconds.
|
||||
returned: always
|
||||
sample: 0
|
||||
maximum_message_size:
|
||||
maximum_message_size:
|
||||
description: The maximum message size in bytes.
|
||||
returned: always
|
||||
sample: 262144
|
||||
message_retention_period:
|
||||
message_retention_period:
|
||||
description: The message retention period in seconds.
|
||||
returned: always
|
||||
sample: 345600
|
||||
|
@ -110,7 +110,7 @@ queue_arn:
|
|||
description: The queue's Amazon resource name (ARN).
|
||||
returned: on successful creation or update of the queue
|
||||
sample: 'arn:aws:sqs:us-east-1:199999999999:queuename-987d2de0'
|
||||
receive_message_wait_time:
|
||||
receive_message_wait_time:
|
||||
description: The receive message wait time in seconds.
|
||||
returned: always
|
||||
sample: 0
|
||||
|
@ -179,7 +179,7 @@ def create_or_update_sqs_queue(connection, module):
|
|||
try:
|
||||
queue = connection.get_queue(queue_name)
|
||||
if queue:
|
||||
# Update existing
|
||||
# Update existing
|
||||
result['changed'] = update_sqs_queue(queue, check_mode=module.check_mode, **queue_attributes)
|
||||
else:
|
||||
# Create new
|
||||
|
|
|
@ -43,7 +43,7 @@ options:
|
|||
default: westus
|
||||
deployment_mode:
|
||||
description:
|
||||
- In incremental mode, resources are deployed without deleting existing resources that are not included in the template.
|
||||
- In incremental mode, resources are deployed without deleting existing resources that are not included in the template.
|
||||
In complete mode resources are deployed and existing resources in the resource group not included in the template are deleted.
|
||||
required: false
|
||||
default: incremental
|
||||
|
|
|
@ -114,7 +114,7 @@ EXAMPLES = '''
|
|||
port: 443
|
||||
nodes:
|
||||
- ipAddress: 10.11.22.123
|
||||
privatePort: 80
|
||||
privatePort: 80
|
||||
state: present
|
||||
|
||||
- name: Add node to an existing loadbalancer pool
|
||||
|
@ -130,7 +130,7 @@ EXAMPLES = '''
|
|||
port: 443
|
||||
nodes:
|
||||
- ipAddress: 10.11.22.234
|
||||
privatePort: 80
|
||||
privatePort: 80
|
||||
state: nodes_present
|
||||
|
||||
- name: Remove node from an existing loadbalancer pool
|
||||
|
@ -146,7 +146,7 @@ EXAMPLES = '''
|
|||
port: 443
|
||||
nodes:
|
||||
- ipAddress: 10.11.22.234
|
||||
privatePort: 80
|
||||
privatePort: 80
|
||||
state: nodes_absent
|
||||
|
||||
- name: Delete LoadbalancerPool
|
||||
|
@ -162,7 +162,7 @@ EXAMPLES = '''
|
|||
port: 443
|
||||
nodes:
|
||||
- ipAddress: 10.11.22.123
|
||||
privatePort: 80
|
||||
privatePort: 80
|
||||
state: port_absent
|
||||
|
||||
- name: Delete Loadbalancer
|
||||
|
@ -178,7 +178,7 @@ EXAMPLES = '''
|
|||
port: 443
|
||||
nodes:
|
||||
- ipAddress: 10.11.22.123
|
||||
privatePort: 80
|
||||
privatePort: 80
|
||||
state: absent
|
||||
'''
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ options:
|
|||
- exposed
|
||||
force_kill:
|
||||
description:
|
||||
- Use the kill command when stopping a running container.
|
||||
- Use the kill command when stopping a running container.
|
||||
default: false
|
||||
required: false
|
||||
groups:
|
||||
|
@ -159,7 +159,7 @@ options:
|
|||
recreated. Stop this behavior by setting C(ignore_image) to I(True).
|
||||
default: false
|
||||
required: false
|
||||
version_added: "2.2"
|
||||
version_added: "2.2"
|
||||
image:
|
||||
description:
|
||||
- Repository path and tag used to create the container. If an image is not found or pull is true, the image
|
||||
|
@ -313,10 +313,10 @@ options:
|
|||
any other mappings.
|
||||
- If C(networks) parameter is provided, will inspect each network to see if there exists
|
||||
a bridge network with optional parameter com.docker.network.bridge.host_binding_ipv4.
|
||||
If such a network is found, then published ports where no host IP address is specified
|
||||
If such a network is found, then published ports where no host IP address is specified
|
||||
will be bound to the host IP pointed to by com.docker.network.bridge.host_binding_ipv4.
|
||||
Note that the first bridge network with a com.docker.network.bridge.host_binding_ipv4
|
||||
value encountered in the list of C(networks) is the one that will be used.
|
||||
Note that the first bridge network with a com.docker.network.bridge.host_binding_ipv4
|
||||
value encountered in the list of C(networks) is the one that will be used.
|
||||
aliases:
|
||||
- ports
|
||||
required: false
|
||||
|
@ -394,7 +394,7 @@ options:
|
|||
re-create a matching container, even if it is running. Use restart to force a matching container to be stopped and
|
||||
restarted. Use force_kill to kill a container rather than stopping it. Use keep_volumes to retain volumes associated
|
||||
with a removed container.'
|
||||
- 'I(stopped) - Asserts that the container is first I(present), and then if the container is running moves it to a stopped
|
||||
- 'I(stopped) - Asserts that the container is first I(present), and then if the container is running moves it to a stopped
|
||||
state. Use force_kill to kill a container rather than stopping it.'
|
||||
required: false
|
||||
default: started
|
||||
|
@ -518,7 +518,7 @@ EXAMPLES = '''
|
|||
name: mycontainer
|
||||
state: present
|
||||
image: ubuntu:14.04
|
||||
command: sleep infinity
|
||||
command: sleep infinity
|
||||
|
||||
- name: Stop a container
|
||||
docker_container:
|
||||
|
@ -1210,7 +1210,7 @@ class Container(DockerBaseClass):
|
|||
# assuming if the container was running, it must have been detached.
|
||||
detach = not (config.get('AttachStderr') and config.get('AttachStdout'))
|
||||
|
||||
# "ExposedPorts": null returns None type & causes AttributeError - PR #5517
|
||||
# "ExposedPorts": null returns None type & causes AttributeError - PR #5517
|
||||
if config.get('ExposedPorts') is not None:
|
||||
expected_exposed = [re.sub(r'/.+$', '', p) for p in config.get('ExposedPorts', dict()).keys()]
|
||||
else:
|
||||
|
@ -1874,7 +1874,7 @@ class ContainerManager(DockerBaseClass):
|
|||
return self._get_container(container_id)
|
||||
|
||||
def container_remove(self, container_id, link=False, force=False):
|
||||
volume_state = (not self.parameters.keep_volumes)
|
||||
volume_state = (not self.parameters.keep_volumes)
|
||||
self.log("remove container container:%s v:%s link:%s force%s" % (container_id, volume_state, link, force))
|
||||
self.results['actions'].append(dict(removed=container_id, volume_state=volume_state, link=link, force=force))
|
||||
self.results['changed'] = True
|
||||
|
|
|
@ -503,24 +503,24 @@ AUTH_PARAM_MAPPING = {
|
|||
|
||||
@contextmanager
|
||||
def stdout_redirector(path_name):
|
||||
old_stdout = sys.stdout
|
||||
old_stdout = sys.stdout
|
||||
fd = open(path_name, 'w')
|
||||
sys.stdout = fd
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stdout = old_stdout
|
||||
|
||||
def get_stdout(path_name):
|
||||
full_stdout = ''
|
||||
last_line = ''
|
||||
last_line = ''
|
||||
with open(path_name, 'r') as fd:
|
||||
for line in fd:
|
||||
# strip terminal format/color chars
|
||||
new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii'))
|
||||
full_stdout += new_line
|
||||
if new_line.strip():
|
||||
# Assuming last line contains the error message
|
||||
# Assuming last line contains the error message
|
||||
last_line = new_line.strip().encode('utf-8')
|
||||
fd.close()
|
||||
os.remove(path_name)
|
||||
|
@ -666,12 +666,12 @@ class ContainerManager(DockerBaseClass):
|
|||
|
||||
if self.pull:
|
||||
pull_output = self.cmd_pull()
|
||||
result['changed'] = pull_output['changed']
|
||||
result['changed'] = pull_output['changed']
|
||||
result['actions'] += pull_output['actions']
|
||||
|
||||
if self.build:
|
||||
build_output = self.cmd_build()
|
||||
result['changed'] = build_output['changed']
|
||||
result['changed'] = build_output['changed']
|
||||
result['actions'] += build_output['actions']
|
||||
|
||||
for service in self.project.services:
|
||||
|
@ -679,8 +679,8 @@ class ContainerManager(DockerBaseClass):
|
|||
plan = service.convergence_plan(strategy=converge)
|
||||
if plan.action != 'noop':
|
||||
result['changed'] = True
|
||||
result_action = dict(service=service.name)
|
||||
result_action[plan.action] = []
|
||||
result_action = dict(service=service.name)
|
||||
result_action[plan.action] = []
|
||||
for container in plan.containers:
|
||||
result_action[plan.action].append(dict(
|
||||
id=container.id,
|
||||
|
@ -712,17 +712,17 @@ class ContainerManager(DockerBaseClass):
|
|||
|
||||
if self.stopped:
|
||||
stop_output = self.cmd_stop(service_names)
|
||||
result['changed'] = stop_output['changed']
|
||||
result['changed'] = stop_output['changed']
|
||||
result['actions'] += stop_output['actions']
|
||||
|
||||
if self.restarted:
|
||||
restart_output = self.cmd_restart(service_names)
|
||||
result['changed'] = restart_output['changed']
|
||||
result['changed'] = restart_output['changed']
|
||||
result['actions'] += restart_output['actions']
|
||||
|
||||
if self.scale:
|
||||
scale_output = self.cmd_scale()
|
||||
result['changed'] = scale_output['changed']
|
||||
result['changed'] = scale_output['changed']
|
||||
result['actions'] += scale_output['actions']
|
||||
|
||||
for service in self.project.services:
|
||||
|
@ -791,7 +791,7 @@ class ContainerManager(DockerBaseClass):
|
|||
if not self.check_mode:
|
||||
for service in self.project.get_services(self.services, include_deps=False):
|
||||
if 'image' not in service.options:
|
||||
continue
|
||||
continue
|
||||
|
||||
self.log('Pulling image for service %s' % service.name)
|
||||
# store the existing image ID
|
||||
|
@ -809,16 +809,16 @@ class ContainerManager(DockerBaseClass):
|
|||
try:
|
||||
service.pull(ignore_pull_failures=False)
|
||||
except Exception as exc:
|
||||
self.client.fail("Error: pull failed with %s" % str(exc))
|
||||
self.client.fail("Error: pull failed with %s" % str(exc))
|
||||
|
||||
# store the new image ID
|
||||
new_image_id = ''
|
||||
new_image_id = ''
|
||||
try:
|
||||
image = service.image()
|
||||
if image and image.get('Id'):
|
||||
new_image_id = image['Id']
|
||||
except NoSuchImageError as exc:
|
||||
self.client.fail("Error: service image lookup failed after pull - %s" % str(exc))
|
||||
self.client.fail("Error: service image lookup failed after pull - %s" % str(exc))
|
||||
|
||||
if new_image_id != old_image_id:
|
||||
# if a new image was pulled
|
||||
|
@ -856,13 +856,13 @@ class ContainerManager(DockerBaseClass):
|
|||
try:
|
||||
new_image_id = service.build(pull=True, no_cache=self.nocache)
|
||||
except Exception as exc:
|
||||
self.client.fail("Error: build failed with %s" % str(exc))
|
||||
self.client.fail("Error: build failed with %s" % str(exc))
|
||||
|
||||
if new_image_id not in old_image_id:
|
||||
# if a new image was built
|
||||
result['changed'] = True
|
||||
result['actions'].append(dict(
|
||||
service=service.name,
|
||||
service=service.name,
|
||||
built_image=dict(
|
||||
name=service.image_name,
|
||||
id=new_image_id
|
||||
|
@ -901,7 +901,7 @@ class ContainerManager(DockerBaseClass):
|
|||
service_res = dict(
|
||||
service=service.name,
|
||||
stop=[]
|
||||
)
|
||||
)
|
||||
for container in service.containers(stopped=False):
|
||||
result['changed'] = True
|
||||
service_res['stop'].append(dict(
|
||||
|
@ -977,7 +977,7 @@ class ContainerManager(DockerBaseClass):
|
|||
service.scale(int(self.scale[service.name]))
|
||||
except Exception as exc:
|
||||
self.client.fail("Error scaling %s - %s" % (service.name, str(exc)))
|
||||
result['actions'].append(service_res)
|
||||
result['actions'].append(service_res)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -155,12 +155,12 @@ def grant_check(module, gs, obj):
|
|||
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllUsers']
|
||||
if not grant:
|
||||
obj.set_acl('public-read')
|
||||
module.exit_json(changed=True, result="The objects permission as been set to public-read")
|
||||
module.exit_json(changed=True, result="The objects permission as been set to public-read")
|
||||
if module.params.get('permission') == 'authenticated-read':
|
||||
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllAuthenticatedUsers']
|
||||
if not grant:
|
||||
obj.set_acl('authenticated-read')
|
||||
module.exit_json(changed=True, result="The objects permission as been set to authenticated-read")
|
||||
module.exit_json(changed=True, result="The objects permission as been set to authenticated-read")
|
||||
except gs.provider.storage_response_error as e:
|
||||
module.fail_json(msg= str(e))
|
||||
return True
|
||||
|
@ -240,7 +240,7 @@ def create_dirkey(module, gs, bucket, obj):
|
|||
|
||||
def path_check(path):
|
||||
if os.path.exists(path):
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -262,7 +262,7 @@ def transform_headers(headers):
|
|||
def upload_gsfile(module, gs, bucket, obj, src, expiry):
|
||||
try:
|
||||
bucket = gs.lookup(bucket)
|
||||
key = bucket.new_key(obj)
|
||||
key = bucket.new_key(obj)
|
||||
key.set_contents_from_filename(
|
||||
filename=src,
|
||||
headers=transform_headers(module.params.get('headers'))
|
||||
|
@ -326,7 +326,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
|||
else:
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
|
||||
if not bucket_rc:
|
||||
if not bucket_rc:
|
||||
create_bucket(module, gs, bucket)
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
|
||||
|
@ -352,7 +352,7 @@ def handle_delete(module, gs, bucket, obj):
|
|||
module.fail_json(msg="Bucket or Bucket & object parameter is required.", failed=True)
|
||||
|
||||
def handle_create(module, gs, bucket, obj):
|
||||
if bucket and not obj:
|
||||
if bucket and not obj:
|
||||
if bucket_check(module, gs, bucket):
|
||||
module.exit_json(msg="Bucket already exists.", changed=False)
|
||||
else:
|
||||
|
@ -366,7 +366,7 @@ def handle_create(module, gs, bucket, obj):
|
|||
if bucket_check(module, gs, bucket):
|
||||
if key_check(module, gs, bucket, dirobj):
|
||||
module.exit_json(msg="Bucket %s and key %s already exists."% (bucket, obj), changed=False)
|
||||
else:
|
||||
else:
|
||||
create_dirkey(module, gs, bucket, dirobj)
|
||||
else:
|
||||
create_bucket(module, gs, bucket)
|
||||
|
@ -431,7 +431,7 @@ def main():
|
|||
module.fail_json(msg="Local object for PUT does not exist", failed=True)
|
||||
handle_put(module, gs, bucket, obj, overwrite, src, expiry)
|
||||
|
||||
# Support for deleting an object if we have both params.
|
||||
# Support for deleting an object if we have both params.
|
||||
if mode == 'delete':
|
||||
handle_delete(module, gs, bucket, obj)
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ notes:
|
|||
- See also M(gcdns_zone).
|
||||
- This modules's underlying library does not support in-place updates for
|
||||
DNS resource records. Instead, resource records are quickly deleted and
|
||||
recreated.
|
||||
recreated.
|
||||
- SOA records are technically supported, but their functionality is limited
|
||||
to verifying that a zone's existing SOA record matches a pre-determined
|
||||
value. The SOA record cannot be updated.
|
||||
|
|
|
@ -86,7 +86,7 @@ options:
|
|||
description:
|
||||
- the protocol used for the load-balancer packet forwarding, tcp or udp
|
||||
required: false
|
||||
default: "tcp"
|
||||
default: "tcp"
|
||||
choices: ['tcp', 'udp']
|
||||
region:
|
||||
description:
|
||||
|
@ -151,7 +151,7 @@ author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
|||
|
||||
EXAMPLES = '''
|
||||
# Simple example of creating a new LB, adding members, and a health check
|
||||
- local_action:
|
||||
- local_action:
|
||||
module: gce_lb
|
||||
name: testlb
|
||||
region: us-central1
|
||||
|
|
|
@ -293,7 +293,7 @@ except ImportError:
|
|||
|
||||
|
||||
def _check_params(params, field_list):
|
||||
"""
|
||||
"""
|
||||
Helper to validate params.
|
||||
|
||||
Use this in function definitions if they require specific fields
|
||||
|
@ -323,7 +323,7 @@ def _check_params(params, field_list):
|
|||
|
||||
|
||||
def _validate_autoscaling_params(params):
|
||||
"""
|
||||
"""
|
||||
Validate that the minimum configuration is present for autoscaling.
|
||||
|
||||
:param params: Ansible dictionary containing autoscaling configuration
|
||||
|
@ -331,7 +331,7 @@ def _validate_autoscaling_params(params):
|
|||
key 'autoscaling'.
|
||||
:type params: ``dict``
|
||||
|
||||
:return: Tuple containing a boolean and a string. True if autoscaler
|
||||
:return: Tuple containing a boolean and a string. True if autoscaler
|
||||
is valid, False otherwise, plus str for message.
|
||||
:rtype: ``(``bool``, ``str``)``
|
||||
"""
|
||||
|
@ -372,7 +372,7 @@ def _validate_autoscaling_params(params):
|
|||
|
||||
|
||||
def _validate_named_port_params(params):
|
||||
"""
|
||||
"""
|
||||
Validate the named ports parameters
|
||||
|
||||
:param params: Ansible dictionary containing named_ports configuration
|
||||
|
@ -404,7 +404,7 @@ def _validate_named_port_params(params):
|
|||
|
||||
|
||||
def _get_instance_list(mig, field='name', filter_list=['NONE']):
|
||||
"""
|
||||
"""
|
||||
Helper to grab field from instances response.
|
||||
|
||||
:param mig: Managed Instance Group Object from libcloud.
|
||||
|
@ -427,10 +427,10 @@ def _get_instance_list(mig, field='name', filter_list=['NONE']):
|
|||
|
||||
|
||||
def _gen_gce_as_policy(as_params):
|
||||
"""
|
||||
"""
|
||||
Take Autoscaler params and generate GCE-compatible policy.
|
||||
|
||||
:param as_params: Dictionary in Ansible-playbook format
|
||||
:param as_params: Dictionary in Ansible-playbook format
|
||||
containing policy arguments.
|
||||
:type as_params: ``dict``
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ options:
|
|||
description:
|
||||
- Dictionary containing a subscripton name associated with a topic (required), along with optional ack_deadline, push_endpoint and pull. For pulling from a subscription, message_ack (bool), max_messages (int) and return_immediate are available as subfields. See subfields name, push_endpoint and ack_deadline for more information.
|
||||
required: False
|
||||
name:
|
||||
name:
|
||||
description: Subfield of subscription. Required if subscription is specified. See examples.
|
||||
required: False
|
||||
ack_deadline:
|
||||
|
@ -156,13 +156,13 @@ state:
|
|||
type: str
|
||||
sample: "present"
|
||||
|
||||
subscription:
|
||||
subscription:
|
||||
description: Name of subscription.
|
||||
returned: When subscription fields are specified
|
||||
type: str
|
||||
sample: "mysubscription"
|
||||
|
||||
topic:
|
||||
topic:
|
||||
description: Name of topic.
|
||||
returned: Always
|
||||
type: str
|
||||
|
|
|
@ -45,7 +45,7 @@ options:
|
|||
state:
|
||||
description:
|
||||
- list is the only valid option.
|
||||
required: False
|
||||
required: False
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -72,7 +72,7 @@ subscriptions:
|
|||
returned: When view is set to subscriptions.
|
||||
type: list
|
||||
sample: ["mysubscription", "mysubscription2"]
|
||||
topic:
|
||||
topic:
|
||||
description: Name of topic. Used to filter subscriptions.
|
||||
returned: Always
|
||||
type: str
|
||||
|
|
|
@ -179,14 +179,14 @@ def randompass():
|
|||
'''
|
||||
Generate a long random password that comply to Linode requirements
|
||||
'''
|
||||
# Linode API currently requires the following:
|
||||
# It must contain at least two of these four character classes:
|
||||
# Linode API currently requires the following:
|
||||
# It must contain at least two of these four character classes:
|
||||
# lower case letters - upper case letters - numbers - punctuation
|
||||
# we play it safe :)
|
||||
import random
|
||||
import string
|
||||
# as of python 2.4, this reseeds the PRNG from urandom
|
||||
random.seed()
|
||||
random.seed()
|
||||
lower = ''.join(random.choice(string.ascii_lowercase) for x in range(6))
|
||||
upper = ''.join(random.choice(string.ascii_uppercase) for x in range(6))
|
||||
number = ''.join(random.choice(string.digits) for x in range(6))
|
||||
|
@ -218,11 +218,11 @@ def getInstanceDetails(api, server):
|
|||
'ip_id': ip['IPADDRESSID']})
|
||||
return instance
|
||||
|
||||
def linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||
def linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||
payment_term, password, ssh_pub_key, swap, wait, wait_timeout):
|
||||
instances = []
|
||||
changed = False
|
||||
new_server = False
|
||||
new_server = False
|
||||
servers = []
|
||||
disks = []
|
||||
configs = []
|
||||
|
@ -233,7 +233,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
|||
# For the moment we only consider linode_id as criteria for match
|
||||
# Later we can use more (size, name, etc.) and update existing
|
||||
servers = api.linode_list(LinodeId=linode_id)
|
||||
# Attempt to fetch details about disks and configs only if servers are
|
||||
# Attempt to fetch details about disks and configs only if servers are
|
||||
# found with linode_id
|
||||
if servers:
|
||||
disks = api.linode_disk_list(LinodeId=linode_id)
|
||||
|
@ -256,7 +256,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
|||
# Create linode entity
|
||||
new_server = True
|
||||
try:
|
||||
res = api.linode_create(DatacenterID=datacenter, PlanID=plan,
|
||||
res = api.linode_create(DatacenterID=datacenter, PlanID=plan,
|
||||
PaymentTerm=payment_term)
|
||||
linode_id = res['LinodeID']
|
||||
# Update linode Label to match name
|
||||
|
@ -282,17 +282,17 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
|||
size = servers[0]['TOTALHD'] - swap
|
||||
if ssh_pub_key:
|
||||
res = api.linode_disk_createfromdistribution(
|
||||
LinodeId=linode_id, DistributionID=distribution,
|
||||
LinodeId=linode_id, DistributionID=distribution,
|
||||
rootPass=password, rootSSHKey=ssh_pub_key,
|
||||
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
||||
else:
|
||||
res = api.linode_disk_createfromdistribution(
|
||||
LinodeId=linode_id, DistributionID=distribution, rootPass=password,
|
||||
LinodeId=linode_id, DistributionID=distribution, rootPass=password,
|
||||
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
||||
jobs.append(res['JobID'])
|
||||
# Create SWAP disk
|
||||
res = api.linode_disk_create(LinodeId=linode_id, Type='swap',
|
||||
Label='%s swap disk (lid: %s)' % (name, linode_id),
|
||||
res = api.linode_disk_create(LinodeId=linode_id, Type='swap',
|
||||
Label='%s swap disk (lid: %s)' % (name, linode_id),
|
||||
Size=swap)
|
||||
jobs.append(res['JobID'])
|
||||
except Exception as e:
|
||||
|
@ -364,12 +364,12 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
|||
time.sleep(5)
|
||||
if wait and wait_timeout <= time.time():
|
||||
# waiting took too long
|
||||
module.fail_json(msg = 'Timeout waiting on %s (lid: %s)' %
|
||||
module.fail_json(msg = 'Timeout waiting on %s (lid: %s)' %
|
||||
(server['LABEL'], server['LINODEID']))
|
||||
# Get a fresh copy of the server details
|
||||
server = api.linode_list(LinodeId=server['LINODEID'])[0]
|
||||
if server['STATUS'] == -2:
|
||||
module.fail_json(msg = '%s (lid: %s) failed to boot' %
|
||||
module.fail_json(msg = '%s (lid: %s) failed to boot' %
|
||||
(server['LABEL'], server['LINODEID']))
|
||||
# From now on we know the task is a success
|
||||
# Build instance report
|
||||
|
@ -380,7 +380,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
|||
else:
|
||||
instance['status'] = 'Starting'
|
||||
|
||||
# Return the root password if this is a new box and no SSH key
|
||||
# Return the root password if this is a new box and no SSH key
|
||||
# has been provided
|
||||
if new_server and not ssh_pub_key:
|
||||
instance['password'] = password
|
||||
|
@ -495,7 +495,7 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
|
||||
linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||
linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||
payment_term, password, ssh_pub_key, swap, wait, wait_timeout)
|
||||
|
||||
# import module snippets
|
||||
|
|
|
@ -446,7 +446,7 @@ def main():
|
|||
vmcpus = module.params['instance_cpus'] # number of cpu
|
||||
vmnic = module.params['instance_nic'] # network interface
|
||||
vmnetwork = module.params['instance_network'] # logical network
|
||||
vmmem = module.params['instance_mem'] # mem size
|
||||
vmmem = module.params['instance_mem'] # mem size
|
||||
vmdisk_alloc = module.params['disk_alloc'] # thin, preallocated
|
||||
vmdisk_int = module.params['disk_int'] # disk interface virtio or ide
|
||||
vmos = module.params['instance_os'] # Operating System
|
||||
|
|
|
@ -600,7 +600,7 @@ EXAMPLES = '''
|
|||
node : sabrewulf
|
||||
state : absent
|
||||
|
||||
# Get VM current state
|
||||
# Get VM current state
|
||||
- proxmox_kvm:
|
||||
api_user : root@pam
|
||||
api_password: secret
|
||||
|
@ -638,7 +638,7 @@ vmid:
|
|||
type: int
|
||||
sample: 115
|
||||
status:
|
||||
description:
|
||||
description:
|
||||
- The current virtual machine status.
|
||||
- Returned only when C(state=current)
|
||||
returned: success
|
||||
|
@ -646,7 +646,7 @@ status:
|
|||
sample: '{
|
||||
"changed": false,
|
||||
"msg": "VM kropta with vmid = 110 is running",
|
||||
"status": "running"
|
||||
"status": "running"
|
||||
}'
|
||||
'''
|
||||
|
||||
|
|
|
@ -96,12 +96,12 @@ tasks:
|
|||
|
||||
RETURN = '''
|
||||
# for list_vms command
|
||||
list_vms:
|
||||
list_vms:
|
||||
description: The list of vms defined on the remote system
|
||||
type: dictionary
|
||||
returned: success
|
||||
sample: [
|
||||
"build.example.org",
|
||||
"build.example.org",
|
||||
"dev.example.org"
|
||||
]
|
||||
# for status command
|
||||
|
|
|
@ -260,7 +260,7 @@ class LibvirtConnection(object):
|
|||
else:
|
||||
# pretend there was a change
|
||||
res = 0
|
||||
if res == 0:
|
||||
if res == 0:
|
||||
return True
|
||||
else:
|
||||
# change the host
|
||||
|
|
|
@ -157,7 +157,7 @@ def _get_ksclient(module, kwargs):
|
|||
auth_url=kwargs.get('auth_url'))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Error authenticating to the keystone: %s " % e.message)
|
||||
return client
|
||||
return client
|
||||
|
||||
|
||||
def _get_endpoint(module, client, endpoint_type):
|
||||
|
@ -186,7 +186,7 @@ def _glance_image_present(module, params, client):
|
|||
try:
|
||||
for image in client.images.list():
|
||||
if image.name == params['name']:
|
||||
return image.id
|
||||
return image.id
|
||||
return None
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Error in fetching image list: %s" % e.message)
|
||||
|
|
|
@ -337,7 +337,7 @@ def _add_floating_ip_from_pool(module, nova, server):
|
|||
if not pool_ips:
|
||||
try:
|
||||
new_ip = nova.floating_ips.create(pool)
|
||||
except Exception as e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = "Unable to create floating ip: %s" % (e.message))
|
||||
pool_ips.append(new_ip.ip)
|
||||
# Add to the main list
|
||||
|
|
|
@ -135,7 +135,7 @@ def main():
|
|||
if module.params['public_key'] and (module.params['public_key'] != key.public_key ):
|
||||
module.fail_json(msg = "name {} present but key hash not the same as offered. Delete key first.".format(key['name']))
|
||||
else:
|
||||
module.exit_json(changed = False, result = "Key present")
|
||||
module.exit_json(changed = False, result = "Key present")
|
||||
try:
|
||||
key = nova.keypairs.create(module.params['name'], module.params['public_key'])
|
||||
except Exception as e:
|
||||
|
|
|
@ -72,7 +72,7 @@ def main():
|
|||
clouds.append(cloud.config)
|
||||
module.exit_json(ansible_facts=dict(openstack=dict(clouds=clouds)))
|
||||
except exceptions.OpenStackConfigException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
|
|
@ -96,7 +96,7 @@ openstack_projects:
|
|||
returned: always, but can be null
|
||||
type: complex
|
||||
contains:
|
||||
id:
|
||||
id:
|
||||
description: Unique UUID.
|
||||
returned: success
|
||||
type: string
|
||||
|
|
|
@ -26,8 +26,8 @@ description:
|
|||
version_added: "2.2"
|
||||
author: Pascal HERAUD @pascalheraud
|
||||
notes:
|
||||
- Uses the python OVH Api U(https://github.com/ovh/python-ovh).
|
||||
You have to create an application (a key and secret) with a consummer
|
||||
- Uses the python OVH Api U(https://github.com/ovh/python-ovh).
|
||||
You have to create an application (a key and secret) with a consummer
|
||||
key as described into U(https://eu.api.ovh.com/g934.first_step_with_api)
|
||||
requirements:
|
||||
- ovh > 0.3.5
|
||||
|
@ -79,13 +79,13 @@ options:
|
|||
type: "int"
|
||||
default: 120
|
||||
description:
|
||||
- The timeout in seconds used to wait for a task to be
|
||||
- The timeout in seconds used to wait for a task to be
|
||||
completed. Default is 120 seconds.
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Adds or modify the backend '212.1.1.1' to a
|
||||
# Adds or modify the backend '212.1.1.1' to a
|
||||
# loadbalancing 'ip-1.1.1.1'
|
||||
- ovh_ip_loadbalancing:
|
||||
name: ip-1.1.1.1
|
||||
|
|
|
@ -43,7 +43,7 @@ options:
|
|||
|
||||
count_offset:
|
||||
description:
|
||||
- From which number to start the count.
|
||||
- From which number to start the count.
|
||||
|
||||
device_ids:
|
||||
description:
|
||||
|
@ -59,9 +59,9 @@ options:
|
|||
|
||||
hostnames:
|
||||
description:
|
||||
- A hostname of a device, or a list of hostnames.
|
||||
- A hostname of a device, or a list of hostnames.
|
||||
- If given string or one-item list, you can use the C("%d") Python string format to expand numbers from count.
|
||||
- If only one hostname, it might be expanded to list if count>1.
|
||||
- If only one hostname, it might be expanded to list if count>1.
|
||||
aliases: [name]
|
||||
|
||||
lock:
|
||||
|
@ -127,7 +127,7 @@ EXAMPLES = '''
|
|||
plan: baremetal_0
|
||||
facility: sjc1
|
||||
|
||||
- name: create 3 ubuntu devices called server-01, server-02 and server-03
|
||||
- name: create 3 ubuntu devices called server-01, server-02 and server-03
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- packet_device:
|
||||
|
@ -435,7 +435,7 @@ def wait_for_ips(module, packet_conn, created_devices):
|
|||
% [d.hostname for d in created_devices])
|
||||
|
||||
|
||||
def get_existing_devices(module, packet_conn):
|
||||
def get_existing_devices(module, packet_conn):
|
||||
project_id = module.params.get('project_id')
|
||||
return packet_conn.list_devices(project_id, params={'per_page': MAX_DEVICES})
|
||||
|
||||
|
@ -545,7 +545,7 @@ def main():
|
|||
|
||||
if not module.params.get('auth_token'):
|
||||
_fail_msg = ( "if Packet API token is not in environment variable %s, "
|
||||
"the auth_token parameter is required" %
|
||||
"the auth_token parameter is required" %
|
||||
PACKET_API_TOKEN_ENV_VAR)
|
||||
module.fail_json(msg=_fail_msg)
|
||||
|
||||
|
|
|
@ -92,9 +92,9 @@ sshkeys:
|
|||
type: array
|
||||
sample: [
|
||||
{
|
||||
"fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46",
|
||||
"id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7",
|
||||
"key": "ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2",
|
||||
"fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46",
|
||||
"id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7",
|
||||
"key": "ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2",
|
||||
"label": "mynewkey33"
|
||||
}
|
||||
]
|
||||
|
@ -251,7 +251,7 @@ def main():
|
|||
|
||||
if not module.params.get('auth_token'):
|
||||
_fail_msg = ( "if Packet API token is not in environment variable %s, "
|
||||
"the auth_token parameter is required" %
|
||||
"the auth_token parameter is required" %
|
||||
PACKET_API_TOKEN_ENV_VAR)
|
||||
module.fail_json(msg=_fail_msg)
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ EXAMPLES = '''
|
|||
datacenter: Tardis One
|
||||
wait_timeout: 500
|
||||
|
||||
# Destroy a Datacenter. This will remove all servers, volumes, and other objects in the datacenter.
|
||||
# Destroy a Datacenter. This will remove all servers, volumes, and other objects in the datacenter.
|
||||
- profitbricks_datacenter:
|
||||
datacenter: Tardis One
|
||||
wait_timeout: 500
|
||||
|
@ -177,7 +177,7 @@ def remove_datacenter(module, profitbricks):
|
|||
"""
|
||||
Removes a Datacenter.
|
||||
|
||||
This will remove a datacenter.
|
||||
This will remove a datacenter.
|
||||
|
||||
module : AnsibleModule object
|
||||
profitbricks: authenticated profitbricks object.
|
||||
|
|
|
@ -172,7 +172,7 @@ def detach_volume(module, profitbricks):
|
|||
"""
|
||||
Detaches a volume.
|
||||
|
||||
This will remove a volume from the server.
|
||||
This will remove a volume from the server.
|
||||
|
||||
module : AnsibleModule object
|
||||
profitbricks: authenticated profitbricks object.
|
||||
|
|
|
@ -83,7 +83,7 @@ options:
|
|||
description:
|
||||
- how long before wait gives up, in seconds
|
||||
default: 300
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Matt Martz (@sivel)"
|
||||
extends_documentation_fragment: rackspace.openstack
|
||||
|
|
|
@ -62,7 +62,7 @@ options:
|
|||
description:
|
||||
- how long before wait gives up, in seconds
|
||||
default: 300
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Matt Martz (@sivel)"
|
||||
extends_documentation_fragment: rackspace.openstack
|
||||
|
|
|
@ -107,7 +107,7 @@ options:
|
|||
description:
|
||||
- how long before wait gives up, in seconds
|
||||
default: 300
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Matt Martz (@sivel)"
|
||||
extends_documentation_fragment: rackspace
|
||||
|
|
|
@ -34,7 +34,7 @@ options:
|
|||
choices: ['present', 'absent']
|
||||
default: present
|
||||
required: false
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Matt Martz (@sivel)"
|
||||
extends_documentation_fragment: rackspace.openstack
|
||||
|
|
|
@ -43,7 +43,7 @@ options:
|
|||
description:
|
||||
- cidr of the network being created
|
||||
default: null
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Jesse Keating (@j2sol)"
|
||||
extends_documentation_fragment: rackspace.openstack
|
||||
|
|
|
@ -39,7 +39,7 @@ options:
|
|||
- present
|
||||
- absent
|
||||
default: present
|
||||
author:
|
||||
author:
|
||||
- "Christopher H. Laco (@claco)"
|
||||
- "Matt Martz (@sivel)"
|
||||
extends_documentation_fragment: rackspace
|
||||
|
|
|
@ -206,7 +206,7 @@ EXAMPLES = '''
|
|||
- hostname: instance-3
|
||||
domain: anydomain.com
|
||||
datacenter: dal09
|
||||
tags:
|
||||
tags:
|
||||
- ansible-module-test
|
||||
- ansible-module-test-slaves
|
||||
hourly: True
|
||||
|
|
|
@ -26,7 +26,7 @@ DOCUMENTATION = '''
|
|||
---
|
||||
module: vsphere_copy
|
||||
short_description: Copy a file to a vCenter datastore
|
||||
description:
|
||||
description:
|
||||
- Upload files to a vCenter datastore
|
||||
version_added: 2.0
|
||||
author: Dag Wieers (@dagwieers) <dag@wieers.com>
|
||||
|
|
|
@ -101,7 +101,7 @@ EXAMPLES = '''
|
|||
webfaction_app:
|
||||
name="my_wsgi_app1"
|
||||
state=present
|
||||
type=mod_wsgi35-python27
|
||||
type=mod_wsgi35-python27
|
||||
login_name={{webfaction_user}}
|
||||
login_password={{webfaction_passwd}}
|
||||
machine={{webfaction_machine}}
|
||||
|
@ -168,8 +168,8 @@ def main():
|
|||
# If this isn't a dry run, create the app
|
||||
result.update(
|
||||
webfaction.create_app(
|
||||
session_id, app_name, app_type,
|
||||
module.boolean(module.params['autostart']),
|
||||
session_id, app_name, app_type,
|
||||
module.boolean(module.params['autostart']),
|
||||
module.params['extra_info'],
|
||||
module.boolean(module.params['port_open'])
|
||||
)
|
||||
|
|
|
@ -95,8 +95,8 @@ EXAMPLES = '''
|
|||
webfaction_site:
|
||||
name: testsite1
|
||||
state: present
|
||||
host: myhost.webfaction.com
|
||||
subdomains:
|
||||
host: myhost.webfaction.com
|
||||
subdomains:
|
||||
- 'testsite1.my_domain.org'
|
||||
site_apps:
|
||||
- ['testapp1', '/']
|
||||
|
@ -167,8 +167,8 @@ def main():
|
|||
changed = False
|
||||
)
|
||||
|
||||
positional_args = [
|
||||
session_id, site_name, site_ip,
|
||||
positional_args = [
|
||||
session_id, site_name, site_ip,
|
||||
module.boolean(module.params['https']),
|
||||
module.params['subdomains'],
|
||||
]
|
||||
|
|
|
@ -75,7 +75,7 @@ notes:
|
|||
The M(command) module is much more secure as it's not affected by the user's environment.
|
||||
- " C(creates), C(removes), and C(chdir) can be specified after the command.
|
||||
For instance, if you only want to run a command if a certain file does not exist, use this."
|
||||
author:
|
||||
author:
|
||||
- Ansible Core Team
|
||||
- Michael DeHaan
|
||||
'''
|
||||
|
|
|
@ -49,7 +49,7 @@ options:
|
|||
url:
|
||||
description:
|
||||
- Set exact URL to download the plugin from.
|
||||
For local file, prefix its absolute path with file://
|
||||
For local file, prefix its absolute path with file://
|
||||
required: False
|
||||
default: None
|
||||
timeout:
|
||||
|
|
|
@ -80,7 +80,7 @@ notes:
|
|||
requirements:
|
||||
- python >= 2.7
|
||||
- pymssql
|
||||
author: Vedit Firat Arig
|
||||
author: Vedit Firat Arig
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -34,7 +34,7 @@ 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:
|
||||
|
|
|
@ -143,7 +143,7 @@ def main():
|
|||
state = module.params["state"]
|
||||
changed = False
|
||||
|
||||
# To use defaults values, keyword arguments must be absent, so
|
||||
# To use defaults values, keyword arguments must be absent, so
|
||||
# check which values are empty and don't include in the **kw
|
||||
# dictionary
|
||||
params_map = {
|
||||
|
|
|
@ -26,17 +26,17 @@ DOCUMENTATION = '''
|
|||
module: postgresql_lang
|
||||
short_description: Adds, removes or changes procedural languages with a PostgreSQL database.
|
||||
description:
|
||||
- Adds, removes or changes procedural languages with a PostgreSQL database.
|
||||
- Adds, removes or changes procedural languages with a PostgreSQL database.
|
||||
- This module allows you to add a language, remote a language or change the trust
|
||||
relationship with a PostgreSQL database. The module can be used on the machine
|
||||
relationship with a PostgreSQL database. The module can be used on the machine
|
||||
where executed or on a remote host.
|
||||
- When removing a language from a database, it is possible that dependencies prevent
|
||||
the database from being removed. In that case, you can specify casade to
|
||||
automatically drop objects that depend on the language (such as functions in the
|
||||
language). In case the language can't be deleted because it is required by the
|
||||
the database from being removed. In that case, you can specify casade to
|
||||
automatically drop objects that depend on the language (such as functions in the
|
||||
language). In case the language can't be deleted because it is required by the
|
||||
database system, you can specify fail_on_drop=no to ignore the error.
|
||||
- Be carefull when marking a language as trusted since this could be a potential
|
||||
security breach. Untrusted languages allow only users with the PostgreSQL superuser
|
||||
security breach. Untrusted languages allow only users with the PostgreSQL superuser
|
||||
privilege to use this language to create new functions.
|
||||
version_added: "1.7"
|
||||
options:
|
||||
|
@ -53,13 +53,13 @@ options:
|
|||
choices: [ "yes", "no" ]
|
||||
db:
|
||||
description:
|
||||
- name of database where the language will be added, removed or changed
|
||||
- name of database where the language will be added, removed or changed
|
||||
required: false
|
||||
default: null
|
||||
force_trust:
|
||||
description:
|
||||
- marks the language as trusted, even if it's marked as untrusted in pg_pltemplate.
|
||||
- use with care!
|
||||
- use with care!
|
||||
required: false
|
||||
default: no
|
||||
choices: [ "yes", "no" ]
|
||||
|
@ -72,8 +72,8 @@ options:
|
|||
choices: [ "yes", "no" ]
|
||||
cascade:
|
||||
description:
|
||||
- when dropping a language, also delete object that depend on this language.
|
||||
- only used when C(state=absent).
|
||||
- when dropping a language, also delete object that depend on this language.
|
||||
- only used when C(state=absent).
|
||||
required: false
|
||||
default: no
|
||||
choices: [ "yes", "no" ]
|
||||
|
@ -118,7 +118,7 @@ author: "Jens Depuydt (@jensdepuydt)"
|
|||
|
||||
EXAMPLES = '''
|
||||
# Add language pltclu to database testdb if it doesn't exist:
|
||||
- postgresql_lang db=testdb lang=pltclu state=present
|
||||
- postgresql_lang db=testdb lang=pltclu state=present
|
||||
|
||||
# Add language pltclu to database testdb if it doesn't exist and mark it as trusted:
|
||||
# Marks the language as trusted if it exists but isn't trusted yet
|
||||
|
|
|
@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||
name: acme
|
||||
|
||||
# Create a new schema "acme" with a user "bob" who will own it
|
||||
- postgresql_schema:
|
||||
- postgresql_schema:
|
||||
name: acme
|
||||
owner: bob
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module: vertica_schema
|
|||
version_added: '2.0'
|
||||
short_description: Adds or removes Vertica database schema and roles.
|
||||
description:
|
||||
- Adds or removes Vertica database schema and, optionally, roles
|
||||
- Adds or removes Vertica database schema and, optionally, roles
|
||||
with schema access privileges.
|
||||
- A schema will not be removed until all the objects have been dropped.
|
||||
- In such a situation, if the module tries to remove the schema it
|
||||
|
|
|
@ -253,7 +253,7 @@ def present(user_facts, cursor, user, profile, resource_pool,
|
|||
if ldap:
|
||||
if ldap != (user_facts[user_key]['expired'] == 'True'):
|
||||
query_fragments.append("password expire")
|
||||
changed = True
|
||||
changed = True
|
||||
elif expired is not None and expired != (user_facts[user_key]['expired'] == 'True'):
|
||||
if expired:
|
||||
query_fragments.append("password expire")
|
||||
|
|
|
@ -237,7 +237,7 @@ def contentfilter(fsname, pattern):
|
|||
f.close()
|
||||
return True
|
||||
|
||||
f.close()
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ options:
|
|||
backup:
|
||||
version_added: "2.0"
|
||||
description:
|
||||
- passes --backup --version-control=numbered to patch,
|
||||
- passes --backup --version-control=numbered to patch,
|
||||
producing numbered backup copies
|
||||
choices: [ 'yes', 'no' ]
|
||||
default: 'no'
|
||||
|
|
|
@ -37,11 +37,11 @@ requirements:
|
|||
options:
|
||||
api_key:
|
||||
description:
|
||||
- Circonus API key
|
||||
- Circonus API key
|
||||
required: true
|
||||
category:
|
||||
description:
|
||||
- Annotation Category
|
||||
- Annotation Category
|
||||
required: true
|
||||
description:
|
||||
description:
|
||||
|
|
|
@ -274,7 +274,7 @@ EXAMPLES = '''
|
|||
company: '{{ company }}'
|
||||
user: '{{ user }}'
|
||||
password: '{{ password }}'
|
||||
properties:
|
||||
properties:
|
||||
snmp.community: commstring
|
||||
type: dev
|
||||
|
||||
|
@ -340,7 +340,7 @@ EXAMPLES = '''
|
|||
password: '{{ password }}'
|
||||
collector: mycompany-Collector
|
||||
groups: /servers/production,/datacenter5
|
||||
properties:
|
||||
properties:
|
||||
snmp.community: commstring
|
||||
dc: 5
|
||||
delegate_to: localhost
|
||||
|
@ -363,7 +363,7 @@ EXAMPLES = '''
|
|||
company: '{{ company }}'
|
||||
user: '{{ user }}'
|
||||
password: '{{ password }}'
|
||||
properties:
|
||||
properties:
|
||||
snmp.community: hg
|
||||
type: dev
|
||||
status: test
|
||||
|
@ -474,7 +474,7 @@ EXAMPLES = '''
|
|||
company: '{{ company }}'
|
||||
user: '{{ user }}'
|
||||
password: '{{ password }}'
|
||||
properties:
|
||||
properties:
|
||||
snmp.community: commstring
|
||||
- name: SDT a host group
|
||||
logicmonitor:
|
||||
|
|
|
@ -52,7 +52,7 @@ options:
|
|||
default: 300
|
||||
version_added: "2.1"
|
||||
requirements: [ ]
|
||||
author: "Darryl Stoflet (@dstoflet)"
|
||||
author: "Darryl Stoflet (@dstoflet)"
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
|
|
@ -26,7 +26,7 @@ short_description: Pause/unpause Pingdom alerts
|
|||
description:
|
||||
- This module will let you pause/unpause Pingdom alerts
|
||||
version_added: "1.2"
|
||||
author:
|
||||
author:
|
||||
- "Dylan Silva (@thaumos)"
|
||||
- "Justin Johns"
|
||||
requirements:
|
||||
|
|
|
@ -156,7 +156,7 @@ options:
|
|||
custom:
|
||||
version_added: "2.1"
|
||||
description:
|
||||
- A hash/dictionary of custom parameters for mixing to the configuration.
|
||||
- A hash/dictionary of custom parameters for mixing to the configuration.
|
||||
- You can't rewrite others module parameters using this
|
||||
required: false
|
||||
default: {}
|
||||
|
|
|
@ -60,16 +60,16 @@ options:
|
|||
required: false
|
||||
default: null
|
||||
msg:
|
||||
description:
|
||||
description:
|
||||
- The contents of the annotation message, in plain text. Limited to 256 characters. Required for annotation.
|
||||
required: false
|
||||
default: null
|
||||
annotated_by:
|
||||
annotated_by:
|
||||
description:
|
||||
- The person or robot who the annotation should be attributed to.
|
||||
required: false
|
||||
default: "Ansible"
|
||||
level:
|
||||
level:
|
||||
description:
|
||||
- one of INFO/WARN/ERROR, defaults to INFO if not supplied. May affect display.
|
||||
choices: ['INFO', 'WARN', 'ERROR']
|
||||
|
|
|
@ -222,7 +222,7 @@ class Host(object):
|
|||
if proxy_id:
|
||||
parameters['proxy_hostid'] = proxy_id
|
||||
if visible_name:
|
||||
parameters['name'] = visible_name
|
||||
parameters['name'] = visible_name
|
||||
host_list = self._zapi.host.create(parameters)
|
||||
if len(host_list) >= 1:
|
||||
return host_list['hostids'][0]
|
||||
|
@ -237,7 +237,7 @@ class Host(object):
|
|||
if proxy_id:
|
||||
parameters['proxy_hostid'] = proxy_id
|
||||
if visible_name:
|
||||
parameters['name'] = visible_name
|
||||
parameters['name'] = visible_name
|
||||
self._zapi.host.update(parameters)
|
||||
interface_list_copy = exist_interface_list
|
||||
if interfaces:
|
||||
|
|
|
@ -30,7 +30,7 @@ short_description: Zabbix host macro creates/updates/deletes
|
|||
description:
|
||||
- manages Zabbix host macros, it can create, update or delete them.
|
||||
version_added: "2.0"
|
||||
author:
|
||||
author:
|
||||
- "(@cave)"
|
||||
- Dean Hailin Song
|
||||
requirements:
|
||||
|
|
|
@ -93,7 +93,7 @@ RETURN = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
# Create a new server
|
||||
- a10_server:
|
||||
- a10_server:
|
||||
host: a10.mydomain.com
|
||||
username: myadmin
|
||||
password: mypassword
|
||||
|
|
|
@ -81,7 +81,7 @@ RETURN = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
# Create a new server
|
||||
- a10_server:
|
||||
- a10_server:
|
||||
host: a10.mydomain.com
|
||||
username: myadmin
|
||||
password: mypassword
|
||||
|
|
|
@ -88,7 +88,7 @@ RETURN = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
# Create a new service-group
|
||||
- a10_service_group:
|
||||
- a10_service_group:
|
||||
host: a10.mydomain.com
|
||||
username: myadmin
|
||||
password: mypassword
|
||||
|
|
|
@ -86,7 +86,7 @@ RETURN = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
# Create a new virtual server
|
||||
- a10_virtual_server:
|
||||
- a10_virtual_server:
|
||||
host: a10.mydomain.com
|
||||
username: myadmin
|
||||
password: mypassword
|
||||
|
|
|
@ -173,39 +173,39 @@ author: "Jan-Piet Mens (@jpmens)"
|
|||
|
||||
EXAMPLES='''
|
||||
- name: download foo.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
mode: 0440
|
||||
|
||||
- name: download file and force basic auth
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
force_basic_auth: yes
|
||||
|
||||
- name: download file with custom HTTP headers
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
headers: 'key:value,key:value'
|
||||
|
||||
- name: download file with check (sha256)
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
checksum: sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
|
||||
|
||||
- name: download file with check (md5)
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
get_url:
|
||||
url: http://example.com/path/file.conf
|
||||
dest: /etc/foo.conf
|
||||
checksum: md5:66dffb5228a211e61d6d7ef4a86f5758
|
||||
|
||||
- name: download file from a file path
|
||||
get_url:
|
||||
url: "file:///tmp/afile.txt"
|
||||
dest: /tmp/afilecopy.txt
|
||||
get_url:
|
||||
url: "file:///tmp/afile.txt"
|
||||
dest: /tmp/afilecopy.txt
|
||||
'''
|
||||
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlsplit
|
||||
|
@ -427,7 +427,7 @@ def main():
|
|||
if os.path.exists(dest):
|
||||
backup_file = module.backup_local(dest)
|
||||
shutil.copyfile(tmpsrc, dest)
|
||||
except Exception:
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
os.remove(tmpsrc)
|
||||
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err)))
|
||||
|
|
|
@ -42,7 +42,7 @@ notes:
|
|||
- This module returns an 'in memory' base64 encoded version of the file, take into account that this will require at least twice the RAM as the original file size.
|
||||
- "See also: M(fetch)"
|
||||
requirements: []
|
||||
author:
|
||||
author:
|
||||
- "Ansible Core Team"
|
||||
- "Michael DeHaan"
|
||||
'''
|
||||
|
|
|
@ -37,7 +37,7 @@ extends_documentation_fragment: cloudengine
|
|||
options:
|
||||
commands:
|
||||
description:
|
||||
- The commands to send to the remote HUAWEI CloudEngine device
|
||||
- The commands to send to the remote HUAWEI CloudEngine device
|
||||
over the configured provider. The resulting output from the
|
||||
command is returned. If the I(wait_for) argument is provided,
|
||||
the module is not returned until the condition is satisfied
|
||||
|
|
|
@ -163,13 +163,13 @@ class Default(FactsBase):
|
|||
def populate(self):
|
||||
|
||||
data = self.runner.get_command('show version | display-xml')
|
||||
xml_data = ET.fromstring(data)
|
||||
xml_data = ET.fromstring(data)
|
||||
|
||||
self.facts['name'] = self.parse_name(xml_data)
|
||||
self.facts['version'] = self.parse_version(xml_data)
|
||||
|
||||
data = self.runner.get_command('show system | display-xml')
|
||||
xml_data = ET.fromstring(data)
|
||||
xml_data = ET.fromstring(data)
|
||||
|
||||
self.facts['servicetag'] = self.parse_serialnum(xml_data)
|
||||
self.facts['model'] = self.parse_model(xml_data)
|
||||
|
@ -178,14 +178,14 @@ class Default(FactsBase):
|
|||
self.facts['hostname'] = self.parse_hostname(data)
|
||||
|
||||
def parse_name(self, data):
|
||||
sw_name = data.find('./data/system-sw-state/sw-version/sw-name')
|
||||
sw_name = data.find('./data/system-sw-state/sw-version/sw-name')
|
||||
if sw_name is not None:
|
||||
return sw_name.text
|
||||
else:
|
||||
return ""
|
||||
|
||||
def parse_version(self, data):
|
||||
sw_ver = data.find('./data/system-sw-state/sw-version/sw-version')
|
||||
sw_ver = data.find('./data/system-sw-state/sw-version/sw-version')
|
||||
if sw_ver is not None:
|
||||
return sw_ver.text
|
||||
else:
|
||||
|
@ -197,14 +197,14 @@ class Default(FactsBase):
|
|||
return match.group(1)
|
||||
|
||||
def parse_model(self, data):
|
||||
prod_name = data.find('./data/system/node/mfg-info/product-name')
|
||||
prod_name = data.find('./data/system/node/mfg-info/product-name')
|
||||
if prod_name is not None:
|
||||
return prod_name.text
|
||||
else:
|
||||
return ""
|
||||
|
||||
def parse_serialnum(self, data):
|
||||
svc_tag = data.find('./data/system/node/unit/mfg-info/service-tag')
|
||||
svc_tag = data.find('./data/system/node/unit/mfg-info/service-tag')
|
||||
if svc_tag is not None:
|
||||
return svc_tag.text
|
||||
else:
|
||||
|
@ -219,7 +219,7 @@ class Hardware(FactsBase):
|
|||
def populate(self):
|
||||
|
||||
data = self.runner.get_command('show version | display-xml')
|
||||
xml_data = ET.fromstring(data)
|
||||
xml_data = ET.fromstring(data)
|
||||
|
||||
self.facts['cpu_arch'] = self.parse_cpu_arch(xml_data)
|
||||
|
||||
|
@ -231,7 +231,7 @@ class Hardware(FactsBase):
|
|||
self.facts['memfree_mb'] = int(match[2]) / 1024
|
||||
|
||||
def parse_cpu_arch(self, data):
|
||||
cpu_arch = data.find('./data/system-sw-state/sw-version/cpu-arch')
|
||||
cpu_arch = data.find('./data/system-sw-state/sw-version/cpu-arch')
|
||||
if cpu_arch is not None:
|
||||
return cpu_arch.text
|
||||
else:
|
||||
|
@ -262,7 +262,7 @@ class Interfaces(FactsBase):
|
|||
|
||||
data = self.runner.get_command('show interface | display-xml')
|
||||
|
||||
xml_data = ET.fromstring(data)
|
||||
xml_data = ET.fromstring(data)
|
||||
|
||||
self.facts['interfaces'] = self.populate_interfaces(xml_data)
|
||||
self.facts['neighbors'] = self.populate_neighbors(xml_data)
|
||||
|
@ -274,11 +274,11 @@ class Interfaces(FactsBase):
|
|||
intf = dict()
|
||||
name = self.parse_item(interface, 'name')
|
||||
|
||||
intf['description'] = self.parse_item(interface, 'description')
|
||||
intf['description'] = self.parse_item(interface, 'description')
|
||||
intf['duplex'] = self.parse_item(interface, 'duplex')
|
||||
intf['primary_ipv4'] = self.parse_primary_ipv4(interface)
|
||||
intf['primary_ipv4'] = self.parse_primary_ipv4(interface)
|
||||
intf['secondary_ipv4'] = self.parse_secondary_ipv4(interface)
|
||||
intf['ipv6'] = self.parse_ipv6_address(interface)
|
||||
intf['ipv6'] = self.parse_ipv6_address(interface)
|
||||
intf['mtu'] = self.parse_item(interface, 'mtu')
|
||||
intf['type'] = self.parse_item(interface, 'type')
|
||||
|
||||
|
@ -287,7 +287,7 @@ class Interfaces(FactsBase):
|
|||
for interface in interfaces.findall('./data/interfaces-state/interface'):
|
||||
name = self.parse_item(interface, 'name')
|
||||
intf = int_facts[name]
|
||||
intf['bandwidth'] = self.parse_item(interface, 'speed')
|
||||
intf['bandwidth'] = self.parse_item(interface, 'speed')
|
||||
intf['adminstatus'] = self.parse_item(interface, 'admin-status')
|
||||
intf['operstatus'] = self.parse_item(interface, 'oper-status')
|
||||
intf['macaddress'] = self.parse_item(interface, 'phys-address')
|
||||
|
@ -295,20 +295,20 @@ class Interfaces(FactsBase):
|
|||
for interface in interfaces.findall('./data/ports/ports-state/port'):
|
||||
name = self.parse_item(interface, 'name')
|
||||
fanout = self.parse_item(interface, 'fanout-state')
|
||||
mediatype = self.parse_item(interface, 'media-type')
|
||||
mediatype = self.parse_item(interface, 'media-type')
|
||||
|
||||
typ, sname = name.split('-eth')
|
||||
|
||||
if fanout == "BREAKOUT_1x1":
|
||||
name = "ethernet" + sname
|
||||
intf = int_facts[name]
|
||||
intf['mediatype'] = mediatype
|
||||
intf['mediatype'] = mediatype
|
||||
else:
|
||||
#TODO: Loop for the exact subport
|
||||
for subport in xrange(1, 5):
|
||||
name = "ethernet" + sname + ":" + str(subport)
|
||||
intf = int_facts[name]
|
||||
intf['mediatype'] = mediatype
|
||||
intf['mediatype'] = mediatype
|
||||
|
||||
return int_facts
|
||||
|
||||
|
@ -368,10 +368,10 @@ class Interfaces(FactsBase):
|
|||
fact = dict()
|
||||
fact['host'] = rem_sys_name.text
|
||||
rem_sys_port = interface.find('./lldp-rem-neighbor-info/info/rem-lldp-port-id')
|
||||
fact['port'] = rem_sys_port.text
|
||||
fact['port'] = rem_sys_port.text
|
||||
lldp_facts[name].append(fact)
|
||||
|
||||
return lldp_facts
|
||||
return lldp_facts
|
||||
|
||||
FACT_SUBSETS = dict(
|
||||
default=Default,
|
||||
|
|
|
@ -236,7 +236,7 @@ class Interfaces(FactsBase):
|
|||
fact['address'] = matc.group(2)
|
||||
fact['masklen'] = matc.group(3)
|
||||
facts[intf].append(fact)
|
||||
return facts
|
||||
return facts
|
||||
|
||||
def populate_interfaces(self, interfaces, desc, properties):
|
||||
facts = dict()
|
||||
|
|
|
@ -77,8 +77,8 @@ notes:
|
|||
- This module requires Dell OS9 version 9.10.0.1P13 or above.
|
||||
|
||||
- This module requires to increase the ssh connection rate limit.
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
as well.
|
||||
|
||||
"""
|
||||
|
|
|
@ -148,8 +148,8 @@ notes:
|
|||
- This module requires Dell OS9 version 9.10.0.1P13 or above.
|
||||
|
||||
- This module requires to increase the ssh connection rate limit.
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
as well.
|
||||
"""
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ notes:
|
|||
- This module requires Dell OS9 version 9.10.0.1P13 or above.
|
||||
|
||||
- This module requires to increase the ssh connection rate limit.
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
Use the following command I(ip ssh connection-rate-limit 60)
|
||||
to configure the same. This can be done via M(dellos9_config) module
|
||||
as well.
|
||||
"""
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ options:
|
|||
default: null
|
||||
|
||||
record_value:
|
||||
description:
|
||||
description:
|
||||
- "Record value. HTTPRED: <redirection URL>, MX: <priority> <target name>, NS: <name server>, PTR: <target name>, SRV: <priority> <weight> <port> <target name>, TXT: <text value>"
|
||||
- "If record_value is not specified; no changes will be made and the record will be returned in 'result' (in other words, this module can be used to fetch a record's current id, type, and ttl)"
|
||||
required: false
|
||||
|
@ -87,7 +87,7 @@ options:
|
|||
version_added: 1.5.1
|
||||
|
||||
notes:
|
||||
- The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP.
|
||||
- The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP.
|
||||
- This module returns record(s) in the "result" element when 'state' is set to 'present'. This value can be be registered and used in your playbooks.
|
||||
|
||||
requirements: [ hashlib, hmac ]
|
||||
|
|
|
@ -295,7 +295,7 @@ class HAProxy(object):
|
|||
"""
|
||||
Wait for a service to reach the specified status. Try RETRIES times
|
||||
with INTERVAL seconds of sleep in between. If the service has not reached
|
||||
the expected status in that time, the module will fail. If the service was
|
||||
the expected status in that time, the module will fail. If the service was
|
||||
not found, the module will fail.
|
||||
"""
|
||||
for i in range(1, self.wait_retries):
|
||||
|
|
|
@ -49,7 +49,7 @@ options:
|
|||
format of the configuration file. Devices support three
|
||||
configuration file formats. By default, the configuration
|
||||
from the device is returned as text. The other option xml.
|
||||
If the xml option is chosen, the configuration file is
|
||||
If the xml option is chosen, the configuration file is
|
||||
returned as both xml and json.
|
||||
required: false
|
||||
default: text
|
||||
|
|
|
@ -31,7 +31,7 @@ description:
|
|||
options: {}
|
||||
author: "Andy Hill (@andyhky)"
|
||||
notes:
|
||||
- Requires lldpd running and lldp enabled on switches
|
||||
- Requires lldpd running and lldp enabled on switches
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -83,7 +83,7 @@ def main():
|
|||
data = {'lldp': lldp_output['lldp']}
|
||||
module.exit_json(ansible_facts=data)
|
||||
except TypeError:
|
||||
module.fail_json(msg="lldpctl command failed. is lldpd running?")
|
||||
module.fail_json(msg="lldpctl command failed. is lldpd running?")
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue