1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

PEP 8 W291 whitespace cleanup.

This commit is contained in:
Matt Clay 2017-01-27 15:20:31 -08:00
parent 95789f3949
commit d913f69ba1
166 changed files with 493 additions and 565 deletions

View file

@ -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 ABQ_xxx: Defines a hosts itself by Abiquo VM name label
all: Contains all hosts defined in Abiquo user's enterprise 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 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 imagetemplate: Creates a host group for each image template containing all hosts using it
@ -110,7 +110,7 @@ def cache_available(config):
return False return False
def generate_inv_from_api(enterprise_entity,config): def generate_inv_from_api(enterprise_entity,config):
try: try:
inventory['all'] = {} inventory['all'] = {}
inventory['all']['children'] = [] 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')) meta_entity = next(link for link in (vmcollection['links']) if (link['rel']=='metadata'))
try: try:
metadata = api_get(meta_entity,config) metadata = api_get(meta_entity,config)
if (config.getfloat("api","version") >= 3.0): if (config.getfloat("api","version") >= 3.0):
vm_metadata = metadata['metadata'] vm_metadata = metadata['metadata']
else: else:
vm_metadata = metadata['metadata']['metadata'] vm_metadata = metadata['metadata']['metadata']

View file

@ -133,7 +133,7 @@ class LibcloudInventory(object):
if config.has_option('driver', 'path'): if config.has_option('driver', 'path'):
self.path = config.get('driver', 'path') self.path = config.get('driver', 'path')
if config.has_option('driver', 'api_version'): 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)) Driver = get_driver(getattr(Provider, self.provider))
@ -163,8 +163,8 @@ class LibcloudInventory(object):
def do_api_calls_update_cache(self): 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() self.get_nodes()
@ -193,7 +193,7 @@ class LibcloudInventory(object):
def add_node(self, node): def add_node(self, node):
''' '''
Adds a node to the inventory and index, as long as it is Adds a node to the inventory and index, as long as it is
addressable addressable
''' '''
# Only want running instances # Only want running instances

View file

@ -32,7 +32,7 @@ The order of precedence is command line arguments, environment variables,
and finally the [default] profile found in ~/.azure/credentials. and finally the [default] profile found in ~/.azure/credentials.
If using a credentials file, it should be an ini formatted file with one or 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 [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 or with an environment variable. The keys in a profile will match the
list of command line arguments below. list of command line arguments below.
@ -42,7 +42,7 @@ in your ~/.azure/credentials file, or a service principal or Active Directory
user. user.
Command line arguments: Command line arguments:
- profile - profile
- client_id - client_id
- secret - secret
- subscription_id - subscription_id
@ -61,7 +61,7 @@ Environment variables:
Run for Specific Host 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: required. For a specific host, this script returns the following variables:
{ {

View file

@ -7,7 +7,7 @@ import json
def initialize(): def initialize():
''' '''
This function initializes the FreeIPA/IPA API. This function requires 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. order for this to work.
''' '''
@ -68,8 +68,8 @@ def parse_args():
def print_host(host): def print_host(host):
''' '''
This function is really a stub, it could return variables to be used 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 a playbook. However, at this point there are no variables stored in
FreeIPA/IPA. FreeIPA/IPA.
This function expects one string, this hostname to lookup variables for. This function expects one string, this hostname to lookup variables for.

View file

@ -3,7 +3,7 @@
SoftLayer external inventory script. SoftLayer external inventory script.
The SoftLayer Python API client is required. Use `pip install softlayer` to install it. 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 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: ~/.softlayer or /etc/softlayer.conf. For more information see the SL API at:
- https://softlayer-python.readthedocs.org/en/latest/config_file.html - https://softlayer-python.readthedocs.org/en/latest/config_file.html

View file

@ -18,10 +18,10 @@ output of "spacewalk-report system-groups-systems|inventory".
Tested with Ansible 1.9.2 and spacewalk 2.3 Tested with Ansible 1.9.2 and spacewalk 2.3
""" """
# #
# Author:: Jon Miller <jonEbird@gmail.com> # Author:: Jon Miller <jonEbird@gmail.com>
# Copyright:: Copyright (c) 2013, Jon Miller # Copyright:: Copyright (c) 2013, Jon Miller
# #
# Extended for support of multiple organizations and # Extended for support of multiple organizations and
# adding the "_meta" dictionary to --list output by # adding the "_meta" dictionary to --list output by
# Bernhard Lichtinger <bernhard.lichtinger@lrz.de> 2015 # 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 # 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 # the Free Software Foundation, either version 2 of the License, or (at
# your option) any later version. # your option) any later version.
# #
# This program is distributed in the hope that it will be useful, but # This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from __future__ import print_function from __future__ import print_function
@ -109,7 +109,7 @@ parser.add_option('--host', default=None, dest="host",
parser.add_option('-H', '--human', dest="human", parser.add_option('-H', '--human', dest="human",
default=False, action="store_true", default=False, action="store_true",
help="Produce a friendlier version of either server list or host detail") 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") help="Limit to spacewalk organization number")
parser.add_option('-p', default=False, dest="prefix_org_name", action="store_true", parser.add_option('-p', default=False, dest="prefix_org_name", action="store_true",
help="Prefix the group name with the organization number") help="Prefix the group name with the organization number")

View file

@ -102,7 +102,7 @@ pygments_style = 'sphinx'
highlight_language = 'YAML+Jinja' 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_: #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 = """ rst_epilog = """
.. |acapi| replace:: *Ansible Core API Guide* .. |acapi| replace:: *Ansible Core API Guide*

View file

@ -102,7 +102,7 @@ pygments_style = 'sphinx'
highlight_language = 'YAML+Jinja' 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_: #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 = """ rst_epilog = """
.. |acapi| replace:: *Ansible Core API Guide* .. |acapi| replace:: *Ansible Core API Guide*

View file

@ -54,12 +54,12 @@ class GalaxyLogin(object):
self.get_credentials() self.get_credentials()
def get_credentials(self): 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) " 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) ", 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("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) " if you do not want to enter your password." + u'\n\n', screen_only=True)
try: try:
@ -90,7 +90,7 @@ class GalaxyLogin(object):
for token in tokens: for token in tokens:
if token['note'] == 'ansible-galaxy login': if token['note'] == 'ansible-galaxy login':
display.vvvvv('removing token: %s' % token['token_last_eight']) 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, 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,) url_password=self.github_password, method='DELETE', force_basic_auth=True,)
except HTTPError as e: except HTTPError as e:

View file

@ -244,7 +244,7 @@ class GalaxyRole(object):
elif role_data.get('github_branch', None): elif role_data.get('github_branch', None):
self.version = role_data['github_branch'] self.version = role_data['github_branch']
else: else:
self.version = 'master' self.version = 'master'
elif 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]: 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)) raise AnsibleError("- the specified version (%s) of %s was not found in the list of available versions (%s)." % (self.version, self.name, role_versions))

View file

@ -51,10 +51,10 @@ class GalaxyToken(object):
f = open(self.file,'w') f = open(self.file,'w')
f.close() f.close()
os.chmod(self.file,S_IRUSR|S_IWUSR) # owner has +rw 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') return open(self.file, 'r')
def set(self, token): def set(self, token):
self.config['token'] = token self.config['token'] = token
self.save() self.save()

View file

@ -78,7 +78,7 @@ class InventoryParser(object):
self.groups[group] = Group(name=group) self.groups[group] = Group(name=group)
if isinstance(group_data, dict): if isinstance(group_data, dict):
#make sure they are dicts #make sure they are dicts
for section in ['vars', 'children', 'hosts']: for section in ['vars', 'children', 'hosts']:
if section in group_data and isinstance(group_data[section], string_types): if section in group_data and isinstance(group_data[section], string_types):
group_data[section] = { group_data[section]: None} group_data[section] = { group_data[section]: None}

View file

@ -375,10 +375,10 @@ class AzureRMModuleBase(object):
''' '''
dependencies = dict() dependencies = dict()
if enum_modules: if enum_modules:
for module_name in enum_modules: for module_name in enum_modules:
mod = importlib.import_module(module_name) mod = importlib.import_module(module_name)
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass): 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("dependencies: ");
self.log(str(dependencies)) self.log(str(dependencies))
serializer = Serializer(classes=dependencies) serializer = Serializer(classes=dependencies)

View file

@ -209,7 +209,7 @@ def _get_gcp_credentials(module, require_valid_json=True, check_libcloud=False):
'project_id': project_id} 'project_id': project_id}
def _validate_credentials_file(module, credentials_file, require_valid_json=True, check_libcloud=False): def _validate_credentials_file(module, credentials_file, require_valid_json=True, check_libcloud=False):
""" """
Check for valid credentials file. Check for valid credentials file.
Optionally check for JSON format and if libcloud supports JSON. 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=[]): def get_google_cloud_credentials(module, scopes=[]):
""" """
Get credentials object for use with Google Cloud client. Get credentials object for use with Google Cloud client.
To connect via libcloud, don't use this function, use gcp_connect instead. For 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 :param scopes: list of scopes
:type module: ``list`` of URIs :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': ...} params dict {'service_account_email': '...', 'credentials_file': '...', 'project_id': ...}
:rtype: ``tuple`` :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. 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. 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. This function returns an httplib2 (compatible) object that can be provided to the Google Python API client.

View file

@ -87,7 +87,7 @@ options:
description: description:
- Optional attribute which with to sort the results. - Optional attribute which with to sort the results.
- If specifying 'tag', the 'tag_name' parameter is required. - 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'] 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 default: null
required: false required: false

View file

@ -43,7 +43,7 @@ options:
name: name:
description: description:
- Name of the customer gateway. - Name of the customer gateway.
required: true required: true
state: state:
description: description:
- Create or terminate the Customer Gateway. - Create or terminate the Customer Gateway.
@ -108,7 +108,7 @@ gateway.customer_gateways:
type: type:
description: encryption type. description: encryption type.
returned: when gateway exists and is available. returned: when gateway exists and is available.
sample: ipsec.1 sample: ipsec.1
type: string type: string
''' '''
@ -178,13 +178,13 @@ class Ec2CustomerGatewayManager:
DryRun=False, DryRun=False,
Filters=[ Filters=[
{ {
'Name': 'state', 'Name': 'state',
'Values': [ 'Values': [
'available', 'available',
] ]
}, },
{ {
'Name': 'ip-address', 'Name': 'ip-address',
'Values': [ 'Values': [
ip_address, ip_address,
] ]

View file

@ -129,7 +129,7 @@ class ElbManager:
to report it out-of-service""" to report it out-of-service"""
for lb in self.lbs: for lb in self.lbs:
initial_state = self._get_instance_health(lb) initial_state = self._get_instance_health(lb)
if initial_state is None: if initial_state is None:
# Instance isn't registered with this load # Instance isn't registered with this load
# balancer. Ignore it and try the next one. # balancer. Ignore it and try the next one.

View file

@ -163,7 +163,7 @@ def main():
if key: if key:
# existing key found # existing key found
if key_material: 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. # to a temporary name and make ec2 calculate the fingerprint for us.
# #
# http://blog.jbrowne.com/?p=23 # http://blog.jbrowne.com/?p=23
@ -186,7 +186,7 @@ def main():
if key.fingerprint != tmpfingerprint: if key.fingerprint != tmpfingerprint:
if not module.check_mode: if not module.check_mode:
key.delete() key.delete()
key = ec2.import_key_pair(name, key_material) key = ec2.import_key_pair(name, key_material)
if wait: if wait:
start = time.time() start = time.time()
@ -211,7 +211,7 @@ def main():
key = ec2.import_key_pair(name, key_material) key = ec2.import_key_pair(name, key_material)
else: 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 retrieve the private key
''' '''
key = ec2.create_key_pair(name) key = ec2.create_key_pair(name)

View file

@ -113,7 +113,7 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- aws - aws
- ec2 - ec2
requires: requires:
- "boto >= 2.39.0" - "boto >= 2.39.0"
""" """

View file

@ -20,7 +20,7 @@ ANSIBLE_METADATA = {'status': ['stableinterface'],
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: ec2_tag module: ec2_tag
short_description: create and remove tag(s) to ec2 resources. short_description: create and remove tag(s) to ec2 resources.
description: 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. - 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: options:
resource: resource:
description: description:
- The EC2 resource id. - The EC2 resource id.
required: true required: true
default: null default: null
aliases: [] aliases: []
state: state:
description: description:
@ -97,10 +97,10 @@ EXAMPLES = '''
region: eu-west-1 region: eu-west-1
resource: '{{ item.id }}' resource: '{{ item.id }}'
state: present state: present
tags: tags:
Name: dbserver Name: dbserver
Env: production Env: production
with_subelements: with_subelements:
- ec2_vol.results - ec2_vol.results
- volumes - volumes
@ -164,7 +164,7 @@ def main():
if set(tags.items()).issubset(set(tagdict.items())): if set(tags.items()).issubset(set(tagdict.items())):
module.exit_json(msg="Tags already exists in %s." %resource, changed=False) module.exit_json(msg="Tags already exists in %s." %resource, changed=False)
else: else:
for (key, value) in set(tags.items()): for (key, value) in set(tags.items()):
if (key, value) not in set(tagdict.items()): if (key, value) not in set(tagdict.items()):
dictadd[key] = value dictadd[key] = value
tagger = ec2.create_tags(resource, dictadd) tagger = ec2.create_tags(resource, dictadd)

View file

@ -101,7 +101,7 @@ options:
description: description:
- The resource_id of an existing DHCP options set. - The resource_id of an existing DHCP options set.
If this is specified, then it will override other settings, except tags 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 required: False
default: None default: None
version_added: "2.1" version_added: "2.1"

View file

@ -357,11 +357,11 @@ def remove_network_acl(client, module):
changed = True changed = True
result[nacl_id] = "Successfully deleted" result[nacl_id] = "Successfully deleted"
return changed, result return changed, result
if not assoc_ids: if not assoc_ids:
delete_network_acl(nacl_id, client, module) delete_network_acl(nacl_id, client, module)
changed = True changed = True
result[nacl_id] = "Successfully deleted" result[nacl_id] = "Successfully deleted"
return changed, result 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}]) {'Name': 'tag:Name', 'Values': params}])
except botocore.exceptions.ClientError as e: except botocore.exceptions.ClientError as e:
module.fail_json(msg=str(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(): def main():

View file

@ -44,7 +44,7 @@ options:
tags: tags:
description: description:
- Dictionary of tags to look for and apply when creating a Peering Connection. - Dictionary of tags to look for and apply when creating a Peering Connection.
required: false required: false
state: state:
description: description:
- Create, delete, accept, reject a peering connection. - Create, delete, accept, reject a peering connection.
@ -67,7 +67,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: Accept local VPC peering request - name: Accept local VPC peering request
@ -87,7 +87,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: delete a local VPC peering Connection - name: delete a local VPC peering Connection
@ -108,7 +108,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: Accept peering connection from remote account - name: Accept peering connection from remote account
@ -129,7 +129,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: Reject a local VPC peering Connection - name: Reject a local VPC peering Connection
@ -149,7 +149,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: Accept a cross account VPC peering connection request - name: Accept a cross account VPC peering connection request
@ -174,7 +174,7 @@ EXAMPLES = '''
tags: tags:
Name: Peering connection for VPC 21 to VPC 22 Name: Peering connection for VPC 21 to VPC 22
CostCode: CC1234 CostCode: CC1234
Project: phoenix Project: phoenix
register: vpc_peer register: vpc_peer
- name: Reject a cross account VPC peering Connection - name: Reject a cross account VPC peering Connection
@ -269,7 +269,7 @@ def create_peer_connection(client, module):
changed = True changed = True
return (changed, peering_conn['VpcPeeringConnection']['VpcPeeringConnectionId']) return (changed, peering_conn['VpcPeeringConnection']['VpcPeeringConnectionId'])
except botocore.exceptions.ClientError as e: except botocore.exceptions.ClientError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
def peer_status(client, module): def peer_status(client, module):

View file

@ -432,7 +432,7 @@ def ensure_vgw_present(client, module):
else: else:
# attach the vgw to the supplied vpc # attach the vgw to the supplied vpc
attached_vgw = attach_vgw(client, module, vpn_gateway_id) 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 changed = True
# if params['VpcId'] is not provided, check the vgw is attached to a vpc. if so, detach it. # 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': if existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
# detach the vpc from the vgw # detach the vpc from the vgw
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId'] 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 changed = True
vgw = find_vgw(client, module, [vpn_gateway_id]) 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 existing_vgw[0]['VpcAttachments'] != [] and existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
if params['VpcId']: if params['VpcId']:
if params['VpcId'] != existing_vgw[0]['VpcAttachments'][0]['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: else:
# detach the vpc from the vgw # detach the vpc from the vgw
detach_vgw(client, module, params['VpnGatewayIds'], params['VpcId']) detach_vgw(client, module, params['VpnGatewayIds'], params['VpcId'])
deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds']) deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds'])
changed = True changed = True
else: else:
# attempt to detach any attached vpcs # attempt to detach any attached vpcs
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId'] vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId']
detach_vgw(client, module, params['VpnGatewayIds'], vpc_to_detach) detach_vgw(client, module, params['VpnGatewayIds'], vpc_to_detach)
deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds']) deleted_vgw = delete_vgw(client, module, params['VpnGatewayIds'])
@ -519,7 +519,7 @@ def ensure_vgw_absent(client, module):
else: else:
#Check that a name and type argument has been supplied if no vgw-id #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'): 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) existing_vgw = find_vgw(client, module)
if existing_vgw != [] and existing_vgw[0]['State'] != 'deleted': 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 existing_vgw[0]['VpcAttachments'] != [] and existing_vgw[0]['VpcAttachments'][0]['State'] == 'attached':
if params['VpcId']: if params['VpcId']:
if params['VpcId'] != existing_vgw[0]['VpcAttachments'][0]['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: else:
# detach the vpc from the vgw # detach the vpc from the vgw
detach_vgw(client, module, vpn_gateway_id, params['VpcId']) detach_vgw(client, module, vpn_gateway_id, params['VpcId'])
#now that the vpc has been detached, delete the vgw #now that the vpc has been detached, delete the vgw
@ -538,7 +538,7 @@ def ensure_vgw_absent(client, module):
changed = True changed = True
else: else:
# attempt to detach any attached vpcs # attempt to detach any attached vpcs
vpc_to_detach = existing_vgw[0]['VpcAttachments'][0]['VpcId'] 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 changed = True
@ -562,7 +562,7 @@ def ensure_vgw_absent(client, module):
def main(): def main():
argument_spec = ec2_argument_spec() argument_spec = ec2_argument_spec()
argument_spec.update(dict( argument_spec.update(dict(
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
region=dict(required=True), region=dict(required=True),
name=dict(), name=dict(),
vpn_gateway_id=dict(), vpn_gateway_id=dict(),

View file

@ -36,7 +36,7 @@ options:
default: None default: None
vpn_gateway_ids: vpn_gateway_ids:
description: 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 required: false
default: None default: None
author: "Nick Aslanidis (@naslanidis)" author: "Nick Aslanidis (@naslanidis)"
@ -66,7 +66,7 @@ EXAMPLES = '''
ec2_vpc_vgw_facts: ec2_vpc_vgw_facts:
region: ap-southeast-2 region: ap-southeast-2
profile: production profile: production
vpn_gateway_ids: vgw-c432f6a7 vpn_gateway_ids: vgw-c432f6a7
register: vgw_facts register: vgw_facts
''' '''
@ -83,7 +83,7 @@ virtual_gateways:
"key": "Name", "key": "Name",
"value": "TEST-VGW" "value": "TEST-VGW"
} }
], ],
"type": "ipsec.1", "type": "ipsec.1",
"vpc_attachments": [ "vpc_attachments": [
{ {

View file

@ -28,7 +28,7 @@ author: "Rick Mendes (@rickmendes)"
options: options:
instance_id: instance_id:
description: description:
- The instance id to get the password data from. - The instance id to get the password data from.
required: true required: true
key_file: key_file:
description: description:
@ -37,7 +37,7 @@ options:
key_passphrase: key_passphrase:
version_added: "2.0" version_added: "2.0"
description: 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 required: false
default: null default: null
wait: wait:

View file

@ -166,7 +166,7 @@ options:
default: null default: null
aws_secret_key: aws_secret_key:
description: 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 required: false
aliases: [ 'ec2_secret_key', 'secret_key' ] aliases: [ 'ec2_secret_key', 'secret_key' ]
aws_access_key: aws_access_key:
@ -296,7 +296,7 @@ EXAMPLES = '''
wait: yes wait: yes
wait_timeout: 600 wait_timeout: 600
tags: tags:
Name: pg1_test_name_tag Name: pg1_test_name_tag
register: rds register: rds
- local_action: - local_action:

View file

@ -30,7 +30,7 @@ options:
description: description:
- "Name of the s3 bucket" - "Name of the s3 bucket"
required: true required: true
default: null default: null
error_key: error_key:
description: description:
- "The object key name to use when a 4XX class error occurs. To remove an error key, set to None." - "The object key name to use when a 4XX class error occurs. To remove an error key, set to None."

View file

@ -81,16 +81,16 @@ EXAMPLES = """
name: "alarms" name: "alarms"
state: present state: present
display_name: "alarm SNS topic" display_name: "alarm SNS topic"
delivery_policy: delivery_policy:
http: http:
defaultHealthyRetryPolicy: defaultHealthyRetryPolicy:
minDelayTarget: 2 minDelayTarget: 2
maxDelayTarget: 4 maxDelayTarget: 4
numRetries: 3 numRetries: 3
numMaxDelayRetries: 5 numMaxDelayRetries: 5
backoffFunction: "<linear|arithmetic|geometric|exponential>" backoffFunction: "<linear|arithmetic|geometric|exponential>"
disableSubscriptionOverrides: True disableSubscriptionOverrides: True
defaultThrottlePolicy: defaultThrottlePolicy:
maxReceivesPerSecond: 10 maxReceivesPerSecond: 10
subscriptions: subscriptions:
- endpoint: "my_email_address@example.com" - endpoint: "my_email_address@example.com"

View file

@ -86,19 +86,19 @@ extends_documentation_fragment:
""" """
RETURN = ''' RETURN = '''
default_visibility_timeout: default_visibility_timeout:
description: The default visibility timeout in seconds. description: The default visibility timeout in seconds.
returned: always returned: always
sample: 30 sample: 30
delivery_delay: delivery_delay:
description: The delivery delay in seconds. description: The delivery delay in seconds.
returned: always returned: always
sample: 0 sample: 0
maximum_message_size: maximum_message_size:
description: The maximum message size in bytes. description: The maximum message size in bytes.
returned: always returned: always
sample: 262144 sample: 262144
message_retention_period: message_retention_period:
description: The message retention period in seconds. description: The message retention period in seconds.
returned: always returned: always
sample: 345600 sample: 345600
@ -110,7 +110,7 @@ queue_arn:
description: The queue's Amazon resource name (ARN). description: The queue's Amazon resource name (ARN).
returned: on successful creation or update of the queue returned: on successful creation or update of the queue
sample: 'arn:aws:sqs:us-east-1:199999999999:queuename-987d2de0' 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. description: The receive message wait time in seconds.
returned: always returned: always
sample: 0 sample: 0
@ -179,7 +179,7 @@ def create_or_update_sqs_queue(connection, module):
try: try:
queue = connection.get_queue(queue_name) queue = connection.get_queue(queue_name)
if queue: if queue:
# Update existing # Update existing
result['changed'] = update_sqs_queue(queue, check_mode=module.check_mode, **queue_attributes) result['changed'] = update_sqs_queue(queue, check_mode=module.check_mode, **queue_attributes)
else: else:
# Create new # Create new

View file

@ -43,7 +43,7 @@ options:
default: westus default: westus
deployment_mode: deployment_mode:
description: 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. In complete mode resources are deployed and existing resources in the resource group not included in the template are deleted.
required: false required: false
default: incremental default: incremental

View file

@ -114,7 +114,7 @@ EXAMPLES = '''
port: 443 port: 443
nodes: nodes:
- ipAddress: 10.11.22.123 - ipAddress: 10.11.22.123
privatePort: 80 privatePort: 80
state: present state: present
- name: Add node to an existing loadbalancer pool - name: Add node to an existing loadbalancer pool
@ -130,7 +130,7 @@ EXAMPLES = '''
port: 443 port: 443
nodes: nodes:
- ipAddress: 10.11.22.234 - ipAddress: 10.11.22.234
privatePort: 80 privatePort: 80
state: nodes_present state: nodes_present
- name: Remove node from an existing loadbalancer pool - name: Remove node from an existing loadbalancer pool
@ -146,7 +146,7 @@ EXAMPLES = '''
port: 443 port: 443
nodes: nodes:
- ipAddress: 10.11.22.234 - ipAddress: 10.11.22.234
privatePort: 80 privatePort: 80
state: nodes_absent state: nodes_absent
- name: Delete LoadbalancerPool - name: Delete LoadbalancerPool
@ -162,7 +162,7 @@ EXAMPLES = '''
port: 443 port: 443
nodes: nodes:
- ipAddress: 10.11.22.123 - ipAddress: 10.11.22.123
privatePort: 80 privatePort: 80
state: port_absent state: port_absent
- name: Delete Loadbalancer - name: Delete Loadbalancer
@ -178,7 +178,7 @@ EXAMPLES = '''
port: 443 port: 443
nodes: nodes:
- ipAddress: 10.11.22.123 - ipAddress: 10.11.22.123
privatePort: 80 privatePort: 80
state: absent state: absent
''' '''

View file

@ -138,7 +138,7 @@ options:
- exposed - exposed
force_kill: force_kill:
description: description:
- Use the kill command when stopping a running container. - Use the kill command when stopping a running container.
default: false default: false
required: false required: false
groups: groups:
@ -159,7 +159,7 @@ options:
recreated. Stop this behavior by setting C(ignore_image) to I(True). recreated. Stop this behavior by setting C(ignore_image) to I(True).
default: false default: false
required: false required: false
version_added: "2.2" version_added: "2.2"
image: image:
description: description:
- Repository path and tag used to create the container. If an image is not found or pull is true, the image - 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. any other mappings.
- If C(networks) parameter is provided, will inspect each network to see if there exists - 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. 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. 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 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. value encountered in the list of C(networks) is the one that will be used.
aliases: aliases:
- ports - ports
required: false 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 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 restarted. Use force_kill to kill a container rather than stopping it. Use keep_volumes to retain volumes associated
with a removed container.' 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.' state. Use force_kill to kill a container rather than stopping it.'
required: false required: false
default: started default: started
@ -518,7 +518,7 @@ EXAMPLES = '''
name: mycontainer name: mycontainer
state: present state: present
image: ubuntu:14.04 image: ubuntu:14.04
command: sleep infinity command: sleep infinity
- name: Stop a container - name: Stop a container
docker_container: docker_container:
@ -1210,7 +1210,7 @@ class Container(DockerBaseClass):
# assuming if the container was running, it must have been detached. # assuming if the container was running, it must have been detached.
detach = not (config.get('AttachStderr') and config.get('AttachStdout')) 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: if config.get('ExposedPorts') is not None:
expected_exposed = [re.sub(r'/.+$', '', p) for p in config.get('ExposedPorts', dict()).keys()] expected_exposed = [re.sub(r'/.+$', '', p) for p in config.get('ExposedPorts', dict()).keys()]
else: else:
@ -1874,7 +1874,7 @@ class ContainerManager(DockerBaseClass):
return self._get_container(container_id) return self._get_container(container_id)
def container_remove(self, container_id, link=False, force=False): 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.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['actions'].append(dict(removed=container_id, volume_state=volume_state, link=link, force=force))
self.results['changed'] = True self.results['changed'] = True

View file

@ -503,24 +503,24 @@ AUTH_PARAM_MAPPING = {
@contextmanager @contextmanager
def stdout_redirector(path_name): def stdout_redirector(path_name):
old_stdout = sys.stdout old_stdout = sys.stdout
fd = open(path_name, 'w') fd = open(path_name, 'w')
sys.stdout = fd sys.stdout = fd
try: try:
yield yield
finally: finally:
sys.stdout = old_stdout sys.stdout = old_stdout
def get_stdout(path_name): def get_stdout(path_name):
full_stdout = '' full_stdout = ''
last_line = '' last_line = ''
with open(path_name, 'r') as fd: with open(path_name, 'r') as fd:
for line in fd: for line in fd:
# strip terminal format/color chars # strip terminal format/color chars
new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii')) new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii'))
full_stdout += new_line full_stdout += new_line
if new_line.strip(): 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') last_line = new_line.strip().encode('utf-8')
fd.close() fd.close()
os.remove(path_name) os.remove(path_name)
@ -666,12 +666,12 @@ class ContainerManager(DockerBaseClass):
if self.pull: if self.pull:
pull_output = self.cmd_pull() pull_output = self.cmd_pull()
result['changed'] = pull_output['changed'] result['changed'] = pull_output['changed']
result['actions'] += pull_output['actions'] result['actions'] += pull_output['actions']
if self.build: if self.build:
build_output = self.cmd_build() build_output = self.cmd_build()
result['changed'] = build_output['changed'] result['changed'] = build_output['changed']
result['actions'] += build_output['actions'] result['actions'] += build_output['actions']
for service in self.project.services: for service in self.project.services:
@ -679,8 +679,8 @@ class ContainerManager(DockerBaseClass):
plan = service.convergence_plan(strategy=converge) plan = service.convergence_plan(strategy=converge)
if plan.action != 'noop': if plan.action != 'noop':
result['changed'] = True result['changed'] = True
result_action = dict(service=service.name) result_action = dict(service=service.name)
result_action[plan.action] = [] result_action[plan.action] = []
for container in plan.containers: for container in plan.containers:
result_action[plan.action].append(dict( result_action[plan.action].append(dict(
id=container.id, id=container.id,
@ -712,17 +712,17 @@ class ContainerManager(DockerBaseClass):
if self.stopped: if self.stopped:
stop_output = self.cmd_stop(service_names) stop_output = self.cmd_stop(service_names)
result['changed'] = stop_output['changed'] result['changed'] = stop_output['changed']
result['actions'] += stop_output['actions'] result['actions'] += stop_output['actions']
if self.restarted: if self.restarted:
restart_output = self.cmd_restart(service_names) restart_output = self.cmd_restart(service_names)
result['changed'] = restart_output['changed'] result['changed'] = restart_output['changed']
result['actions'] += restart_output['actions'] result['actions'] += restart_output['actions']
if self.scale: if self.scale:
scale_output = self.cmd_scale() scale_output = self.cmd_scale()
result['changed'] = scale_output['changed'] result['changed'] = scale_output['changed']
result['actions'] += scale_output['actions'] result['actions'] += scale_output['actions']
for service in self.project.services: for service in self.project.services:
@ -791,7 +791,7 @@ class ContainerManager(DockerBaseClass):
if not self.check_mode: if not self.check_mode:
for service in self.project.get_services(self.services, include_deps=False): for service in self.project.get_services(self.services, include_deps=False):
if 'image' not in service.options: if 'image' not in service.options:
continue continue
self.log('Pulling image for service %s' % service.name) self.log('Pulling image for service %s' % service.name)
# store the existing image ID # store the existing image ID
@ -809,16 +809,16 @@ class ContainerManager(DockerBaseClass):
try: try:
service.pull(ignore_pull_failures=False) service.pull(ignore_pull_failures=False)
except Exception as exc: 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 # store the new image ID
new_image_id = '' new_image_id = ''
try: try:
image = service.image() image = service.image()
if image and image.get('Id'): if image and image.get('Id'):
new_image_id = image['Id'] new_image_id = image['Id']
except NoSuchImageError as exc: 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 new_image_id != old_image_id:
# if a new image was pulled # if a new image was pulled
@ -856,13 +856,13 @@ class ContainerManager(DockerBaseClass):
try: try:
new_image_id = service.build(pull=True, no_cache=self.nocache) new_image_id = service.build(pull=True, no_cache=self.nocache)
except Exception as exc: 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 new_image_id not in old_image_id:
# if a new image was built # if a new image was built
result['changed'] = True result['changed'] = True
result['actions'].append(dict( result['actions'].append(dict(
service=service.name, service=service.name,
built_image=dict( built_image=dict(
name=service.image_name, name=service.image_name,
id=new_image_id id=new_image_id
@ -901,7 +901,7 @@ class ContainerManager(DockerBaseClass):
service_res = dict( service_res = dict(
service=service.name, service=service.name,
stop=[] stop=[]
) )
for container in service.containers(stopped=False): for container in service.containers(stopped=False):
result['changed'] = True result['changed'] = True
service_res['stop'].append(dict( service_res['stop'].append(dict(
@ -977,7 +977,7 @@ class ContainerManager(DockerBaseClass):
service.scale(int(self.scale[service.name])) service.scale(int(self.scale[service.name]))
except Exception as exc: except Exception as exc:
self.client.fail("Error scaling %s - %s" % (service.name, str(exc))) self.client.fail("Error scaling %s - %s" % (service.name, str(exc)))
result['actions'].append(service_res) result['actions'].append(service_res)
return result return result

View file

@ -155,12 +155,12 @@ def grant_check(module, gs, obj):
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllUsers'] grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllUsers']
if not grant: if not grant:
obj.set_acl('public-read') 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': if module.params.get('permission') == 'authenticated-read':
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllAuthenticatedUsers'] grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllAuthenticatedUsers']
if not grant: if not grant:
obj.set_acl('authenticated-read') 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: except gs.provider.storage_response_error as e:
module.fail_json(msg= str(e)) module.fail_json(msg= str(e))
return True return True
@ -240,7 +240,7 @@ def create_dirkey(module, gs, bucket, obj):
def path_check(path): def path_check(path):
if os.path.exists(path): if os.path.exists(path):
return True return True
else: else:
return False return False
@ -262,7 +262,7 @@ def transform_headers(headers):
def upload_gsfile(module, gs, bucket, obj, src, expiry): def upload_gsfile(module, gs, bucket, obj, src, expiry):
try: try:
bucket = gs.lookup(bucket) bucket = gs.lookup(bucket)
key = bucket.new_key(obj) key = bucket.new_key(obj)
key.set_contents_from_filename( key.set_contents_from_filename(
filename=src, filename=src,
headers=transform_headers(module.params.get('headers')) headers=transform_headers(module.params.get('headers'))
@ -326,7 +326,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
else: else:
upload_gsfile(module, gs, bucket, obj, src, expiration) upload_gsfile(module, gs, bucket, obj, src, expiration)
if not bucket_rc: if not bucket_rc:
create_bucket(module, gs, bucket) create_bucket(module, gs, bucket)
upload_gsfile(module, gs, bucket, obj, src, expiration) 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) module.fail_json(msg="Bucket or Bucket & object parameter is required.", failed=True)
def handle_create(module, gs, bucket, obj): def handle_create(module, gs, bucket, obj):
if bucket and not obj: if bucket and not obj:
if bucket_check(module, gs, bucket): if bucket_check(module, gs, bucket):
module.exit_json(msg="Bucket already exists.", changed=False) module.exit_json(msg="Bucket already exists.", changed=False)
else: else:
@ -366,7 +366,7 @@ def handle_create(module, gs, bucket, obj):
if bucket_check(module, gs, bucket): if bucket_check(module, gs, bucket):
if key_check(module, gs, bucket, dirobj): if key_check(module, gs, bucket, dirobj):
module.exit_json(msg="Bucket %s and key %s already exists."% (bucket, obj), changed=False) module.exit_json(msg="Bucket %s and key %s already exists."% (bucket, obj), changed=False)
else: else:
create_dirkey(module, gs, bucket, dirobj) create_dirkey(module, gs, bucket, dirobj)
else: else:
create_bucket(module, gs, bucket) create_bucket(module, gs, bucket)
@ -431,7 +431,7 @@ def main():
module.fail_json(msg="Local object for PUT does not exist", failed=True) module.fail_json(msg="Local object for PUT does not exist", failed=True)
handle_put(module, gs, bucket, obj, overwrite, src, expiry) 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': if mode == 'delete':
handle_delete(module, gs, bucket, obj) handle_delete(module, gs, bucket, obj)

View file

@ -144,7 +144,7 @@ notes:
- See also M(gcdns_zone). - See also M(gcdns_zone).
- This modules's underlying library does not support in-place updates for - This modules's underlying library does not support in-place updates for
DNS resource records. Instead, resource records are quickly deleted and DNS resource records. Instead, resource records are quickly deleted and
recreated. recreated.
- SOA records are technically supported, but their functionality is limited - SOA records are technically supported, but their functionality is limited
to verifying that a zone's existing SOA record matches a pre-determined to verifying that a zone's existing SOA record matches a pre-determined
value. The SOA record cannot be updated. value. The SOA record cannot be updated.

View file

@ -86,7 +86,7 @@ options:
description: description:
- the protocol used for the load-balancer packet forwarding, tcp or udp - the protocol used for the load-balancer packet forwarding, tcp or udp
required: false required: false
default: "tcp" default: "tcp"
choices: ['tcp', 'udp'] choices: ['tcp', 'udp']
region: region:
description: description:
@ -151,7 +151,7 @@ author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
EXAMPLES = ''' EXAMPLES = '''
# Simple example of creating a new LB, adding members, and a health check # Simple example of creating a new LB, adding members, and a health check
- local_action: - local_action:
module: gce_lb module: gce_lb
name: testlb name: testlb
region: us-central1 region: us-central1

View file

@ -293,7 +293,7 @@ except ImportError:
def _check_params(params, field_list): def _check_params(params, field_list):
""" """
Helper to validate params. Helper to validate params.
Use this in function definitions if they require specific fields 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): def _validate_autoscaling_params(params):
""" """
Validate that the minimum configuration is present for autoscaling. Validate that the minimum configuration is present for autoscaling.
:param params: Ansible dictionary containing autoscaling configuration :param params: Ansible dictionary containing autoscaling configuration
@ -331,7 +331,7 @@ def _validate_autoscaling_params(params):
key 'autoscaling'. key 'autoscaling'.
:type params: ``dict`` :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. is valid, False otherwise, plus str for message.
:rtype: ``(``bool``, ``str``)`` :rtype: ``(``bool``, ``str``)``
""" """
@ -372,7 +372,7 @@ def _validate_autoscaling_params(params):
def _validate_named_port_params(params): def _validate_named_port_params(params):
""" """
Validate the named ports parameters Validate the named ports parameters
:param params: Ansible dictionary containing named_ports configuration :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']): def _get_instance_list(mig, field='name', filter_list=['NONE']):
""" """
Helper to grab field from instances response. Helper to grab field from instances response.
:param mig: Managed Instance Group Object from libcloud. :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): def _gen_gce_as_policy(as_params):
""" """
Take Autoscaler params and generate GCE-compatible policy. 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. containing policy arguments.
:type as_params: ``dict`` :type as_params: ``dict``

View file

@ -41,7 +41,7 @@ options:
description: 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. - 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 required: False
name: name:
description: Subfield of subscription. Required if subscription is specified. See examples. description: Subfield of subscription. Required if subscription is specified. See examples.
required: False required: False
ack_deadline: ack_deadline:
@ -156,13 +156,13 @@ state:
type: str type: str
sample: "present" sample: "present"
subscription: subscription:
description: Name of subscription. description: Name of subscription.
returned: When subscription fields are specified returned: When subscription fields are specified
type: str type: str
sample: "mysubscription" sample: "mysubscription"
topic: topic:
description: Name of topic. description: Name of topic.
returned: Always returned: Always
type: str type: str

View file

@ -45,7 +45,7 @@ options:
state: state:
description: description:
- list is the only valid option. - list is the only valid option.
required: False required: False
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -72,7 +72,7 @@ subscriptions:
returned: When view is set to subscriptions. returned: When view is set to subscriptions.
type: list type: list
sample: ["mysubscription", "mysubscription2"] sample: ["mysubscription", "mysubscription2"]
topic: topic:
description: Name of topic. Used to filter subscriptions. description: Name of topic. Used to filter subscriptions.
returned: Always returned: Always
type: str type: str

View file

@ -179,14 +179,14 @@ def randompass():
''' '''
Generate a long random password that comply to Linode requirements Generate a long random password that comply to Linode requirements
''' '''
# Linode API currently requires the following: # Linode API currently requires the following:
# It must contain at least two of these four character classes: # It must contain at least two of these four character classes:
# lower case letters - upper case letters - numbers - punctuation # lower case letters - upper case letters - numbers - punctuation
# we play it safe :) # we play it safe :)
import random import random
import string import string
# as of python 2.4, this reseeds the PRNG from urandom # 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)) lower = ''.join(random.choice(string.ascii_lowercase) for x in range(6))
upper = ''.join(random.choice(string.ascii_uppercase) 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)) number = ''.join(random.choice(string.digits) for x in range(6))
@ -218,11 +218,11 @@ def getInstanceDetails(api, server):
'ip_id': ip['IPADDRESSID']}) 'ip_id': ip['IPADDRESSID']})
return instance 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): payment_term, password, ssh_pub_key, swap, wait, wait_timeout):
instances = [] instances = []
changed = False changed = False
new_server = False new_server = False
servers = [] servers = []
disks = [] disks = []
configs = [] 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 # For the moment we only consider linode_id as criteria for match
# Later we can use more (size, name, etc.) and update existing # Later we can use more (size, name, etc.) and update existing
servers = api.linode_list(LinodeId=linode_id) 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 # found with linode_id
if servers: if servers:
disks = api.linode_disk_list(LinodeId=linode_id) 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 # Create linode entity
new_server = True new_server = True
try: try:
res = api.linode_create(DatacenterID=datacenter, PlanID=plan, res = api.linode_create(DatacenterID=datacenter, PlanID=plan,
PaymentTerm=payment_term) PaymentTerm=payment_term)
linode_id = res['LinodeID'] linode_id = res['LinodeID']
# Update linode Label to match name # 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 size = servers[0]['TOTALHD'] - swap
if ssh_pub_key: if ssh_pub_key:
res = api.linode_disk_createfromdistribution( res = api.linode_disk_createfromdistribution(
LinodeId=linode_id, DistributionID=distribution, LinodeId=linode_id, DistributionID=distribution,
rootPass=password, rootSSHKey=ssh_pub_key, rootPass=password, rootSSHKey=ssh_pub_key,
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
else: else:
res = api.linode_disk_createfromdistribution( 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) Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
jobs.append(res['JobID']) jobs.append(res['JobID'])
# Create SWAP disk # Create SWAP disk
res = api.linode_disk_create(LinodeId=linode_id, Type='swap', res = api.linode_disk_create(LinodeId=linode_id, Type='swap',
Label='%s swap disk (lid: %s)' % (name, linode_id), Label='%s swap disk (lid: %s)' % (name, linode_id),
Size=swap) Size=swap)
jobs.append(res['JobID']) jobs.append(res['JobID'])
except Exception as e: except Exception as e:
@ -364,12 +364,12 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
time.sleep(5) time.sleep(5)
if wait and wait_timeout <= time.time(): if wait and wait_timeout <= time.time():
# waiting took too long # 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'])) (server['LABEL'], server['LINODEID']))
# Get a fresh copy of the server details # Get a fresh copy of the server details
server = api.linode_list(LinodeId=server['LINODEID'])[0] server = api.linode_list(LinodeId=server['LINODEID'])[0]
if server['STATUS'] == -2: 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'])) (server['LABEL'], server['LINODEID']))
# From now on we know the task is a success # From now on we know the task is a success
# Build instance report # Build instance report
@ -380,7 +380,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
else: else:
instance['status'] = 'Starting' 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 # has been provided
if new_server and not ssh_pub_key: if new_server and not ssh_pub_key:
instance['password'] = password instance['password'] = password
@ -495,7 +495,7 @@ def main():
except Exception as e: except Exception as e:
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE']) 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) payment_term, password, ssh_pub_key, swap, wait, wait_timeout)
# import module snippets # import module snippets

View file

@ -446,7 +446,7 @@ def main():
vmcpus = module.params['instance_cpus'] # number of cpu vmcpus = module.params['instance_cpus'] # number of cpu
vmnic = module.params['instance_nic'] # network interface vmnic = module.params['instance_nic'] # network interface
vmnetwork = module.params['instance_network'] # logical network 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_alloc = module.params['disk_alloc'] # thin, preallocated
vmdisk_int = module.params['disk_int'] # disk interface virtio or ide vmdisk_int = module.params['disk_int'] # disk interface virtio or ide
vmos = module.params['instance_os'] # Operating System vmos = module.params['instance_os'] # Operating System

View file

@ -600,7 +600,7 @@ EXAMPLES = '''
node : sabrewulf node : sabrewulf
state : absent state : absent
# Get VM current state # Get VM current state
- proxmox_kvm: - proxmox_kvm:
api_user : root@pam api_user : root@pam
api_password: secret api_password: secret
@ -638,7 +638,7 @@ vmid:
type: int type: int
sample: 115 sample: 115
status: status:
description: description:
- The current virtual machine status. - The current virtual machine status.
- Returned only when C(state=current) - Returned only when C(state=current)
returned: success returned: success
@ -646,7 +646,7 @@ status:
sample: '{ sample: '{
"changed": false, "changed": false,
"msg": "VM kropta with vmid = 110 is running", "msg": "VM kropta with vmid = 110 is running",
"status": "running" "status": "running"
}' }'
''' '''

View file

@ -96,12 +96,12 @@ tasks:
RETURN = ''' RETURN = '''
# for list_vms command # for list_vms command
list_vms: list_vms:
description: The list of vms defined on the remote system description: The list of vms defined on the remote system
type: dictionary type: dictionary
returned: success returned: success
sample: [ sample: [
"build.example.org", "build.example.org",
"dev.example.org" "dev.example.org"
] ]
# for status command # for status command

View file

@ -260,7 +260,7 @@ class LibvirtConnection(object):
else: else:
# pretend there was a change # pretend there was a change
res = 0 res = 0
if res == 0: if res == 0:
return True return True
else: else:
# change the host # change the host

View file

@ -157,7 +157,7 @@ def _get_ksclient(module, kwargs):
auth_url=kwargs.get('auth_url')) auth_url=kwargs.get('auth_url'))
except Exception as e: except Exception as e:
module.fail_json(msg="Error authenticating to the keystone: %s " % e.message) module.fail_json(msg="Error authenticating to the keystone: %s " % e.message)
return client return client
def _get_endpoint(module, client, endpoint_type): def _get_endpoint(module, client, endpoint_type):
@ -186,7 +186,7 @@ def _glance_image_present(module, params, client):
try: try:
for image in client.images.list(): for image in client.images.list():
if image.name == params['name']: if image.name == params['name']:
return image.id return image.id
return None return None
except Exception as e: except Exception as e:
module.fail_json(msg="Error in fetching image list: %s" % e.message) module.fail_json(msg="Error in fetching image list: %s" % e.message)

View file

@ -337,7 +337,7 @@ def _add_floating_ip_from_pool(module, nova, server):
if not pool_ips: if not pool_ips:
try: try:
new_ip = nova.floating_ips.create(pool) 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)) module.fail_json(msg = "Unable to create floating ip: %s" % (e.message))
pool_ips.append(new_ip.ip) pool_ips.append(new_ip.ip)
# Add to the main list # Add to the main list

View file

@ -135,7 +135,7 @@ def main():
if module.params['public_key'] and (module.params['public_key'] != key.public_key ): 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'])) module.fail_json(msg = "name {} present but key hash not the same as offered. Delete key first.".format(key['name']))
else: else:
module.exit_json(changed = False, result = "Key present") module.exit_json(changed = False, result = "Key present")
try: try:
key = nova.keypairs.create(module.params['name'], module.params['public_key']) key = nova.keypairs.create(module.params['name'], module.params['public_key'])
except Exception as e: except Exception as e:

View file

@ -72,7 +72,7 @@ def main():
clouds.append(cloud.config) clouds.append(cloud.config)
module.exit_json(ansible_facts=dict(openstack=dict(clouds=clouds))) module.exit_json(ansible_facts=dict(openstack=dict(clouds=clouds)))
except exceptions.OpenStackConfigException as e: except exceptions.OpenStackConfigException as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *

View file

@ -96,7 +96,7 @@ openstack_projects:
returned: always, but can be null returned: always, but can be null
type: complex type: complex
contains: contains:
id: id:
description: Unique UUID. description: Unique UUID.
returned: success returned: success
type: string type: string

View file

@ -26,8 +26,8 @@ description:
version_added: "2.2" version_added: "2.2"
author: Pascal HERAUD @pascalheraud author: Pascal HERAUD @pascalheraud
notes: notes:
- Uses the python OVH Api U(https://github.com/ovh/python-ovh). - 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 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) key as described into U(https://eu.api.ovh.com/g934.first_step_with_api)
requirements: requirements:
- ovh > 0.3.5 - ovh > 0.3.5
@ -79,13 +79,13 @@ options:
type: "int" type: "int"
default: 120 default: 120
description: 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. completed. Default is 120 seconds.
''' '''
EXAMPLES = ''' 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' # loadbalancing 'ip-1.1.1.1'
- ovh_ip_loadbalancing: - ovh_ip_loadbalancing:
name: ip-1.1.1.1 name: ip-1.1.1.1

View file

@ -43,7 +43,7 @@ options:
count_offset: count_offset:
description: description:
- From which number to start the count. - From which number to start the count.
device_ids: device_ids:
description: description:
@ -59,9 +59,9 @@ options:
hostnames: hostnames:
description: 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 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] aliases: [name]
lock: lock:
@ -127,7 +127,7 @@ EXAMPLES = '''
plan: baremetal_0 plan: baremetal_0
facility: sjc1 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 hosts: localhost
tasks: tasks:
- packet_device: - packet_device:
@ -435,7 +435,7 @@ def wait_for_ips(module, packet_conn, created_devices):
% [d.hostname for d in 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') project_id = module.params.get('project_id')
return packet_conn.list_devices(project_id, params={'per_page': MAX_DEVICES}) 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'): if not module.params.get('auth_token'):
_fail_msg = ( "if Packet API token is not in environment variable %s, " _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) PACKET_API_TOKEN_ENV_VAR)
module.fail_json(msg=_fail_msg) module.fail_json(msg=_fail_msg)

View file

@ -92,9 +92,9 @@ sshkeys:
type: array type: array
sample: [ sample: [
{ {
"fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46", "fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46",
"id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7", "id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7",
"key": "ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2", "key": "ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2",
"label": "mynewkey33" "label": "mynewkey33"
} }
] ]
@ -251,7 +251,7 @@ def main():
if not module.params.get('auth_token'): if not module.params.get('auth_token'):
_fail_msg = ( "if Packet API token is not in environment variable %s, " _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) PACKET_API_TOKEN_ENV_VAR)
module.fail_json(msg=_fail_msg) module.fail_json(msg=_fail_msg)

View file

@ -76,7 +76,7 @@ EXAMPLES = '''
datacenter: Tardis One datacenter: Tardis One
wait_timeout: 500 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: - profitbricks_datacenter:
datacenter: Tardis One datacenter: Tardis One
wait_timeout: 500 wait_timeout: 500
@ -177,7 +177,7 @@ def remove_datacenter(module, profitbricks):
""" """
Removes a Datacenter. Removes a Datacenter.
This will remove a datacenter. This will remove a datacenter.
module : AnsibleModule object module : AnsibleModule object
profitbricks: authenticated profitbricks object. profitbricks: authenticated profitbricks object.

View file

@ -172,7 +172,7 @@ def detach_volume(module, profitbricks):
""" """
Detaches a volume. Detaches a volume.
This will remove a volume from the server. This will remove a volume from the server.
module : AnsibleModule object module : AnsibleModule object
profitbricks: authenticated profitbricks object. profitbricks: authenticated profitbricks object.

View file

@ -83,7 +83,7 @@ options:
description: description:
- how long before wait gives up, in seconds - how long before wait gives up, in seconds
default: 300 default: 300
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Matt Martz (@sivel)" - "Matt Martz (@sivel)"
extends_documentation_fragment: rackspace.openstack extends_documentation_fragment: rackspace.openstack

View file

@ -62,7 +62,7 @@ options:
description: description:
- how long before wait gives up, in seconds - how long before wait gives up, in seconds
default: 300 default: 300
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Matt Martz (@sivel)" - "Matt Martz (@sivel)"
extends_documentation_fragment: rackspace.openstack extends_documentation_fragment: rackspace.openstack

View file

@ -107,7 +107,7 @@ options:
description: description:
- how long before wait gives up, in seconds - how long before wait gives up, in seconds
default: 300 default: 300
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Matt Martz (@sivel)" - "Matt Martz (@sivel)"
extends_documentation_fragment: rackspace extends_documentation_fragment: rackspace

View file

@ -34,7 +34,7 @@ options:
choices: ['present', 'absent'] choices: ['present', 'absent']
default: present default: present
required: false required: false
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Matt Martz (@sivel)" - "Matt Martz (@sivel)"
extends_documentation_fragment: rackspace.openstack extends_documentation_fragment: rackspace.openstack

View file

@ -43,7 +43,7 @@ options:
description: description:
- cidr of the network being created - cidr of the network being created
default: null default: null
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Jesse Keating (@j2sol)" - "Jesse Keating (@j2sol)"
extends_documentation_fragment: rackspace.openstack extends_documentation_fragment: rackspace.openstack

View file

@ -39,7 +39,7 @@ options:
- present - present
- absent - absent
default: present default: present
author: author:
- "Christopher H. Laco (@claco)" - "Christopher H. Laco (@claco)"
- "Matt Martz (@sivel)" - "Matt Martz (@sivel)"
extends_documentation_fragment: rackspace extends_documentation_fragment: rackspace

View file

@ -206,7 +206,7 @@ EXAMPLES = '''
- hostname: instance-3 - hostname: instance-3
domain: anydomain.com domain: anydomain.com
datacenter: dal09 datacenter: dal09
tags: tags:
- ansible-module-test - ansible-module-test
- ansible-module-test-slaves - ansible-module-test-slaves
hourly: True hourly: True

View file

@ -26,7 +26,7 @@ DOCUMENTATION = '''
--- ---
module: vsphere_copy module: vsphere_copy
short_description: Copy a file to a vCenter datastore short_description: Copy a file to a vCenter datastore
description: description:
- Upload files to a vCenter datastore - Upload files to a vCenter datastore
version_added: 2.0 version_added: 2.0
author: Dag Wieers (@dagwieers) <dag@wieers.com> author: Dag Wieers (@dagwieers) <dag@wieers.com>

View file

@ -101,7 +101,7 @@ EXAMPLES = '''
webfaction_app: webfaction_app:
name="my_wsgi_app1" name="my_wsgi_app1"
state=present state=present
type=mod_wsgi35-python27 type=mod_wsgi35-python27
login_name={{webfaction_user}} login_name={{webfaction_user}}
login_password={{webfaction_passwd}} login_password={{webfaction_passwd}}
machine={{webfaction_machine}} machine={{webfaction_machine}}
@ -168,8 +168,8 @@ def main():
# If this isn't a dry run, create the app # If this isn't a dry run, create the app
result.update( result.update(
webfaction.create_app( webfaction.create_app(
session_id, app_name, app_type, session_id, app_name, app_type,
module.boolean(module.params['autostart']), module.boolean(module.params['autostart']),
module.params['extra_info'], module.params['extra_info'],
module.boolean(module.params['port_open']) module.boolean(module.params['port_open'])
) )

View file

@ -95,8 +95,8 @@ EXAMPLES = '''
webfaction_site: webfaction_site:
name: testsite1 name: testsite1
state: present state: present
host: myhost.webfaction.com host: myhost.webfaction.com
subdomains: subdomains:
- 'testsite1.my_domain.org' - 'testsite1.my_domain.org'
site_apps: site_apps:
- ['testapp1', '/'] - ['testapp1', '/']
@ -167,8 +167,8 @@ def main():
changed = False changed = False
) )
positional_args = [ positional_args = [
session_id, site_name, site_ip, session_id, site_name, site_ip,
module.boolean(module.params['https']), module.boolean(module.params['https']),
module.params['subdomains'], module.params['subdomains'],
] ]

View file

@ -75,7 +75,7 @@ notes:
The M(command) module is much more secure as it's not affected by the user's environment. 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. - " 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." For instance, if you only want to run a command if a certain file does not exist, use this."
author: author:
- Ansible Core Team - Ansible Core Team
- Michael DeHaan - Michael DeHaan
''' '''

View file

@ -49,7 +49,7 @@ options:
url: url:
description: description:
- Set exact URL to download the plugin from. - 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 required: False
default: None default: None
timeout: timeout:

View file

@ -80,7 +80,7 @@ notes:
requirements: requirements:
- python >= 2.7 - python >= 2.7
- pymssql - pymssql
author: Vedit Firat Arig author: Vedit Firat Arig
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -34,7 +34,7 @@ short_description: Manage MySQL replication
description: description:
- Manages MySQL server replication, slave, master status get and change master host. - Manages MySQL server replication, slave, master status get and change master host.
version_added: "1.3" version_added: "1.3"
author: "Balazs Pocze (@banyek)" author: "Balazs Pocze (@banyek)"
options: options:
mode: mode:
description: description:

View file

@ -143,7 +143,7 @@ def main():
state = module.params["state"] state = module.params["state"]
changed = False 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 # check which values are empty and don't include in the **kw
# dictionary # dictionary
params_map = { params_map = {

View file

@ -26,17 +26,17 @@ DOCUMENTATION = '''
module: postgresql_lang module: postgresql_lang
short_description: Adds, removes or changes procedural languages with a PostgreSQL database. short_description: Adds, removes or changes procedural languages with a PostgreSQL database.
description: 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 - 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. where executed or on a remote host.
- When removing a language from a database, it is possible that dependencies prevent - 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 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 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 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. 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 - 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. privilege to use this language to create new functions.
version_added: "1.7" version_added: "1.7"
options: options:
@ -53,13 +53,13 @@ options:
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
db: db:
description: 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 required: false
default: null default: null
force_trust: force_trust:
description: description:
- marks the language as trusted, even if it's marked as untrusted in pg_pltemplate. - marks the language as trusted, even if it's marked as untrusted in pg_pltemplate.
- use with care! - use with care!
required: false required: false
default: no default: no
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
@ -72,8 +72,8 @@ options:
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
cascade: cascade:
description: description:
- when dropping a language, also delete object that depend on this language. - when dropping a language, also delete object that depend on this language.
- only used when C(state=absent). - only used when C(state=absent).
required: false required: false
default: no default: no
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
@ -118,7 +118,7 @@ author: "Jens Depuydt (@jensdepuydt)"
EXAMPLES = ''' EXAMPLES = '''
# Add language pltclu to database testdb if it doesn't exist: # 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: # 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 # Marks the language as trusted if it exists but isn't trusted yet

View file

@ -87,7 +87,7 @@ EXAMPLES = '''
name: acme name: acme
# Create a new schema "acme" with a user "bob" who will own it # Create a new schema "acme" with a user "bob" who will own it
- postgresql_schema: - postgresql_schema:
name: acme name: acme
owner: bob owner: bob

View file

@ -26,7 +26,7 @@ module: vertica_schema
version_added: '2.0' version_added: '2.0'
short_description: Adds or removes Vertica database schema and roles. short_description: Adds or removes Vertica database schema and roles.
description: description:
- Adds or removes Vertica database schema and, optionally, roles - Adds or removes Vertica database schema and, optionally, roles
with schema access privileges. with schema access privileges.
- A schema will not be removed until all the objects have been dropped. - 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 - In such a situation, if the module tries to remove the schema it

View file

@ -253,7 +253,7 @@ def present(user_facts, cursor, user, profile, resource_pool,
if ldap: if ldap:
if ldap != (user_facts[user_key]['expired'] == 'True'): if ldap != (user_facts[user_key]['expired'] == 'True'):
query_fragments.append("password expire") query_fragments.append("password expire")
changed = True changed = True
elif expired is not None and expired != (user_facts[user_key]['expired'] == 'True'): elif expired is not None and expired != (user_facts[user_key]['expired'] == 'True'):
if expired: if expired:
query_fragments.append("password expire") query_fragments.append("password expire")

View file

@ -237,7 +237,7 @@ def contentfilter(fsname, pattern):
f.close() f.close()
return True return True
f.close() f.close()
except: except:
pass pass

View file

@ -72,7 +72,7 @@ options:
backup: backup:
version_added: "2.0" version_added: "2.0"
description: description:
- passes --backup --version-control=numbered to patch, - passes --backup --version-control=numbered to patch,
producing numbered backup copies producing numbered backup copies
choices: [ 'yes', 'no' ] choices: [ 'yes', 'no' ]
default: 'no' default: 'no'

View file

@ -37,11 +37,11 @@ requirements:
options: options:
api_key: api_key:
description: description:
- Circonus API key - Circonus API key
required: true required: true
category: category:
description: description:
- Annotation Category - Annotation Category
required: true required: true
description: description:
description: description:

View file

@ -274,7 +274,7 @@ EXAMPLES = '''
company: '{{ company }}' company: '{{ company }}'
user: '{{ user }}' user: '{{ user }}'
password: '{{ password }}' password: '{{ password }}'
properties: properties:
snmp.community: commstring snmp.community: commstring
type: dev type: dev
@ -340,7 +340,7 @@ EXAMPLES = '''
password: '{{ password }}' password: '{{ password }}'
collector: mycompany-Collector collector: mycompany-Collector
groups: /servers/production,/datacenter5 groups: /servers/production,/datacenter5
properties: properties:
snmp.community: commstring snmp.community: commstring
dc: 5 dc: 5
delegate_to: localhost delegate_to: localhost
@ -363,7 +363,7 @@ EXAMPLES = '''
company: '{{ company }}' company: '{{ company }}'
user: '{{ user }}' user: '{{ user }}'
password: '{{ password }}' password: '{{ password }}'
properties: properties:
snmp.community: hg snmp.community: hg
type: dev type: dev
status: test status: test
@ -474,7 +474,7 @@ EXAMPLES = '''
company: '{{ company }}' company: '{{ company }}'
user: '{{ user }}' user: '{{ user }}'
password: '{{ password }}' password: '{{ password }}'
properties: properties:
snmp.community: commstring snmp.community: commstring
- name: SDT a host group - name: SDT a host group
logicmonitor: logicmonitor:

View file

@ -52,7 +52,7 @@ options:
default: 300 default: 300
version_added: "2.1" version_added: "2.1"
requirements: [ ] requirements: [ ]
author: "Darryl Stoflet (@dstoflet)" author: "Darryl Stoflet (@dstoflet)"
''' '''
EXAMPLES = ''' EXAMPLES = '''

View file

@ -26,7 +26,7 @@ short_description: Pause/unpause Pingdom alerts
description: description:
- This module will let you pause/unpause Pingdom alerts - This module will let you pause/unpause Pingdom alerts
version_added: "1.2" version_added: "1.2"
author: author:
- "Dylan Silva (@thaumos)" - "Dylan Silva (@thaumos)"
- "Justin Johns" - "Justin Johns"
requirements: requirements:

View file

@ -156,7 +156,7 @@ options:
custom: custom:
version_added: "2.1" version_added: "2.1"
description: 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 - You can't rewrite others module parameters using this
required: false required: false
default: {} default: {}

View file

@ -60,16 +60,16 @@ options:
required: false required: false
default: null default: null
msg: msg:
description: description:
- The contents of the annotation message, in plain text.  Limited to 256 characters. Required for annotation. - The contents of the annotation message, in plain text.  Limited to 256 characters. Required for annotation.
required: false required: false
default: null default: null
annotated_by: annotated_by:
description: description:
- The person or robot who the annotation should be attributed to. - The person or robot who the annotation should be attributed to.
required: false required: false
default: "Ansible" default: "Ansible"
level: level:
description: description:
- one of INFO/WARN/ERROR, defaults to INFO if not supplied.  May affect display. - one of INFO/WARN/ERROR, defaults to INFO if not supplied.  May affect display.
choices: ['INFO', 'WARN', 'ERROR'] choices: ['INFO', 'WARN', 'ERROR']

View file

@ -222,7 +222,7 @@ class Host(object):
if proxy_id: if proxy_id:
parameters['proxy_hostid'] = proxy_id parameters['proxy_hostid'] = proxy_id
if visible_name: if visible_name:
parameters['name'] = visible_name parameters['name'] = visible_name
host_list = self._zapi.host.create(parameters) host_list = self._zapi.host.create(parameters)
if len(host_list) >= 1: if len(host_list) >= 1:
return host_list['hostids'][0] return host_list['hostids'][0]
@ -237,7 +237,7 @@ class Host(object):
if proxy_id: if proxy_id:
parameters['proxy_hostid'] = proxy_id parameters['proxy_hostid'] = proxy_id
if visible_name: if visible_name:
parameters['name'] = visible_name parameters['name'] = visible_name
self._zapi.host.update(parameters) self._zapi.host.update(parameters)
interface_list_copy = exist_interface_list interface_list_copy = exist_interface_list
if interfaces: if interfaces:

View file

@ -30,7 +30,7 @@ short_description: Zabbix host macro creates/updates/deletes
description: description:
- manages Zabbix host macros, it can create, update or delete them. - manages Zabbix host macros, it can create, update or delete them.
version_added: "2.0" version_added: "2.0"
author: author:
- "(@cave)" - "(@cave)"
- Dean Hailin Song - Dean Hailin Song
requirements: requirements:

View file

@ -93,7 +93,7 @@ RETURN = '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new server # Create a new server
- a10_server: - a10_server:
host: a10.mydomain.com host: a10.mydomain.com
username: myadmin username: myadmin
password: mypassword password: mypassword

View file

@ -81,7 +81,7 @@ RETURN = '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new server # Create a new server
- a10_server: - a10_server:
host: a10.mydomain.com host: a10.mydomain.com
username: myadmin username: myadmin
password: mypassword password: mypassword

View file

@ -88,7 +88,7 @@ RETURN = '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new service-group # Create a new service-group
- a10_service_group: - a10_service_group:
host: a10.mydomain.com host: a10.mydomain.com
username: myadmin username: myadmin
password: mypassword password: mypassword

View file

@ -86,7 +86,7 @@ RETURN = '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new virtual server # Create a new virtual server
- a10_virtual_server: - a10_virtual_server:
host: a10.mydomain.com host: a10.mydomain.com
username: myadmin username: myadmin
password: mypassword password: mypassword

View file

@ -173,39 +173,39 @@ author: "Jan-Piet Mens (@jpmens)"
EXAMPLES=''' EXAMPLES='''
- name: download foo.conf - name: download foo.conf
get_url: get_url:
url: http://example.com/path/file.conf url: http://example.com/path/file.conf
dest: /etc/foo.conf dest: /etc/foo.conf
mode: 0440 mode: 0440
- name: download file and force basic auth - name: download file and force basic auth
get_url: get_url:
url: http://example.com/path/file.conf url: http://example.com/path/file.conf
dest: /etc/foo.conf dest: /etc/foo.conf
force_basic_auth: yes force_basic_auth: yes
- name: download file with custom HTTP headers - name: download file with custom HTTP headers
get_url: get_url:
url: http://example.com/path/file.conf url: http://example.com/path/file.conf
dest: /etc/foo.conf dest: /etc/foo.conf
headers: 'key:value,key:value' headers: 'key:value,key:value'
- name: download file with check (sha256) - name: download file with check (sha256)
get_url: get_url:
url: http://example.com/path/file.conf url: http://example.com/path/file.conf
dest: /etc/foo.conf dest: /etc/foo.conf
checksum: sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c checksum: sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
- name: download file with check (md5) - name: download file with check (md5)
get_url: get_url:
url: http://example.com/path/file.conf url: http://example.com/path/file.conf
dest: /etc/foo.conf dest: /etc/foo.conf
checksum: md5:66dffb5228a211e61d6d7ef4a86f5758 checksum: md5:66dffb5228a211e61d6d7ef4a86f5758
- name: download file from a file path - name: download file from a file path
get_url: get_url:
url: "file:///tmp/afile.txt" url: "file:///tmp/afile.txt"
dest: /tmp/afilecopy.txt dest: /tmp/afilecopy.txt
''' '''
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
@ -427,7 +427,7 @@ def main():
if os.path.exists(dest): if os.path.exists(dest):
backup_file = module.backup_local(dest) backup_file = module.backup_local(dest)
shutil.copyfile(tmpsrc, dest) shutil.copyfile(tmpsrc, dest)
except Exception: except Exception:
err = get_exception() err = get_exception()
os.remove(tmpsrc) os.remove(tmpsrc)
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err))) module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err)))

View file

@ -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. - 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)" - "See also: M(fetch)"
requirements: [] requirements: []
author: author:
- "Ansible Core Team" - "Ansible Core Team"
- "Michael DeHaan" - "Michael DeHaan"
''' '''

View file

@ -37,7 +37,7 @@ extends_documentation_fragment: cloudengine
options: options:
commands: commands:
description: 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 over the configured provider. The resulting output from the
command is returned. If the I(wait_for) argument is provided, command is returned. If the I(wait_for) argument is provided,
the module is not returned until the condition is satisfied the module is not returned until the condition is satisfied

View file

@ -163,13 +163,13 @@ class Default(FactsBase):
def populate(self): def populate(self):
data = self.runner.get_command('show version | display-xml') 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['name'] = self.parse_name(xml_data)
self.facts['version'] = self.parse_version(xml_data) self.facts['version'] = self.parse_version(xml_data)
data = self.runner.get_command('show system | display-xml') 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['servicetag'] = self.parse_serialnum(xml_data)
self.facts['model'] = self.parse_model(xml_data) self.facts['model'] = self.parse_model(xml_data)
@ -178,14 +178,14 @@ class Default(FactsBase):
self.facts['hostname'] = self.parse_hostname(data) self.facts['hostname'] = self.parse_hostname(data)
def parse_name(self, 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: if sw_name is not None:
return sw_name.text return sw_name.text
else: else:
return "" return ""
def parse_version(self, data): 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: if sw_ver is not None:
return sw_ver.text return sw_ver.text
else: else:
@ -197,14 +197,14 @@ class Default(FactsBase):
return match.group(1) return match.group(1)
def parse_model(self, data): 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: if prod_name is not None:
return prod_name.text return prod_name.text
else: else:
return "" return ""
def parse_serialnum(self, data): 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: if svc_tag is not None:
return svc_tag.text return svc_tag.text
else: else:
@ -219,7 +219,7 @@ class Hardware(FactsBase):
def populate(self): def populate(self):
data = self.runner.get_command('show version | display-xml') 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) 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 self.facts['memfree_mb'] = int(match[2]) / 1024
def parse_cpu_arch(self, data): 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: if cpu_arch is not None:
return cpu_arch.text return cpu_arch.text
else: else:
@ -262,7 +262,7 @@ class Interfaces(FactsBase):
data = self.runner.get_command('show interface | display-xml') 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['interfaces'] = self.populate_interfaces(xml_data)
self.facts['neighbors'] = self.populate_neighbors(xml_data) self.facts['neighbors'] = self.populate_neighbors(xml_data)
@ -274,11 +274,11 @@ class Interfaces(FactsBase):
intf = dict() intf = dict()
name = self.parse_item(interface, 'name') 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['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['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['mtu'] = self.parse_item(interface, 'mtu')
intf['type'] = self.parse_item(interface, 'type') intf['type'] = self.parse_item(interface, 'type')
@ -287,7 +287,7 @@ class Interfaces(FactsBase):
for interface in interfaces.findall('./data/interfaces-state/interface'): for interface in interfaces.findall('./data/interfaces-state/interface'):
name = self.parse_item(interface, 'name') name = self.parse_item(interface, 'name')
intf = int_facts[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['adminstatus'] = self.parse_item(interface, 'admin-status')
intf['operstatus'] = self.parse_item(interface, 'oper-status') intf['operstatus'] = self.parse_item(interface, 'oper-status')
intf['macaddress'] = self.parse_item(interface, 'phys-address') 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'): for interface in interfaces.findall('./data/ports/ports-state/port'):
name = self.parse_item(interface, 'name') name = self.parse_item(interface, 'name')
fanout = self.parse_item(interface, 'fanout-state') 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') typ, sname = name.split('-eth')
if fanout == "BREAKOUT_1x1": if fanout == "BREAKOUT_1x1":
name = "ethernet" + sname name = "ethernet" + sname
intf = int_facts[name] intf = int_facts[name]
intf['mediatype'] = mediatype intf['mediatype'] = mediatype
else: else:
#TODO: Loop for the exact subport #TODO: Loop for the exact subport
for subport in xrange(1, 5): for subport in xrange(1, 5):
name = "ethernet" + sname + ":" + str(subport) name = "ethernet" + sname + ":" + str(subport)
intf = int_facts[name] intf = int_facts[name]
intf['mediatype'] = mediatype intf['mediatype'] = mediatype
return int_facts return int_facts
@ -368,10 +368,10 @@ class Interfaces(FactsBase):
fact = dict() fact = dict()
fact['host'] = rem_sys_name.text fact['host'] = rem_sys_name.text
rem_sys_port = interface.find('./lldp-rem-neighbor-info/info/rem-lldp-port-id') 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) lldp_facts[name].append(fact)
return lldp_facts return lldp_facts
FACT_SUBSETS = dict( FACT_SUBSETS = dict(
default=Default, default=Default,

View file

@ -236,7 +236,7 @@ class Interfaces(FactsBase):
fact['address'] = matc.group(2) fact['address'] = matc.group(2)
fact['masklen'] = matc.group(3) fact['masklen'] = matc.group(3)
facts[intf].append(fact) facts[intf].append(fact)
return facts return facts
def populate_interfaces(self, interfaces, desc, properties): def populate_interfaces(self, interfaces, desc, properties):
facts = dict() facts = dict()

View file

@ -77,8 +77,8 @@ notes:
- This module requires Dell OS9 version 9.10.0.1P13 or above. - This module requires Dell OS9 version 9.10.0.1P13 or above.
- This module requires to increase the ssh connection rate limit. - This module requires to increase the ssh connection rate limit.
Use the following command I(ip ssh connection-rate-limit 60) Use the following command I(ip ssh connection-rate-limit 60)
to configure the same. This can be done via M(dellos9_config) module to configure the same. This can be done via M(dellos9_config) module
as well. as well.
""" """

View file

@ -148,8 +148,8 @@ notes:
- This module requires Dell OS9 version 9.10.0.1P13 or above. - This module requires Dell OS9 version 9.10.0.1P13 or above.
- This module requires to increase the ssh connection rate limit. - This module requires to increase the ssh connection rate limit.
Use the following command I(ip ssh connection-rate-limit 60) Use the following command I(ip ssh connection-rate-limit 60)
to configure the same. This can be done via M(dellos9_config) module to configure the same. This can be done via M(dellos9_config) module
as well. as well.
""" """

View file

@ -51,8 +51,8 @@ notes:
- This module requires Dell OS9 version 9.10.0.1P13 or above. - This module requires Dell OS9 version 9.10.0.1P13 or above.
- This module requires to increase the ssh connection rate limit. - This module requires to increase the ssh connection rate limit.
Use the following command I(ip ssh connection-rate-limit 60) Use the following command I(ip ssh connection-rate-limit 60)
to configure the same. This can be done via M(dellos9_config) module to configure the same. This can be done via M(dellos9_config) module
as well. as well.
""" """

View file

@ -58,7 +58,7 @@ options:
default: null default: null
record_value: 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>" - "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)" - "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 required: false
@ -87,7 +87,7 @@ options:
version_added: 1.5.1 version_added: 1.5.1
notes: 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. - 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 ] requirements: [ hashlib, hmac ]

View file

@ -295,7 +295,7 @@ class HAProxy(object):
""" """
Wait for a service to reach the specified status. Try RETRIES times 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 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. not found, the module will fail.
""" """
for i in range(1, self.wait_retries): for i in range(1, self.wait_retries):

View file

@ -49,7 +49,7 @@ options:
format of the configuration file. Devices support three format of the configuration file. Devices support three
configuration file formats. By default, the configuration configuration file formats. By default, the configuration
from the device is returned as text. The other option xml. 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. returned as both xml and json.
required: false required: false
default: text default: text

View file

@ -31,7 +31,7 @@ description:
options: {} options: {}
author: "Andy Hill (@andyhky)" author: "Andy Hill (@andyhky)"
notes: notes:
- Requires lldpd running and lldp enabled on switches - Requires lldpd running and lldp enabled on switches
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -83,7 +83,7 @@ def main():
data = {'lldp': lldp_output['lldp']} data = {'lldp': lldp_output['lldp']}
module.exit_json(ansible_facts=data) module.exit_json(ansible_facts=data)
except TypeError: 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 # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *

Some files were not shown because too many files have changed in this diff Show more