Add module support to yamllint sanity test. (#34964)

* Add module support to yamllint sanity test.
* Fix duplicate keys in module RETURN docs.
* Fix syntax in return_common docs fragment.
* Fix duplicate keys in module EXAMPLES docs.
This commit is contained in:
Matt Clay 2018-01-16 15:08:56 -08:00 committed by GitHub
parent 240024ea4a
commit 227ff61f9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 533 additions and 344 deletions

View file

@ -205,11 +205,6 @@ architecture:
returned: when AMI found
type: string
sample: "x86_64"
architecture:
description: architecture of image
returned: when AMI found
type: string
sample: "x86_64"
block_device_mapping:
description: block device mapping associated with image
returned: when AMI found

View file

@ -74,7 +74,6 @@ notes:
EXAMPLES = '''
# Update API resources for development
tasks:
- name: update API
aws_api_gateway:
api_id: 'abc123321cba'
@ -82,7 +81,6 @@ tasks:
swagger_file: my_api.yml
# update definitions and deploy API to production
tasks:
- name: deploy API
aws_api_gateway:
api_id: 'abc123321cba'

View file

@ -62,33 +62,33 @@ options:
EXAMPLES = """
# create a Direct Connect connection
aws_direct_connect_connection:
name: ansible-test-connection
state: present
location: EqDC2
link_aggregation_group: dxlag-xxxxxxxx
bandwidth: 1Gbps
register: dc
- aws_direct_connect_connection:
name: ansible-test-connection
state: present
location: EqDC2
link_aggregation_group: dxlag-xxxxxxxx
bandwidth: 1Gbps
register: dc
# disassociate the LAG from the connection
aws_direct_connect_connection:
state: present
connection_id: dc.connection.connection_id
location: EqDC2
bandwidth: 1Gbps
- aws_direct_connect_connection:
state: present
connection_id: dc.connection.connection_id
location: EqDC2
bandwidth: 1Gbps
# replace the connection with one with more bandwidth
aws_direct_connect_connection:
state: present
name: ansible-test-connection
location: EqDC2
bandwidth: 10Gbps
forced_update: True
- aws_direct_connect_connection:
state: present
name: ansible-test-connection
location: EqDC2
bandwidth: 10Gbps
forced_update: True
# delete the connection
aws_direct_connect_connection:
state: absent
name: ansible-test-connection
- aws_direct_connect_connection:
state: absent
name: ansible-test-connection
"""
RETURN = """

View file

@ -596,19 +596,23 @@ EXAMPLES = '''
#
# instances with tag foo
- ec2:
count_tag:
foo:
# instances with tag foo=bar
- ec2:
count_tag:
foo: bar
# instances with tags foo=bar & baz
- ec2:
count_tag:
foo: bar
baz:
# instances with tags foo & bar & baz=bang
- ec2:
count_tag:
- foo
- bar

View file

@ -64,7 +64,6 @@ notes:
EXAMPLES = '''
# Example of getting a password
tasks:
- name: get the Administrator password
ec2_win_password:
profile: my-boto-profile
@ -73,7 +72,6 @@ tasks:
key_file: "~/aws-creds/my_test_key.pem"
# Example of getting a password with a password protected key
tasks:
- name: get the Administrator password
ec2_win_password:
profile: my-boto-profile
@ -83,7 +81,6 @@ tasks:
key_passphrase: "secret"
# Example of waiting for a password
tasks:
- name: get the Administrator password
ec2_win_password:
profile: my-boto-profile

View file

@ -51,15 +51,15 @@ EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# List MFA devices (more details: http://docs.aws.amazon.com/IAM/latest/APIReference/API_ListMFADevices.html)
iam_mfa_device_facts:
register: mfa_devices
- iam_mfa_device_facts:
register: mfa_devices
# Assume an existing role (more details: http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
sts_assume_role:
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}"
role_arn: "arn:aws:iam::123456789012:role/someRole"
role_session_name: "someRoleSession"
register: assumed_role
- sts_assume_role:
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}"
role_arn: "arn:aws:iam::123456789012:role/someRole"
role_session_name: "someRoleSession"
register: assumed_role
'''
try:

View file

@ -72,7 +72,6 @@ extends_documentation_fragment:
EXAMPLES = '''
# Create a policy with the name of 'Admin' to the group 'administrators'
tasks:
- name: Assign a policy called Admin to the administrators group
iam_policy:
iam_type: group
@ -83,7 +82,6 @@ tasks:
# Advanced example, create two new groups and add a READ-ONLY policy to both
# groups.
task:
- name: Create Two Groups, Mario and Luigi
iam:
iam_type: group
@ -104,7 +102,6 @@ task:
with_items: "{{ new_groups.results }}"
# Create a new S3 policy with prefix per user
tasks:
- name: Create S3 policy from template
iam_policy:
iam_type: user

View file

@ -125,7 +125,6 @@ extends_documentation_fragment:
EXAMPLES = '''
# Create Lambda functions
tasks:
- name: looped creation
lambda:
name: '{{ item.name }}'
@ -154,7 +153,6 @@ tasks:
key2: "2"
# Basic Lambda function deletion
tasks:
- name: Delete Lambda functions HelloWorld and ByeBye
lambda:
name: '{{ item }}'

View file

@ -104,43 +104,43 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# create an account in domain 'CUSTOMERS'
local_action:
module: cs_account
name: customer_xy
username: customer_xy
password: S3Cur3
last_name: Doe
first_name: John
email: john.doe@example.com
domain: CUSTOMERS
- local_action:
module: cs_account
name: customer_xy
username: customer_xy
password: S3Cur3
last_name: Doe
first_name: John
email: john.doe@example.com
domain: CUSTOMERS
# Lock an existing account in domain 'CUSTOMERS'
local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: locked
- local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: locked
# Disable an existing account in domain 'CUSTOMERS'
local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: disabled
- local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: disabled
# Enable an existing account in domain 'CUSTOMERS'
local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: enabled
- local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: enabled
# Remove an account in domain 'CUSTOMERS'
local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: absent
- local_action:
module: cs_account
name: customer_xy
domain: CUSTOMERS
state: absent
'''
RETURN = '''

View file

@ -251,11 +251,6 @@ gateway_ipv6:
returned: success
type: string
sample: 2001:db8::1
state:
description: State of the network.
returned: success
type: string
sample: Implemented
zone:
description: Name of zone.
returned: success

View file

@ -82,18 +82,18 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# create a network ACL
local_action:
module: cs_network_acl
name: Webserver ACL
description: a more detailed description of the ACL
vpc: customers
- local_action:
module: cs_network_acl
name: Webserver ACL
description: a more detailed description of the ACL
vpc: customers
# remove a network ACL
local_action:
module: cs_network_acl
name: Webserver ACL
vpc: customers
state: absent
- local_action:
module: cs_network_acl
name: Webserver ACL
vpc: customers
state: absent
'''
RETURN = '''

View file

@ -145,47 +145,47 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# create a network ACL rule, allow port 80 ingress
local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: allow
port: 80
cidr: 0.0.0.0/0
- local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: allow
port: 80
cidr: 0.0.0.0/0
# create a network ACL rule, deny port range 8000-9000 ingress for 10.20.0.0/16
local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: deny
start_port: 8000
end_port: 8000
cidr: 10.20.0.0/16
- local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: deny
start_port: 8000
end_port: 8000
cidr: 10.20.0.0/16
# create a network ACL rule
local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: deny
start_port: 8000
end_port: 8000
cidr: 10.20.0.0/16
- local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
traffic_type: ingress
action_policy: deny
start_port: 8000
end_port: 8000
cidr: 10.20.0.0/16
# remove a network ACL rule
local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
state: absent
- local_action:
module: cs_network_acl_rule
network_acl: web
rule_position: 1
vpc: my vpc
state: absent
'''
RETURN = '''

View file

@ -60,17 +60,17 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# create a region
local_action:
module: cs_region
id: 2
name: geneva
endpoint: https://cloud.gva.example.com
- local_action:
module: cs_region
id: 2
name: geneva
endpoint: https://cloud.gva.example.com
# remove a region with ID 2
local_action:
module: cs_region
id: 2
state: absent
- local_action:
module: cs_region
id: 2
state: absent
'''
RETURN = '''

View file

@ -76,19 +76,19 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# Update a resource limit for instances of a domain
local_action:
module: cs_resourcelimit
type: instance
limit: 10
domain: customers
- local_action:
module: cs_resourcelimit
type: instance
limit: 10
domain: customers
# Update a resource limit for instances of an account
local_action:
module: cs_resourcelimit
type: instance
limit: 12
account: moserre
domain: customers
- local_action:
module: cs_resourcelimit
type: instance
limit: 12
account: moserre
domain: customers
'''
RETURN = '''

View file

@ -111,7 +111,6 @@ EXAMPLES = '''
pod: pod01
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
provider: DefaultPrimary
name: Ceph RBD
scope: cluster
allocation_state: disabled
@ -124,7 +123,6 @@ EXAMPLES = '''
pod: pod01
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
provider: DefaultPrimary
name: Ceph RBD
scope: cluster
allocation_state: maintenance

View file

@ -101,43 +101,43 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# create an user in domain 'CUSTOMERS'
local_action:
module: cs_user
account: developers
username: johndoe
password: S3Cur3
last_name: Doe
first_name: John
email: john.doe@example.com
domain: CUSTOMERS
- local_action:
module: cs_user
account: developers
username: johndoe
password: S3Cur3
last_name: Doe
first_name: John
email: john.doe@example.com
domain: CUSTOMERS
# Lock an existing user in domain 'CUSTOMERS'
local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: locked
- local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: locked
# Disable an existing user in domain 'CUSTOMERS'
local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: disabled
- local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: disabled
# Enable/unlock an existing user in domain 'CUSTOMERS'
local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: enabled
- local_action:
module: cs_user
username: johndoe
domain: CUSTOMERS
state: enabled
# Remove an user in domain 'CUSTOMERS'
local_action:
module: cs_user
name: customer_xy
domain: CUSTOMERS
state: absent
- local_action:
module: cs_user
name: customer_xy
domain: CUSTOMERS
state: absent
'''
RETURN = '''

View file

@ -199,7 +199,7 @@ EXAMPLES = '''
# Create multiple instances by specifying multiple names, separated by
# commas in the instance_names field
# (e.g. my-test-instance1,my-test-instance2)
gce:
- gce:
instance_names: my-test-instance1
zone: us-central1-a
machine_type: n1-standard-1
@ -213,7 +213,7 @@ EXAMPLES = '''
# Create a single instance of an image from the "my-base-image" image family
# in the us-central1-a Zone of the n1-standard-1 machine type.
# This image family is in the "my-other-project" GCP project.
gce:
- gce:
instance_names: my-test-instance1
zone: us-central1-a
machine_type: n1-standard-1
@ -229,7 +229,7 @@ EXAMPLES = '''
# Create a single Debian 8 instance in the us-central1-a Zone
# Use existing disks, custom network/subnetwork, set service account permissions
# add tags and metadata.
gce:
- gce:
instance_names: my-test-instance
zone: us-central1-a
machine_type: n1-standard-1

View file

@ -42,22 +42,22 @@ options:
EXAMPLES = '''
# Create a Global external IP address
gce_eip:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: my-global-ip
region: global
state: present
- gce_eip:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: my-global-ip
region: global
state: present
# Create a Regional external IP address
gce_eip:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: my-global-ip
region: us-east1
state: present
- gce_eip:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: my-global-ip
region: us-east1
state: present
'''
RETURN = '''

View file

@ -45,20 +45,20 @@ options:
EXAMPLES = '''
## List all Topics in a project
gcpubsub_facts:
view: topics
state: list
- gcpubsub_facts:
view: topics
state: list
## List all Subscriptions in a project
gcpubsub_facts:
view: subscriptions
state: list
- gcpubsub_facts:
view: subscriptions
state: list
## List all Subscriptions for a Topic in a project
gcpubsub_facts:
view: subscriptions
topic: my-topic
state: list
- gcpubsub_facts:
view: subscriptions
topic: my-topic
state: list
'''
RETURN = '''

View file

@ -189,7 +189,6 @@ EXAMPLES = '''
alert_bwin_threshold: 10
alert_cpu_enabled: True
alert_cpu_threshold: 210
alert_diskio_enabled: True
alert_bwout_enabled: True
alert_bwout_threshold: 10
alert_diskio_enabled: True

View file

@ -235,7 +235,6 @@ EXAMPLES = '''
cluster: "RH"
state: "down"
image: "centos7_x64"
cluster: "centos"
# multi disk, multi nic create example
- rhevm:

View file

@ -116,7 +116,6 @@ notes:
'''
EXAMPLES = '''
tasks:
- block:
# Create a vault with `ovirt_password` variable which store your
# oVirt/RHV user's password, and include that yaml file with variable:
@ -150,7 +149,6 @@ tasks:
# in yaml file.
# This is mainly usefull when using Ansible Tower or AWX, as it will work
# for Red Hat Virtualization creadentials type.
tasks:
- name: Obtain SSO token
ovirt_auth:
state: present

View file

@ -59,20 +59,20 @@ EXAMPLES = '''
# look at ovirt_auth module to see how to reuse authentication:
# Add group group1 from authorization provider example.com-authz
ovirt_group:
- ovirt_group:
name: group1
domain: example.com-authz
# Add group group1 from authorization provider example.com-authz
# In case of multi-domain Active Directory setup, you should pass
# also namespace, so it adds correct group:
ovirt_group:
- ovirt_group:
name: group1
namespace: dc=ad2,dc=example,dc=com
domain: example.com-authz
# Remove group group1 with authorization provider example.com-authz
ovirt_group:
- ovirt_group:
state: absent
name: group1
domain: example.com-authz

View file

@ -82,7 +82,7 @@ EXAMPLES = '''
# look at ovirt_auth module to see how to reuse authentication:
# Add cluster quota to cluster cluster1 with memory limit 20GiB and CPU limit to 10:
ovirt_quotas:
- ovirt_quotas:
name: quota1
data_center: dcX
clusters:
@ -91,7 +91,7 @@ ovirt_quotas:
cpu: 10
# Add cluster quota to all clusters with memory limit 30GiB and CPU limit to 15:
ovirt_quotas:
- ovirt_quotas:
name: quota2
data_center: dcX
clusters:
@ -99,7 +99,7 @@ ovirt_quotas:
cpu: 15
# Add storage quota to storage data1 with size limit to 100GiB
ovirt_quotas:
- ovirt_quotas:
name: quota3
data_center: dcX
storage_grace: 40
@ -109,7 +109,7 @@ ovirt_quotas:
size: 100
# Remove quota quota1 (Note the quota must not be assigned to any VM/disk):
ovirt_quotas:
- ovirt_quotas:
state: absent
data_center: dcX
name: quota1

View file

@ -55,18 +55,18 @@ EXAMPLES = '''
# look at ovirt_auth module to see how to reuse authentication:
# Add user user1 from authorization provider example.com-authz
ovirt_users:
- ovirt_users:
name: user1
domain: example.com-authz
# Add user user1 from authorization provider example.com-authz
# In case of Active Directory specify UPN:
ovirt_users:
- ovirt_users:
name: user1@ad2.example.com
domain: example.com-authz
# Remove user user1 with authorization provider example.com-authz
ovirt_users:
- ovirt_users:
state: absent
name: user1
authz_name: example.com-authz

View file

@ -35,17 +35,17 @@ options:
EXAMPLES = '''
# Return facts about all installed images.
smartos_image_facts:
- smartos_image_facts:
# Return all private active Linux images.
smartos_image_facts: filters="os=linux state=active public=false"
- smartos_image_facts: filters="os=linux state=active public=false"
# Show, how many clones does every image have.
smartos_image_facts:
- smartos_image_facts:
debug: msg="{{ smartos_images[item]['name'] }}-{{smartos_images[item]['version'] }}
- debug: msg="{{ smartos_images[item]['name'] }}-{{smartos_images[item]['version'] }}
has {{ smartos_images[item]['clones'] }} VM(s)"
with_items: "{{ smartos_images.keys() }}"
with_items: "{{ smartos_images.keys() }}"
'''
RETURN = '''

View file

@ -628,7 +628,6 @@ EXAMPLES = '''
- sg-8f4b8fe9
spot_instance_types:
- c3.large
state: absent
do_not_update:
- image_id
- target