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:
parent
240024ea4a
commit
227ff61f9d
53 changed files with 533 additions and 344 deletions
19
.yamllint
19
.yamllint
|
@ -1,19 +0,0 @@
|
||||||
extends: default
|
|
||||||
|
|
||||||
rules:
|
|
||||||
braces: {max-spaces-inside: 1, level: error}
|
|
||||||
brackets: {max-spaces-inside: 1, level: error}
|
|
||||||
colons: {max-spaces-after: -1, level: error}
|
|
||||||
commas: {max-spaces-after: -1, level: error}
|
|
||||||
comments: disable
|
|
||||||
comments-indentation: disable
|
|
||||||
document-start: disable
|
|
||||||
empty-lines: {max: 3, level: error}
|
|
||||||
hyphens: {level: error}
|
|
||||||
indentation: disable
|
|
||||||
key-duplicates: enable
|
|
||||||
line-length: disable
|
|
||||||
new-line-at-end-of-file: disable
|
|
||||||
new-lines: {type: unix}
|
|
||||||
trailing-spaces: disable
|
|
||||||
truthy: disable
|
|
1
.yamllint
Symbolic link
1
.yamllint
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
test/sanity/yamllint/config/default.yml
|
|
@ -205,11 +205,6 @@ architecture:
|
||||||
returned: when AMI found
|
returned: when AMI found
|
||||||
type: string
|
type: string
|
||||||
sample: "x86_64"
|
sample: "x86_64"
|
||||||
architecture:
|
|
||||||
description: architecture of image
|
|
||||||
returned: when AMI found
|
|
||||||
type: string
|
|
||||||
sample: "x86_64"
|
|
||||||
block_device_mapping:
|
block_device_mapping:
|
||||||
description: block device mapping associated with image
|
description: block device mapping associated with image
|
||||||
returned: when AMI found
|
returned: when AMI found
|
||||||
|
|
|
@ -74,7 +74,6 @@ notes:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Update API resources for development
|
# Update API resources for development
|
||||||
tasks:
|
|
||||||
- name: update API
|
- name: update API
|
||||||
aws_api_gateway:
|
aws_api_gateway:
|
||||||
api_id: 'abc123321cba'
|
api_id: 'abc123321cba'
|
||||||
|
@ -82,7 +81,6 @@ tasks:
|
||||||
swagger_file: my_api.yml
|
swagger_file: my_api.yml
|
||||||
|
|
||||||
# update definitions and deploy API to production
|
# update definitions and deploy API to production
|
||||||
tasks:
|
|
||||||
- name: deploy API
|
- name: deploy API
|
||||||
aws_api_gateway:
|
aws_api_gateway:
|
||||||
api_id: 'abc123321cba'
|
api_id: 'abc123321cba'
|
||||||
|
|
|
@ -62,7 +62,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
|
|
||||||
# create a Direct Connect connection
|
# create a Direct Connect connection
|
||||||
aws_direct_connect_connection:
|
- aws_direct_connect_connection:
|
||||||
name: ansible-test-connection
|
name: ansible-test-connection
|
||||||
state: present
|
state: present
|
||||||
location: EqDC2
|
location: EqDC2
|
||||||
|
@ -71,14 +71,14 @@ aws_direct_connect_connection:
|
||||||
register: dc
|
register: dc
|
||||||
|
|
||||||
# disassociate the LAG from the connection
|
# disassociate the LAG from the connection
|
||||||
aws_direct_connect_connection:
|
- aws_direct_connect_connection:
|
||||||
state: present
|
state: present
|
||||||
connection_id: dc.connection.connection_id
|
connection_id: dc.connection.connection_id
|
||||||
location: EqDC2
|
location: EqDC2
|
||||||
bandwidth: 1Gbps
|
bandwidth: 1Gbps
|
||||||
|
|
||||||
# replace the connection with one with more bandwidth
|
# replace the connection with one with more bandwidth
|
||||||
aws_direct_connect_connection:
|
- aws_direct_connect_connection:
|
||||||
state: present
|
state: present
|
||||||
name: ansible-test-connection
|
name: ansible-test-connection
|
||||||
location: EqDC2
|
location: EqDC2
|
||||||
|
@ -86,7 +86,7 @@ aws_direct_connect_connection:
|
||||||
forced_update: True
|
forced_update: True
|
||||||
|
|
||||||
# delete the connection
|
# delete the connection
|
||||||
aws_direct_connect_connection:
|
- aws_direct_connect_connection:
|
||||||
state: absent
|
state: absent
|
||||||
name: ansible-test-connection
|
name: ansible-test-connection
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -596,19 +596,23 @@ EXAMPLES = '''
|
||||||
#
|
#
|
||||||
|
|
||||||
# instances with tag foo
|
# instances with tag foo
|
||||||
|
- ec2:
|
||||||
count_tag:
|
count_tag:
|
||||||
foo:
|
foo:
|
||||||
|
|
||||||
# instances with tag foo=bar
|
# instances with tag foo=bar
|
||||||
|
- ec2:
|
||||||
count_tag:
|
count_tag:
|
||||||
foo: bar
|
foo: bar
|
||||||
|
|
||||||
# instances with tags foo=bar & baz
|
# instances with tags foo=bar & baz
|
||||||
|
- ec2:
|
||||||
count_tag:
|
count_tag:
|
||||||
foo: bar
|
foo: bar
|
||||||
baz:
|
baz:
|
||||||
|
|
||||||
# instances with tags foo & bar & baz=bang
|
# instances with tags foo & bar & baz=bang
|
||||||
|
- ec2:
|
||||||
count_tag:
|
count_tag:
|
||||||
- foo
|
- foo
|
||||||
- bar
|
- bar
|
||||||
|
|
|
@ -64,7 +64,6 @@ notes:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Example of getting a password
|
# Example of getting a password
|
||||||
tasks:
|
|
||||||
- name: get the Administrator password
|
- name: get the Administrator password
|
||||||
ec2_win_password:
|
ec2_win_password:
|
||||||
profile: my-boto-profile
|
profile: my-boto-profile
|
||||||
|
@ -73,7 +72,6 @@ tasks:
|
||||||
key_file: "~/aws-creds/my_test_key.pem"
|
key_file: "~/aws-creds/my_test_key.pem"
|
||||||
|
|
||||||
# Example of getting a password with a password protected key
|
# Example of getting a password with a password protected key
|
||||||
tasks:
|
|
||||||
- name: get the Administrator password
|
- name: get the Administrator password
|
||||||
ec2_win_password:
|
ec2_win_password:
|
||||||
profile: my-boto-profile
|
profile: my-boto-profile
|
||||||
|
@ -83,7 +81,6 @@ tasks:
|
||||||
key_passphrase: "secret"
|
key_passphrase: "secret"
|
||||||
|
|
||||||
# Example of waiting for a password
|
# Example of waiting for a password
|
||||||
tasks:
|
|
||||||
- name: get the Administrator password
|
- name: get the Administrator password
|
||||||
ec2_win_password:
|
ec2_win_password:
|
||||||
profile: my-boto-profile
|
profile: my-boto-profile
|
||||||
|
|
|
@ -51,11 +51,11 @@ EXAMPLES = '''
|
||||||
# Note: These examples do not set authentication details, see the AWS Guide for details.
|
# 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)
|
# List MFA devices (more details: http://docs.aws.amazon.com/IAM/latest/APIReference/API_ListMFADevices.html)
|
||||||
iam_mfa_device_facts:
|
- iam_mfa_device_facts:
|
||||||
register: mfa_devices
|
register: mfa_devices
|
||||||
|
|
||||||
# Assume an existing role (more details: http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
|
# Assume an existing role (more details: http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
|
||||||
sts_assume_role:
|
- sts_assume_role:
|
||||||
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}"
|
mfa_serial_number: "{{ mfa_devices.mfa_devices[0].serial_number }}"
|
||||||
role_arn: "arn:aws:iam::123456789012:role/someRole"
|
role_arn: "arn:aws:iam::123456789012:role/someRole"
|
||||||
role_session_name: "someRoleSession"
|
role_session_name: "someRoleSession"
|
||||||
|
|
|
@ -72,7 +72,6 @@ extends_documentation_fragment:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a policy with the name of 'Admin' to the group 'administrators'
|
# Create a policy with the name of 'Admin' to the group 'administrators'
|
||||||
tasks:
|
|
||||||
- name: Assign a policy called Admin to the administrators group
|
- name: Assign a policy called Admin to the administrators group
|
||||||
iam_policy:
|
iam_policy:
|
||||||
iam_type: group
|
iam_type: group
|
||||||
|
@ -83,7 +82,6 @@ tasks:
|
||||||
|
|
||||||
# Advanced example, create two new groups and add a READ-ONLY policy to both
|
# Advanced example, create two new groups and add a READ-ONLY policy to both
|
||||||
# groups.
|
# groups.
|
||||||
task:
|
|
||||||
- name: Create Two Groups, Mario and Luigi
|
- name: Create Two Groups, Mario and Luigi
|
||||||
iam:
|
iam:
|
||||||
iam_type: group
|
iam_type: group
|
||||||
|
@ -104,7 +102,6 @@ task:
|
||||||
with_items: "{{ new_groups.results }}"
|
with_items: "{{ new_groups.results }}"
|
||||||
|
|
||||||
# Create a new S3 policy with prefix per user
|
# Create a new S3 policy with prefix per user
|
||||||
tasks:
|
|
||||||
- name: Create S3 policy from template
|
- name: Create S3 policy from template
|
||||||
iam_policy:
|
iam_policy:
|
||||||
iam_type: user
|
iam_type: user
|
||||||
|
|
|
@ -125,7 +125,6 @@ extends_documentation_fragment:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create Lambda functions
|
# Create Lambda functions
|
||||||
tasks:
|
|
||||||
- name: looped creation
|
- name: looped creation
|
||||||
lambda:
|
lambda:
|
||||||
name: '{{ item.name }}'
|
name: '{{ item.name }}'
|
||||||
|
@ -154,7 +153,6 @@ tasks:
|
||||||
key2: "2"
|
key2: "2"
|
||||||
|
|
||||||
# Basic Lambda function deletion
|
# Basic Lambda function deletion
|
||||||
tasks:
|
|
||||||
- name: Delete Lambda functions HelloWorld and ByeBye
|
- name: Delete Lambda functions HelloWorld and ByeBye
|
||||||
lambda:
|
lambda:
|
||||||
name: '{{ item }}'
|
name: '{{ item }}'
|
||||||
|
|
|
@ -104,7 +104,7 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create an account in domain 'CUSTOMERS'
|
# create an account in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_account
|
module: cs_account
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
username: customer_xy
|
username: customer_xy
|
||||||
|
@ -115,28 +115,28 @@ local_action:
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
|
||||||
# Lock an existing account in domain 'CUSTOMERS'
|
# Lock an existing account in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_account
|
module: cs_account
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: locked
|
state: locked
|
||||||
|
|
||||||
# Disable an existing account in domain 'CUSTOMERS'
|
# Disable an existing account in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_account
|
module: cs_account
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: disabled
|
state: disabled
|
||||||
|
|
||||||
# Enable an existing account in domain 'CUSTOMERS'
|
# Enable an existing account in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_account
|
module: cs_account
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: enabled
|
state: enabled
|
||||||
|
|
||||||
# Remove an account in domain 'CUSTOMERS'
|
# Remove an account in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_account
|
module: cs_account
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
|
|
@ -251,11 +251,6 @@ gateway_ipv6:
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: 2001:db8::1
|
sample: 2001:db8::1
|
||||||
state:
|
|
||||||
description: State of the network.
|
|
||||||
returned: success
|
|
||||||
type: string
|
|
||||||
sample: Implemented
|
|
||||||
zone:
|
zone:
|
||||||
description: Name of zone.
|
description: Name of zone.
|
||||||
returned: success
|
returned: success
|
||||||
|
|
|
@ -82,14 +82,14 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create a network ACL
|
# create a network ACL
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl
|
module: cs_network_acl
|
||||||
name: Webserver ACL
|
name: Webserver ACL
|
||||||
description: a more detailed description of the ACL
|
description: a more detailed description of the ACL
|
||||||
vpc: customers
|
vpc: customers
|
||||||
|
|
||||||
# remove a network ACL
|
# remove a network ACL
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl
|
module: cs_network_acl
|
||||||
name: Webserver ACL
|
name: Webserver ACL
|
||||||
vpc: customers
|
vpc: customers
|
||||||
|
|
|
@ -145,7 +145,7 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create a network ACL rule, allow port 80 ingress
|
# create a network ACL rule, allow port 80 ingress
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl_rule
|
module: cs_network_acl_rule
|
||||||
network_acl: web
|
network_acl: web
|
||||||
rule_position: 1
|
rule_position: 1
|
||||||
|
@ -156,7 +156,7 @@ local_action:
|
||||||
cidr: 0.0.0.0/0
|
cidr: 0.0.0.0/0
|
||||||
|
|
||||||
# create a network ACL rule, deny port range 8000-9000 ingress for 10.20.0.0/16
|
# create a network ACL rule, deny port range 8000-9000 ingress for 10.20.0.0/16
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl_rule
|
module: cs_network_acl_rule
|
||||||
network_acl: web
|
network_acl: web
|
||||||
rule_position: 1
|
rule_position: 1
|
||||||
|
@ -168,7 +168,7 @@ local_action:
|
||||||
cidr: 10.20.0.0/16
|
cidr: 10.20.0.0/16
|
||||||
|
|
||||||
# create a network ACL rule
|
# create a network ACL rule
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl_rule
|
module: cs_network_acl_rule
|
||||||
network_acl: web
|
network_acl: web
|
||||||
rule_position: 1
|
rule_position: 1
|
||||||
|
@ -180,7 +180,7 @@ local_action:
|
||||||
cidr: 10.20.0.0/16
|
cidr: 10.20.0.0/16
|
||||||
|
|
||||||
# remove a network ACL rule
|
# remove a network ACL rule
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_network_acl_rule
|
module: cs_network_acl_rule
|
||||||
network_acl: web
|
network_acl: web
|
||||||
rule_position: 1
|
rule_position: 1
|
||||||
|
|
|
@ -60,14 +60,14 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create a region
|
# create a region
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_region
|
module: cs_region
|
||||||
id: 2
|
id: 2
|
||||||
name: geneva
|
name: geneva
|
||||||
endpoint: https://cloud.gva.example.com
|
endpoint: https://cloud.gva.example.com
|
||||||
|
|
||||||
# remove a region with ID 2
|
# remove a region with ID 2
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_region
|
module: cs_region
|
||||||
id: 2
|
id: 2
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -76,14 +76,14 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Update a resource limit for instances of a domain
|
# Update a resource limit for instances of a domain
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_resourcelimit
|
module: cs_resourcelimit
|
||||||
type: instance
|
type: instance
|
||||||
limit: 10
|
limit: 10
|
||||||
domain: customers
|
domain: customers
|
||||||
|
|
||||||
# Update a resource limit for instances of an account
|
# Update a resource limit for instances of an account
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_resourcelimit
|
module: cs_resourcelimit
|
||||||
type: instance
|
type: instance
|
||||||
limit: 12
|
limit: 12
|
||||||
|
|
|
@ -111,7 +111,6 @@ EXAMPLES = '''
|
||||||
pod: pod01
|
pod: pod01
|
||||||
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
|
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
|
||||||
provider: DefaultPrimary
|
provider: DefaultPrimary
|
||||||
name: Ceph RBD
|
|
||||||
scope: cluster
|
scope: cluster
|
||||||
allocation_state: disabled
|
allocation_state: disabled
|
||||||
|
|
||||||
|
@ -124,7 +123,6 @@ EXAMPLES = '''
|
||||||
pod: pod01
|
pod: pod01
|
||||||
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
|
storage_url: rbd://admin:SECRET@ceph-the-mons.domain/poolname
|
||||||
provider: DefaultPrimary
|
provider: DefaultPrimary
|
||||||
name: Ceph RBD
|
|
||||||
scope: cluster
|
scope: cluster
|
||||||
allocation_state: maintenance
|
allocation_state: maintenance
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ extends_documentation_fragment: cloudstack
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# create an user in domain 'CUSTOMERS'
|
# create an user in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
account: developers
|
account: developers
|
||||||
username: johndoe
|
username: johndoe
|
||||||
|
@ -112,28 +112,28 @@ local_action:
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
|
||||||
# Lock an existing user in domain 'CUSTOMERS'
|
# Lock an existing user in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: locked
|
state: locked
|
||||||
|
|
||||||
# Disable an existing user in domain 'CUSTOMERS'
|
# Disable an existing user in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: disabled
|
state: disabled
|
||||||
|
|
||||||
# Enable/unlock an existing user in domain 'CUSTOMERS'
|
# Enable/unlock an existing user in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
username: johndoe
|
username: johndoe
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
state: enabled
|
state: enabled
|
||||||
|
|
||||||
# Remove an user in domain 'CUSTOMERS'
|
# Remove an user in domain 'CUSTOMERS'
|
||||||
local_action:
|
- local_action:
|
||||||
module: cs_user
|
module: cs_user
|
||||||
name: customer_xy
|
name: customer_xy
|
||||||
domain: CUSTOMERS
|
domain: CUSTOMERS
|
||||||
|
|
|
@ -199,7 +199,7 @@ EXAMPLES = '''
|
||||||
# Create multiple instances by specifying multiple names, separated by
|
# Create multiple instances by specifying multiple names, separated by
|
||||||
# commas in the instance_names field
|
# commas in the instance_names field
|
||||||
# (e.g. my-test-instance1,my-test-instance2)
|
# (e.g. my-test-instance1,my-test-instance2)
|
||||||
gce:
|
- gce:
|
||||||
instance_names: my-test-instance1
|
instance_names: my-test-instance1
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
|
@ -213,7 +213,7 @@ EXAMPLES = '''
|
||||||
# Create a single instance of an image from the "my-base-image" image family
|
# 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.
|
# in the us-central1-a Zone of the n1-standard-1 machine type.
|
||||||
# This image family is in the "my-other-project" GCP project.
|
# This image family is in the "my-other-project" GCP project.
|
||||||
gce:
|
- gce:
|
||||||
instance_names: my-test-instance1
|
instance_names: my-test-instance1
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
|
@ -229,7 +229,7 @@ EXAMPLES = '''
|
||||||
# Create a single Debian 8 instance in the us-central1-a Zone
|
# Create a single Debian 8 instance in the us-central1-a Zone
|
||||||
# Use existing disks, custom network/subnetwork, set service account permissions
|
# Use existing disks, custom network/subnetwork, set service account permissions
|
||||||
# add tags and metadata.
|
# add tags and metadata.
|
||||||
gce:
|
- gce:
|
||||||
instance_names: my-test-instance
|
instance_names: my-test-instance
|
||||||
zone: us-central1-a
|
zone: us-central1-a
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
|
|
|
@ -42,7 +42,7 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a Global external IP address
|
# Create a Global external IP address
|
||||||
gce_eip:
|
- gce_eip:
|
||||||
service_account_email: "{{ service_account_email }}"
|
service_account_email: "{{ service_account_email }}"
|
||||||
credentials_file: "{{ credentials_file }}"
|
credentials_file: "{{ credentials_file }}"
|
||||||
project_id: "{{ project_id }}"
|
project_id: "{{ project_id }}"
|
||||||
|
@ -51,7 +51,7 @@ gce_eip:
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Create a Regional external IP address
|
# Create a Regional external IP address
|
||||||
gce_eip:
|
- gce_eip:
|
||||||
service_account_email: "{{ service_account_email }}"
|
service_account_email: "{{ service_account_email }}"
|
||||||
credentials_file: "{{ credentials_file }}"
|
credentials_file: "{{ credentials_file }}"
|
||||||
project_id: "{{ project_id }}"
|
project_id: "{{ project_id }}"
|
||||||
|
|
|
@ -45,17 +45,17 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
## List all Topics in a project
|
## List all Topics in a project
|
||||||
gcpubsub_facts:
|
- gcpubsub_facts:
|
||||||
view: topics
|
view: topics
|
||||||
state: list
|
state: list
|
||||||
|
|
||||||
## List all Subscriptions in a project
|
## List all Subscriptions in a project
|
||||||
gcpubsub_facts:
|
- gcpubsub_facts:
|
||||||
view: subscriptions
|
view: subscriptions
|
||||||
state: list
|
state: list
|
||||||
|
|
||||||
## List all Subscriptions for a Topic in a project
|
## List all Subscriptions for a Topic in a project
|
||||||
gcpubsub_facts:
|
- gcpubsub_facts:
|
||||||
view: subscriptions
|
view: subscriptions
|
||||||
topic: my-topic
|
topic: my-topic
|
||||||
state: list
|
state: list
|
||||||
|
|
|
@ -189,7 +189,6 @@ EXAMPLES = '''
|
||||||
alert_bwin_threshold: 10
|
alert_bwin_threshold: 10
|
||||||
alert_cpu_enabled: True
|
alert_cpu_enabled: True
|
||||||
alert_cpu_threshold: 210
|
alert_cpu_threshold: 210
|
||||||
alert_diskio_enabled: True
|
|
||||||
alert_bwout_enabled: True
|
alert_bwout_enabled: True
|
||||||
alert_bwout_threshold: 10
|
alert_bwout_threshold: 10
|
||||||
alert_diskio_enabled: True
|
alert_diskio_enabled: True
|
||||||
|
|
|
@ -235,7 +235,6 @@ EXAMPLES = '''
|
||||||
cluster: "RH"
|
cluster: "RH"
|
||||||
state: "down"
|
state: "down"
|
||||||
image: "centos7_x64"
|
image: "centos7_x64"
|
||||||
cluster: "centos"
|
|
||||||
|
|
||||||
# multi disk, multi nic create example
|
# multi disk, multi nic create example
|
||||||
- rhevm:
|
- rhevm:
|
||||||
|
|
|
@ -116,7 +116,6 @@ notes:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
tasks:
|
|
||||||
- block:
|
- block:
|
||||||
# Create a vault with `ovirt_password` variable which store your
|
# Create a vault with `ovirt_password` variable which store your
|
||||||
# oVirt/RHV user's password, and include that yaml file with variable:
|
# oVirt/RHV user's password, and include that yaml file with variable:
|
||||||
|
@ -150,7 +149,6 @@ tasks:
|
||||||
# in yaml file.
|
# in yaml file.
|
||||||
# This is mainly usefull when using Ansible Tower or AWX, as it will work
|
# This is mainly usefull when using Ansible Tower or AWX, as it will work
|
||||||
# for Red Hat Virtualization creadentials type.
|
# for Red Hat Virtualization creadentials type.
|
||||||
tasks:
|
|
||||||
- name: Obtain SSO token
|
- name: Obtain SSO token
|
||||||
ovirt_auth:
|
ovirt_auth:
|
||||||
state: present
|
state: present
|
||||||
|
|
|
@ -59,20 +59,20 @@ EXAMPLES = '''
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
# look at ovirt_auth module to see how to reuse authentication:
|
||||||
|
|
||||||
# Add group group1 from authorization provider example.com-authz
|
# Add group group1 from authorization provider example.com-authz
|
||||||
ovirt_group:
|
- ovirt_group:
|
||||||
name: group1
|
name: group1
|
||||||
domain: example.com-authz
|
domain: example.com-authz
|
||||||
|
|
||||||
# Add group group1 from authorization provider example.com-authz
|
# Add group group1 from authorization provider example.com-authz
|
||||||
# In case of multi-domain Active Directory setup, you should pass
|
# In case of multi-domain Active Directory setup, you should pass
|
||||||
# also namespace, so it adds correct group:
|
# also namespace, so it adds correct group:
|
||||||
ovirt_group:
|
- ovirt_group:
|
||||||
name: group1
|
name: group1
|
||||||
namespace: dc=ad2,dc=example,dc=com
|
namespace: dc=ad2,dc=example,dc=com
|
||||||
domain: example.com-authz
|
domain: example.com-authz
|
||||||
|
|
||||||
# Remove group group1 with authorization provider example.com-authz
|
# Remove group group1 with authorization provider example.com-authz
|
||||||
ovirt_group:
|
- ovirt_group:
|
||||||
state: absent
|
state: absent
|
||||||
name: group1
|
name: group1
|
||||||
domain: example.com-authz
|
domain: example.com-authz
|
||||||
|
|
|
@ -82,7 +82,7 @@ EXAMPLES = '''
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
# 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:
|
# Add cluster quota to cluster cluster1 with memory limit 20GiB and CPU limit to 10:
|
||||||
ovirt_quotas:
|
- ovirt_quotas:
|
||||||
name: quota1
|
name: quota1
|
||||||
data_center: dcX
|
data_center: dcX
|
||||||
clusters:
|
clusters:
|
||||||
|
@ -91,7 +91,7 @@ ovirt_quotas:
|
||||||
cpu: 10
|
cpu: 10
|
||||||
|
|
||||||
# Add cluster quota to all clusters with memory limit 30GiB and CPU limit to 15:
|
# Add cluster quota to all clusters with memory limit 30GiB and CPU limit to 15:
|
||||||
ovirt_quotas:
|
- ovirt_quotas:
|
||||||
name: quota2
|
name: quota2
|
||||||
data_center: dcX
|
data_center: dcX
|
||||||
clusters:
|
clusters:
|
||||||
|
@ -99,7 +99,7 @@ ovirt_quotas:
|
||||||
cpu: 15
|
cpu: 15
|
||||||
|
|
||||||
# Add storage quota to storage data1 with size limit to 100GiB
|
# Add storage quota to storage data1 with size limit to 100GiB
|
||||||
ovirt_quotas:
|
- ovirt_quotas:
|
||||||
name: quota3
|
name: quota3
|
||||||
data_center: dcX
|
data_center: dcX
|
||||||
storage_grace: 40
|
storage_grace: 40
|
||||||
|
@ -109,7 +109,7 @@ ovirt_quotas:
|
||||||
size: 100
|
size: 100
|
||||||
|
|
||||||
# Remove quota quota1 (Note the quota must not be assigned to any VM/disk):
|
# Remove quota quota1 (Note the quota must not be assigned to any VM/disk):
|
||||||
ovirt_quotas:
|
- ovirt_quotas:
|
||||||
state: absent
|
state: absent
|
||||||
data_center: dcX
|
data_center: dcX
|
||||||
name: quota1
|
name: quota1
|
||||||
|
|
|
@ -55,18 +55,18 @@ EXAMPLES = '''
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
# look at ovirt_auth module to see how to reuse authentication:
|
||||||
|
|
||||||
# Add user user1 from authorization provider example.com-authz
|
# Add user user1 from authorization provider example.com-authz
|
||||||
ovirt_users:
|
- ovirt_users:
|
||||||
name: user1
|
name: user1
|
||||||
domain: example.com-authz
|
domain: example.com-authz
|
||||||
|
|
||||||
# Add user user1 from authorization provider example.com-authz
|
# Add user user1 from authorization provider example.com-authz
|
||||||
# In case of Active Directory specify UPN:
|
# In case of Active Directory specify UPN:
|
||||||
ovirt_users:
|
- ovirt_users:
|
||||||
name: user1@ad2.example.com
|
name: user1@ad2.example.com
|
||||||
domain: example.com-authz
|
domain: example.com-authz
|
||||||
|
|
||||||
# Remove user user1 with authorization provider example.com-authz
|
# Remove user user1 with authorization provider example.com-authz
|
||||||
ovirt_users:
|
- ovirt_users:
|
||||||
state: absent
|
state: absent
|
||||||
name: user1
|
name: user1
|
||||||
authz_name: example.com-authz
|
authz_name: example.com-authz
|
||||||
|
|
|
@ -35,15 +35,15 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Return facts about all installed images.
|
# Return facts about all installed images.
|
||||||
smartos_image_facts:
|
- smartos_image_facts:
|
||||||
|
|
||||||
# Return all private active Linux images.
|
# 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.
|
# 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)"
|
has {{ smartos_images[item]['clones'] }} VM(s)"
|
||||||
with_items: "{{ smartos_images.keys() }}"
|
with_items: "{{ smartos_images.keys() }}"
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -628,7 +628,6 @@ EXAMPLES = '''
|
||||||
- sg-8f4b8fe9
|
- sg-8f4b8fe9
|
||||||
spot_instance_types:
|
spot_instance_types:
|
||||||
- c3.large
|
- c3.large
|
||||||
state: absent
|
|
||||||
do_not_update:
|
do_not_update:
|
||||||
- image_id
|
- image_id
|
||||||
- target
|
- target
|
||||||
|
|
|
@ -126,7 +126,7 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a metric monitor
|
# Create a metric monitor
|
||||||
datadog_monitor:
|
- datadog_monitor:
|
||||||
type: "metric alert"
|
type: "metric alert"
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "present"
|
state: "present"
|
||||||
|
@ -136,14 +136,14 @@ datadog_monitor:
|
||||||
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
||||||
|
|
||||||
# Deletes a monitor
|
# Deletes a monitor
|
||||||
datadog_monitor:
|
- datadog_monitor:
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "absent"
|
state: "absent"
|
||||||
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
||||||
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
||||||
|
|
||||||
# Mutes a monitor
|
# Mutes a monitor
|
||||||
datadog_monitor:
|
- datadog_monitor:
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "mute"
|
state: "mute"
|
||||||
silenced: '{"*":None}'
|
silenced: '{"*":None}'
|
||||||
|
@ -151,7 +151,7 @@ datadog_monitor:
|
||||||
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
||||||
|
|
||||||
# Unmutes a monitor
|
# Unmutes a monitor
|
||||||
datadog_monitor:
|
- datadog_monitor:
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "unmute"
|
state: "unmute"
|
||||||
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
||||||
|
|
|
@ -85,7 +85,7 @@ EXAMPLES = r'''
|
||||||
description: Web Intranet EPG
|
description: Web Intranet EPG
|
||||||
bd: prod_bd
|
bd: prod_bd
|
||||||
|
|
||||||
aci_epg:
|
- aci_epg:
|
||||||
hostname: apic
|
hostname: apic
|
||||||
username: admin
|
username: admin
|
||||||
password: SomeSecretPassword
|
password: SomeSecretPassword
|
||||||
|
|
|
@ -66,7 +66,6 @@ EXAMPLES = '''
|
||||||
addr: 10.30.10.66
|
addr: 10.30.10.66
|
||||||
type: V4
|
type: V4
|
||||||
ratio: 3
|
ratio: 3
|
||||||
api_version: 16.4
|
|
||||||
- name: Patch GSLB Service to delete an existing member
|
- name: Patch GSLB Service to delete an existing member
|
||||||
avi_gslbservice_patch_member:
|
avi_gslbservice_patch_member:
|
||||||
controller: "{{ controller }}"
|
controller: "{{ controller }}"
|
||||||
|
|
|
@ -96,8 +96,6 @@ EXAMPLES = """
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Run display version on remote devices"
|
- name: "Run display version on remote devices"
|
||||||
ce_command:
|
ce_command:
|
||||||
|
|
|
@ -166,7 +166,7 @@ end_state:
|
||||||
type: dict
|
type: dict
|
||||||
sample: {"process_id": "1", "area": "0.0.0.100", "interface": "10GE1/0/30",
|
sample: {"process_id": "1", "area": "0.0.0.100", "interface": "10GE1/0/30",
|
||||||
"cost": "100", "dead_interval": "40", "hello_interval": "10",
|
"cost": "100", "dead_interval": "40", "hello_interval": "10",
|
||||||
"process_id": "6", "silent_interface": "false", "auth_mode": "none"}
|
"silent_interface": "false", "auth_mode": "none"}
|
||||||
updates:
|
updates:
|
||||||
description: commands sent to the device
|
description: commands sent to the device
|
||||||
returned: always
|
returned: always
|
||||||
|
|
|
@ -158,7 +158,7 @@ end_state:
|
||||||
returned: always
|
returned: always
|
||||||
type: dict
|
type: dict
|
||||||
sample: {"snmp local user": {"local_user_info": []},
|
sample: {"snmp local user": {"local_user_info": []},
|
||||||
"snmp local user": {"local_user_info": [{"aclNumber": "2000", "engineID": "800007DB03389222111200",
|
"snmp usm user": {"usm_user_info": [{"aclNumber": "2000", "engineID": "800007DB03389222111200",
|
||||||
"groupName": "wdz_group", "userName": "wdz_snmp"}]}}
|
"groupName": "wdz_group", "userName": "wdz_snmp"}]}}
|
||||||
updates:
|
updates:
|
||||||
description: command sent to the device
|
description: command sent to the device
|
||||||
|
|
|
@ -87,7 +87,6 @@ Tasks : The following are examples of using the module cnos_conditional_command.
|
||||||
condition: "{{ hostvars[inventory_hostname]['condition']}}"
|
condition: "{{ hostvars[inventory_hostname]['condition']}}"
|
||||||
flag: leaf_switch2
|
flag: leaf_switch2
|
||||||
command: "spanning-tree mode enable"
|
command: "spanning-tree mode enable"
|
||||||
enablePassword: "anil"
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -58,16 +58,16 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Create IPv4 tunnel interface 'iptun0'
|
- name: Create IPv4 tunnel interface 'iptun0'
|
||||||
dladm_iptun: name=iptun0 local_address=192.0.2.23 remote_address=203.0.113.10 state=present
|
dladm_iptun: name=iptun0 local_address=192.0.2.23 remote_address=203.0.113.10 state=present
|
||||||
|
|
||||||
name: Change IPv4 tunnel remote address
|
- name: Change IPv4 tunnel remote address
|
||||||
dladm_iptun: name=iptun0 type=ipv4 local_address=192.0.2.23 remote_address=203.0.113.11
|
dladm_iptun: name=iptun0 type=ipv4 local_address=192.0.2.23 remote_address=203.0.113.11
|
||||||
|
|
||||||
name: Create IPv6 tunnel interface 'tun0'
|
- name: Create IPv6 tunnel interface 'tun0'
|
||||||
dladm_iptun: name=tun0 type=ipv6 local_address=192.0.2.23 remote_address=203.0.113.42
|
dladm_iptun: name=tun0 type=ipv6 local_address=192.0.2.23 remote_address=203.0.113.42
|
||||||
|
|
||||||
name: Remove 'iptun0' tunnel interface
|
- name: Remove 'iptun0' tunnel interface
|
||||||
dladm_iptun: name=iptun0 state=absent
|
dladm_iptun: name=iptun0 state=absent
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Set 'maxbw' to 100M on e1000g1
|
- name: Set 'maxbw' to 100M on e1000g1
|
||||||
dladm_linkprop: name=e1000g1 property=maxbw value=100M state=present
|
dladm_linkprop: name=e1000g1 property=maxbw value=100M state=present
|
||||||
|
|
||||||
name: Set 'mtu' to 9000 on e1000g1
|
- name: Set 'mtu' to 9000 on e1000g1
|
||||||
dladm_linkprop: name=e1000g1 property=mtu value=9000
|
dladm_linkprop: name=e1000g1 property=mtu value=9000
|
||||||
|
|
||||||
name: Reset 'mtu' property on e1000g1
|
- name: Reset 'mtu' property on e1000g1
|
||||||
dladm_linkprop: name=e1000g1 property=mtu state=reset
|
dladm_linkprop: name=e1000g1 property=mtu state=reset
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,10 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Create 'vlan42' VLAN over 'bnx0' link
|
- name: Create 'vlan42' VLAN over 'bnx0' link
|
||||||
dladm_vlan: name=vlan42 link=bnx0 vlan_id=42 state=present
|
dladm_vlan: name=vlan42 link=bnx0 vlan_id=42 state=present
|
||||||
|
|
||||||
name: Remove 'vlan1337' VLAN interface
|
- name: Remove 'vlan1337' VLAN interface
|
||||||
dladm_vlan: name=vlan1337 state=absent
|
dladm_vlan: name=vlan1337 state=absent
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -59,16 +59,16 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Configure IP address 10.0.0.1 on e1000g0
|
- name: Configure IP address 10.0.0.1 on e1000g0
|
||||||
ipadm_addr: addr=10.0.0.1/32 addrobj=e1000g0/v4 state=present
|
ipadm_addr: addr=10.0.0.1/32 addrobj=e1000g0/v4 state=present
|
||||||
|
|
||||||
name: Delete addrobj
|
- name: Delete addrobj
|
||||||
ipadm_addr: addrobj=e1000g0/v4 state=absent
|
ipadm_addr: addrobj=e1000g0/v4 state=absent
|
||||||
|
|
||||||
name: Configure link-local IPv6 address
|
- name: Configure link-local IPv6 address
|
||||||
ipadm_addr: addtype=addrconf addrobj=vnic0/v6
|
ipadm_addr: addtype=addrconf addrobj=vnic0/v6
|
||||||
|
|
||||||
name: Configure address via DHCP and wait 180 seconds for address obtaining
|
- name: Configure address via DHCP and wait 180 seconds for address obtaining
|
||||||
ipadm_addr: addrobj=vnic0/dhcp addrtype=dhcp wait=180
|
ipadm_addr: addrobj=vnic0/dhcp addrtype=dhcp wait=180
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,10 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Mark address on addrobj as deprecated
|
- name: Mark address on addrobj as deprecated
|
||||||
ipadm_addrprop: property=deprecated value=on addrobj=e1000g0/v6
|
ipadm_addrprop: property=deprecated value=on addrobj=e1000g0/v6
|
||||||
|
|
||||||
name: Set network prefix length for addrobj
|
- name: Set network prefix length for addrobj
|
||||||
ipadm_addrprop: addrobj=bge0/v4 name=prefixlen value=26
|
ipadm_addrprop: addrobj=bge0/v4 name=prefixlen value=26
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -55,16 +55,16 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Allow forwarding of IPv4 packets on network interface e1000g0
|
- name: Allow forwarding of IPv4 packets on network interface e1000g0
|
||||||
ipadm_ifprop: protocol=ipv4 property=forwarding value=on interface=e1000g0
|
ipadm_ifprop: protocol=ipv4 property=forwarding value=on interface=e1000g0
|
||||||
|
|
||||||
name: Temporarily reset IPv4 forwarding property on network interface e1000g0
|
- name: Temporarily reset IPv4 forwarding property on network interface e1000g0
|
||||||
ipadm_ifprop: protocol=ipv4 interface=e1000g0 temporary=true property=forwarding state=reset
|
ipadm_ifprop: protocol=ipv4 interface=e1000g0 temporary=true property=forwarding state=reset
|
||||||
|
|
||||||
name: Configure IPv6 metric on network interface e1000g0
|
- name: Configure IPv6 metric on network interface e1000g0
|
||||||
ipadm_ifprop: protocol=ipv6 nic=e1000g0 name=metric value=100
|
ipadm_ifprop: protocol=ipv6 nic=e1000g0 name=metric value=100
|
||||||
|
|
||||||
name: Set IPv6 MTU on network interface bge0
|
- name: Set IPv6 MTU on network interface bge0
|
||||||
ipadm_ifprop: interface=bge0 name=mtu value=1280 protocol=ipv6
|
ipadm_ifprop: interface=bge0 name=mtu value=1280 protocol=ipv6
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,10 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Set TCP receive buffer size
|
# Set TCP receive buffer size
|
||||||
ipadm_prop: protocol=tcp property=recv_buf value=65536
|
- ipadm_prop: protocol=tcp property=recv_buf value=65536
|
||||||
|
|
||||||
# Reset UDP send buffer size to the default value
|
# Reset UDP send buffer size to the default value
|
||||||
ipadm_prop: protocol=udp property=send_buf state=reset
|
- ipadm_prop: protocol=udp property=send_buf state=reset
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -60,7 +60,6 @@ options:
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# ENSURE VTP PASSWORD IS SET
|
# ENSURE VTP PASSWORD IS SET
|
||||||
- nxos_vtp_password:
|
- nxos_vtp_password:
|
||||||
password: ntc
|
|
||||||
state: present
|
state: present
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
username: "{{ un }}"
|
username: "{{ un }}"
|
||||||
|
@ -68,7 +67,6 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# ENSURE VTP PASSWORD IS REMOVED
|
# ENSURE VTP PASSWORD IS REMOVED
|
||||||
- nxos_vtp_password:
|
- nxos_vtp_password:
|
||||||
password: ntc
|
|
||||||
state: absent
|
state: absent
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
username: "{{ un }}"
|
username: "{{ un }}"
|
||||||
|
|
|
@ -86,7 +86,7 @@ EXAMPLES = r'''
|
||||||
purpose: node
|
purpose: node
|
||||||
first_addr: 20:00:00:25:B5:48:00:00
|
first_addr: 20:00:00:25:B5:48:00:00
|
||||||
last_addr: 20:00:00:25:B5:48:00:0F
|
last_addr: 20:00:00:25:B5:48:00:0F
|
||||||
ucs_wwn_pool:
|
- ucs_wwn_pool:
|
||||||
hostname: 172.16.143.150
|
hostname: 172.16.143.150
|
||||||
username: admin
|
username: admin
|
||||||
password: password
|
password: password
|
||||||
|
@ -103,7 +103,7 @@ EXAMPLES = r'''
|
||||||
password: password
|
password: password
|
||||||
name: WWNN-Pool
|
name: WWNN-Pool
|
||||||
state: absent
|
state: absent
|
||||||
ucs_wwn_pool:
|
- ucs_wwn_pool:
|
||||||
hostname: 172.16.143.150
|
hostname: 172.16.143.150
|
||||||
username: admin
|
username: admin
|
||||||
password: password
|
password: password
|
||||||
|
|
|
@ -98,12 +98,6 @@ EXAMPLES = """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
msg:
|
|
||||||
description: Successful removal
|
|
||||||
returned: success
|
|
||||||
type: string
|
|
||||||
sample: "Async mirror group removed."
|
|
||||||
|
|
||||||
msg:
|
msg:
|
||||||
description: Successful creation
|
description: Successful creation
|
||||||
returned: success
|
returned: success
|
||||||
|
|
|
@ -45,10 +45,10 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Gather facts about ZFS pool rpool
|
# Gather facts about ZFS pool rpool
|
||||||
zpool_facts: pool=rpool
|
- zpool_facts: pool=rpool
|
||||||
|
|
||||||
# Gather space usage about all imported ZFS pools
|
# Gather space usage about all imported ZFS pools
|
||||||
zpool_facts: properties='free,size'
|
- zpool_facts: properties='free,size'
|
||||||
debug: msg='ZFS pool {{ item.name }} has {{ item.free }} free space out of {{ item.size }}.'
|
debug: msg='ZFS pool {{ item.name }} has {{ item.free }} free space out of {{ item.size }}.'
|
||||||
with_items: '{{ ansible_zfs_pools }}'
|
with_items: '{{ ansible_zfs_pools }}'
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -44,7 +44,7 @@ EXAMPLES = """
|
||||||
- debug:
|
- debug:
|
||||||
msg: task10
|
msg: task10
|
||||||
|
|
||||||
hosts: all
|
- hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
- debug:
|
- debug:
|
||||||
msg: task1
|
msg: task1
|
||||||
|
|
|
@ -67,10 +67,10 @@ notes:
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
# Merge in a registry file without comparing to current registry
|
# Merge in a registry file without comparing to current registry
|
||||||
# Note that paths using / to separate are preferred as they require less special handling than \
|
# Note that paths using / to separate are preferred as they require less special handling than \
|
||||||
win_regmerge:
|
- win_regmerge:
|
||||||
path: C:/autodeploy/myCompany-settings.reg
|
path: C:/autodeploy/myCompany-settings.reg
|
||||||
# Compare and merge registry file
|
# Compare and merge registry file
|
||||||
win_regmerge:
|
- win_regmerge:
|
||||||
path: C:/autodeploy/myCompany-settings.reg
|
path: C:/autodeploy/myCompany-settings.reg
|
||||||
compare_to: HKLM:\SOFTWARE\myCompany
|
compare_to: HKLM:\SOFTWARE\myCompany
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
"""Sanity test using yamllint."""
|
"""Sanity test using yamllint."""
|
||||||
from __future__ import absolute_import, print_function
|
from __future__ import absolute_import, print_function
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
|
|
||||||
from lib.sanity import (
|
from lib.sanity import (
|
||||||
SanitySingleVersion,
|
SanitySingleVersion,
|
||||||
|
@ -15,7 +15,6 @@ from lib.sanity import (
|
||||||
from lib.util import (
|
from lib.util import (
|
||||||
SubprocessError,
|
SubprocessError,
|
||||||
run_command,
|
run_command,
|
||||||
find_executable,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from lib.config import (
|
from lib.config import (
|
||||||
|
@ -31,15 +30,42 @@ class YamllintTest(SanitySingleVersion):
|
||||||
:type targets: SanityTargets
|
:type targets: SanityTargets
|
||||||
:rtype: SanityResult
|
:rtype: SanityResult
|
||||||
"""
|
"""
|
||||||
paths = sorted(i.path for i in targets.include if os.path.splitext(i.path)[1] in ('.yml', '.yaml'))
|
paths = [
|
||||||
|
[i.path for i in targets.include if os.path.splitext(i.path)[1] in ('.yml', '.yaml')],
|
||||||
|
|
||||||
|
[i.path for i in targets.include if os.path.splitext(i.path)[1] == '.py' and
|
||||||
|
os.path.basename(i.path) != '__init__.py' and
|
||||||
|
i.path.startswith('lib/ansible/modules/')],
|
||||||
|
|
||||||
|
[i.path for i in targets.include if os.path.splitext(i.path)[1] == '.py' and
|
||||||
|
os.path.basename(i.path) != '__init__.py' and
|
||||||
|
i.path.startswith('lib/ansible/utils/module_docs_fragments/')],
|
||||||
|
]
|
||||||
|
|
||||||
|
paths = [sorted(p) for p in paths if p]
|
||||||
|
|
||||||
if not paths:
|
if not paths:
|
||||||
return SanitySkipped(self.name)
|
return SanitySkipped(self.name)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
|
||||||
|
for test_paths in paths:
|
||||||
|
results += self.test_paths(args, test_paths)
|
||||||
|
|
||||||
|
if results:
|
||||||
|
return SanityFailure(self.name, messages=results)
|
||||||
|
|
||||||
|
return SanitySuccess(self.name)
|
||||||
|
|
||||||
|
def test_paths(self, args, paths):
|
||||||
|
"""
|
||||||
|
:type args: SanityConfig
|
||||||
|
:type paths: list[str]
|
||||||
|
:rtype: list[SanityMessage]
|
||||||
|
"""
|
||||||
cmd = [
|
cmd = [
|
||||||
'python%s' % args.python_version,
|
'python%s' % args.python_version,
|
||||||
find_executable('yamllint'),
|
'test/sanity/yamllint/yamllinter.py',
|
||||||
'--format', 'parsable',
|
|
||||||
] + paths
|
] + paths
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -54,11 +80,9 @@ class YamllintTest(SanitySingleVersion):
|
||||||
raise SubprocessError(cmd=cmd, status=status, stderr=stderr, stdout=stdout)
|
raise SubprocessError(cmd=cmd, status=status, stderr=stderr, stdout=stdout)
|
||||||
|
|
||||||
if args.explain:
|
if args.explain:
|
||||||
return SanitySuccess(self.name)
|
return []
|
||||||
|
|
||||||
pattern = r'^(?P<path>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+): \[(?P<level>warning|error)\] (?P<message>.*)$'
|
results = json.loads(stdout)['messages']
|
||||||
|
|
||||||
results = [re.search(pattern, line).groupdict() for line in stdout.splitlines()]
|
|
||||||
|
|
||||||
results = [SanityMessage(
|
results = [SanityMessage(
|
||||||
message=r['message'],
|
message=r['message'],
|
||||||
|
@ -68,7 +92,4 @@ class YamllintTest(SanitySingleVersion):
|
||||||
level=r['level'],
|
level=r['level'],
|
||||||
) for r in results]
|
) for r in results]
|
||||||
|
|
||||||
if results:
|
return results
|
||||||
return SanityFailure(self.name, messages=results)
|
|
||||||
|
|
||||||
return SanitySuccess(self.name)
|
|
||||||
|
|
19
test/sanity/yamllint/config/default.yml
Normal file
19
test/sanity/yamllint/config/default.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces: {max-spaces-inside: 1, level: error}
|
||||||
|
brackets: {max-spaces-inside: 1, level: error}
|
||||||
|
colons: {max-spaces-after: -1, level: error}
|
||||||
|
commas: {max-spaces-after: -1, level: error}
|
||||||
|
comments: disable
|
||||||
|
comments-indentation: disable
|
||||||
|
document-start: disable
|
||||||
|
empty-lines: {max: 3, level: error}
|
||||||
|
hyphens: {level: error}
|
||||||
|
indentation: disable
|
||||||
|
key-duplicates: enable
|
||||||
|
line-length: disable
|
||||||
|
new-line-at-end-of-file: disable
|
||||||
|
new-lines: {type: unix}
|
||||||
|
trailing-spaces: disable
|
||||||
|
truthy: disable
|
19
test/sanity/yamllint/config/modules.yml
Normal file
19
test/sanity/yamllint/config/modules.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces: disable
|
||||||
|
brackets: disable
|
||||||
|
colons: disable
|
||||||
|
commas: disable
|
||||||
|
comments: disable
|
||||||
|
comments-indentation: disable
|
||||||
|
document-start: disable
|
||||||
|
empty-lines: disable
|
||||||
|
hyphens: disable
|
||||||
|
indentation: disable
|
||||||
|
key-duplicates: enable
|
||||||
|
line-length: disable
|
||||||
|
new-line-at-end-of-file: disable
|
||||||
|
new-lines: {type: unix}
|
||||||
|
trailing-spaces: disable
|
||||||
|
truthy: disable
|
183
test/sanity/yamllint/yamllinter.py
Executable file
183
test/sanity/yamllint/yamllinter.py
Executable file
|
@ -0,0 +1,183 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""Wrapper around yamllint that supports YAML embedded in Ansible modules."""
|
||||||
|
|
||||||
|
from __future__ import absolute_import, print_function
|
||||||
|
|
||||||
|
import ast
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from yamllint import linter
|
||||||
|
from yamllint.config import YamlLintConfig
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main program body."""
|
||||||
|
paths = sys.argv[1:]
|
||||||
|
|
||||||
|
checker = YamlChecker()
|
||||||
|
checker.check(paths)
|
||||||
|
checker.report()
|
||||||
|
|
||||||
|
|
||||||
|
class YamlChecker(object):
|
||||||
|
"""Wrapper around yamllint that supports YAML embedded in Ansible modules."""
|
||||||
|
def __init__(self):
|
||||||
|
self.messages = []
|
||||||
|
|
||||||
|
def report(self):
|
||||||
|
"""Print yamllint report to stdout."""
|
||||||
|
report = dict(
|
||||||
|
messages=self.messages,
|
||||||
|
)
|
||||||
|
|
||||||
|
print(json.dumps(report, indent=4, sort_keys=True))
|
||||||
|
|
||||||
|
def check(self, paths):
|
||||||
|
"""
|
||||||
|
:type paths: str
|
||||||
|
"""
|
||||||
|
yaml_conf = YamlLintConfig(file='test/sanity/yamllint/config/default.yml')
|
||||||
|
module_conf = YamlLintConfig(file='test/sanity/yamllint/config/modules.yml')
|
||||||
|
|
||||||
|
for path in paths:
|
||||||
|
extension = os.path.splitext(path)[1]
|
||||||
|
|
||||||
|
with open(path) as f:
|
||||||
|
contents = f.read()
|
||||||
|
|
||||||
|
if extension in ('.yml', '.yaml'):
|
||||||
|
self.check_yaml(yaml_conf, path, contents)
|
||||||
|
elif extension == '.py':
|
||||||
|
self.check_module(module_conf, path, contents)
|
||||||
|
else:
|
||||||
|
raise Exception('unsupported extension: %s' % extension)
|
||||||
|
|
||||||
|
def check_yaml(self, conf, path, contents):
|
||||||
|
"""
|
||||||
|
:type conf: YamlLintConfig
|
||||||
|
:type path: str
|
||||||
|
:type contents: str
|
||||||
|
"""
|
||||||
|
self.messages += [self.result_to_message(r, path) for r in linter.run(contents, conf, path)]
|
||||||
|
|
||||||
|
def check_module(self, conf, path, contents):
|
||||||
|
"""
|
||||||
|
:type conf: YamlLintConfig
|
||||||
|
:type path: str
|
||||||
|
:type contents: str
|
||||||
|
"""
|
||||||
|
docs = self.get_module_docs(path, contents)
|
||||||
|
|
||||||
|
for key, value in docs.items():
|
||||||
|
yaml = value['yaml']
|
||||||
|
lineno = value['lineno']
|
||||||
|
|
||||||
|
if yaml.startswith('\n'):
|
||||||
|
yaml = yaml[1:]
|
||||||
|
lineno += 1
|
||||||
|
|
||||||
|
messages = list(linter.run(yaml, conf, path))
|
||||||
|
|
||||||
|
self.messages += [self.result_to_message(r, path, lineno - 1, key) for r in messages]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def result_to_message(result, path, line_offset=0, prefix=''):
|
||||||
|
"""
|
||||||
|
:type result: any
|
||||||
|
:type path: str
|
||||||
|
:type line_offset: int
|
||||||
|
:type prefix: str
|
||||||
|
:rtype: dict[str, any]
|
||||||
|
"""
|
||||||
|
if prefix:
|
||||||
|
prefix = '%s: ' % prefix
|
||||||
|
|
||||||
|
return dict(
|
||||||
|
code=result.rule or result.level,
|
||||||
|
message=prefix + result.desc,
|
||||||
|
path=path,
|
||||||
|
line=result.line + line_offset,
|
||||||
|
column=result.column,
|
||||||
|
level=result.level,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_module_docs(self, path, contents):
|
||||||
|
"""
|
||||||
|
:type path: str
|
||||||
|
:type contents: str
|
||||||
|
:rtype: dict[str, any]
|
||||||
|
"""
|
||||||
|
module_doc_types = [
|
||||||
|
'DOCUMENTATION',
|
||||||
|
'EXAMPLES',
|
||||||
|
'RETURN',
|
||||||
|
]
|
||||||
|
|
||||||
|
docs = {}
|
||||||
|
|
||||||
|
def check_assignment(statement, doc_types=None):
|
||||||
|
"""Check the given statement for a documentation assignment."""
|
||||||
|
for target in statement.targets:
|
||||||
|
if doc_types and target.id not in doc_types:
|
||||||
|
continue
|
||||||
|
|
||||||
|
docs[target.id] = dict(
|
||||||
|
yaml=statement.value.s,
|
||||||
|
lineno=statement.lineno,
|
||||||
|
end_lineno=statement.lineno + len(statement.value.s.splitlines())
|
||||||
|
)
|
||||||
|
|
||||||
|
module_ast = self.parse_module(path, contents)
|
||||||
|
|
||||||
|
if not module_ast:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
if path.startswith('lib/ansible/modules/'):
|
||||||
|
for body_statement in module_ast.body:
|
||||||
|
if isinstance(body_statement, ast.Assign):
|
||||||
|
check_assignment(body_statement, module_doc_types)
|
||||||
|
elif path.startswith('lib/ansible/utils/module_docs_fragments/'):
|
||||||
|
for body_statement in module_ast.body:
|
||||||
|
if isinstance(body_statement, ast.ClassDef):
|
||||||
|
for class_statement in body_statement.body:
|
||||||
|
if isinstance(class_statement, ast.Assign):
|
||||||
|
check_assignment(class_statement)
|
||||||
|
else:
|
||||||
|
raise Exception('unsupported path: %s' % path)
|
||||||
|
|
||||||
|
return docs
|
||||||
|
|
||||||
|
def parse_module(self, path, contents):
|
||||||
|
"""
|
||||||
|
:type path: str
|
||||||
|
:type contents: str
|
||||||
|
:rtype: ast.Module | None
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return ast.parse(contents)
|
||||||
|
except SyntaxError as ex:
|
||||||
|
self.messages.append(dict(
|
||||||
|
code='python-syntax-error',
|
||||||
|
message=str(ex),
|
||||||
|
path=path,
|
||||||
|
line=ex.lineno,
|
||||||
|
column=ex.offset,
|
||||||
|
level='error',
|
||||||
|
))
|
||||||
|
except Exception as ex:
|
||||||
|
self.messages.append(dict(
|
||||||
|
code='python-parse-error',
|
||||||
|
message=str(ex),
|
||||||
|
path=path,
|
||||||
|
line=0,
|
||||||
|
column=0,
|
||||||
|
level='error',
|
||||||
|
))
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in a new issue