Skip to content

Commit

Permalink
ansible-lint (documentation) cleanup for plugins/ (#2036) (#2037)
Browse files Browse the repository at this point in the history
[PR #2036/6dd4a00b backport][stable-7] ansible-lint (documentation) cleanup for plugins/

This is a backport of PR #2036 as merged into main (6dd4a00).
SUMMARY
Fixes an array of ansible-lint failures in plugins/
Adds ansible-lint plugins/ to tox -m lint
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
plugins/
ADDITIONAL INFORMATION
docs changes only (no changelog fragment needed)

Reviewed-by: Mark Chappell
  • Loading branch information
patchback[bot] authored Jan 5, 2024
1 parent f96dba0 commit 441c788
Show file tree
Hide file tree
Showing 71 changed files with 575 additions and 561 deletions.
55 changes: 32 additions & 23 deletions plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"""

EXAMPLES = r"""
---
# Wait for SSM Agent to be available on the Instance
- name: Wait for connection to be available
vars:
Expand Down Expand Up @@ -197,17 +198,19 @@
path: C:\Windows\temp
state: directory
---
# Making use of Dynamic Inventory Plugin
# =======================================
# aws_ec2.yml (Dynamic Inventory - Linux)
# This will return the Instance IDs matching the filter
#plugin: aws_ec2
#regions:
# - us-east-1
#hostnames:
# - instance-id
#filters:
# tag:SSMTag: ssmlinux
# # aws_ec2.yml (Dynamic Inventory - Linux)
# plugin: aws_ec2
# regions:
# - us-east-1
# hostnames:
# - instance-id
# # This will return the Instances with the tag "SSMTag" set to "ssmlinux"
# filters:
# tag:SSMTag: ssmlinux
# -----------------------
- name: install aws-cli
hosts: all
Expand All @@ -217,20 +220,23 @@
ansible_aws_ssm_bucket_name: nameofthebucket
ansible_aws_ssm_region: us-east-1
tasks:
- name: aws-cli
raw: yum install -y awscli
tags: aws-cli
- name: aws-cli
raw: yum install -y awscli
tags: aws-cli
---
# Execution: ansible-playbook linux.yaml -i aws_ec2.yml
# The playbook tasks will get executed on the instance ids returned from the dynamic inventory plugin using ssm connection.
# =====================================================
# aws_ec2.yml (Dynamic Inventory - Windows)
#plugin: aws_ec2
#regions:
# - us-east-1
#hostnames:
# - instance-id
#filters:
# tag:SSMTag: ssmwindows
# # aws_ec2.yml (Dynamic Inventory - Windows)
# plugin: aws_ec2
# regions:
# - us-east-1
# hostnames:
# - instance-id
# # This will return the Instances with the tag "SSMTag" set to "ssmwindows"
# filters:
# tag:SSMTag: ssmwindows
# -----------------------
- name: Create a dir.
hosts: all
Expand All @@ -245,10 +251,13 @@
win_file:
path: C:\Temp\SSM_Testing5
state: directory
---
# Execution: ansible-playbook win_file.yaml -i aws_ec2.yml
# The playbook tasks will get executed on the instance ids returned from the dynamic inventory plugin using ssm connection.
# Install a Nginx Package on Linux Instance; with specific SSE for file transfer
# Install a Nginx Package on Linux Instance; with specific SSE CMK used for the file transfer
- name: Install a Nginx Package
vars:
ansible_connection: aws_ssm
Expand All @@ -262,7 +271,7 @@
name: nginx
state: present
# Install a Nginx Package on Linux Instance; with dedicated SSM document
# Install a Nginx Package on Linux Instance; using the specified SSM document
- name: Install a Nginx Package
vars:
ansible_connection: aws_ssm
Expand Down
7 changes: 6 additions & 1 deletion plugins/inventory/aws_mq.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,26 @@
"""

EXAMPLES = r"""
---
# Minimal example using AWS credentials from environment vars or instance role credentials
# Get all brokers in us-east-1 region
plugin: community.aws.aws_mq
regions:
- ca-central-1
---
# Example multiple regions, ignoring permission errors, and only brokers with state RUNNING
plugin: community.aws.aws_mq
regions:
- us-east-1
- us-east-2
strict_permissions: False
strict_permissions: false
statuses:
- RUNNING
---
# Example group by engine, hostvars custom prefix-suffix, and compose variable from tags
plugin: community.aws.aws_mq
regions:
Expand Down
5 changes: 2 additions & 3 deletions plugins/modules/acm_certificate_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
- name: obtain all certificates pending validation
community.aws.acm_certificate_info:
statuses:
- PENDING_VALIDATION
- PENDING_VALIDATION
- name: obtain all certificates with tag Name=foo and myTag=bar
community.aws.acm_certificate_info:
Expand All @@ -69,8 +69,7 @@
# The output is still a list of certificates, just one item long.
- name: obtain information about a certificate with a particular ARN
community.aws.acm_certificate_info:
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12"
certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12"
"""

RETURN = r"""
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@
swagger_file: my_api.yml
cache_enabled: true
cache_size: '6.1'
canary_settings: { percentTraffic: 50.0, deploymentId: '123', useStageCache: True }
canary_settings:
percentTraffic: 50.0
deploymentId: '123'
useStageCache: true
state: present
- name: Delete API gateway
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/api_gateway_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
security_policy: TLS_1_2
endpoint_type: EDGE
domain_mappings:
- { rest_api_id: abc123, stage: production }
- rest_api_id: abc123
stage: production
state: present
register: api_gw_domain_result
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/api_gateway_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
- name: List all for a specific function
community.aws.api_gateway_info:
ids:
- 012345678a
- abcdefghij
- 012345678a
- abcdefghij
"""

RETURN = r"""
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/autoscaling_instance_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
preferences:
min_healthy_percentage: 91
instance_warmup: 60
"""

RETURN = r"""
Expand Down
84 changes: 45 additions & 39 deletions plugins/modules/autoscaling_launch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,65 +192,71 @@
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
security_groups:
- 'group'
- 'group2'
instance_type: t1.micro
volumes:
- device_name: /dev/sda1
volume_size: 100
volume_type: io1
iops: 3000
delete_on_termination: true
encrypted: true
- device_name: /dev/sdb
ephemeral: ephemeral0
- device_name: /dev/sda1
volume_size: 100
volume_type: io1
iops: 3000
delete_on_termination: true
encrypted: true
- device_name: /dev/sdb
ephemeral: ephemeral0
- name: create a launch configuration using a running instance id as a basis
community.aws.autoscaling_launch_config:
name: special
instance_id: i-00a48b207ec59e948
key_name: default
security_groups: ['launch-wizard-2' ]
security_groups:
- 'launch-wizard-2'
volumes:
- device_name: /dev/sda1
volume_size: 120
volume_type: io1
iops: 3000
delete_on_termination: true
- device_name: /dev/sda1
volume_size: 120
volume_type: io1
iops: 3000
delete_on_termination: true
- name: create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image
community.aws.autoscaling_launch_config:
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
security_groups:
- 'group'
- 'group2'
instance_type: t1.micro
volumes:
- device_name: /dev/sdf
no_device: true
- device_name: /dev/sdf
no_device: true
- name: Use EBS snapshot ID for volume
block:
- name: Set Volume Facts
ansible.builtin.set_fact:
volumes:
- device_name: /dev/sda1
volume_size: 20
ebs:
snapshot: snap-XXXX
volume_type: gp2
delete_on_termination: true
encrypted: false
- name: Create launch configuration
community.aws.autoscaling_launch_config:
name: lc1
image_id: ami-xxxx
assign_public_ip: true
instance_type: t2.medium
key_name: my-key
security_groups: "['sg-xxxx']"
volumes: "{{ volumes }}"
register: lc_info
- name: Set Volume Facts
ansible.builtin.set_fact:
volumes:
- device_name: /dev/sda1
volume_size: 20
ebs:
snapshot: snap-XXXX
volume_type: gp2
delete_on_termination: true
encrypted: false
- name: Create launch configuration
community.aws.autoscaling_launch_config:
name: lc1
image_id: ami-xxxx
assign_public_ip: true
instance_type: t2.medium
key_name: my-key
security_groups:
- 'sg-xxxx'
volumes: "{{ volumes }}"
register: lc_info
"""

RETURN = r"""
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/batch_job_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
job_queue_state: ENABLED
priority: 1
compute_environment_order:
- order: 1
compute_environment: my_compute_env1
- order: 2
compute_environment: my_compute_env2
- order: 1
compute_environment: my_compute_env1
- order: 2
compute_environment: my_compute_env2
register: batch_job_queue_action
- name: show results
Expand Down
7 changes: 3 additions & 4 deletions plugins/modules/cloudformation_stack_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
- 123456789012
- 234567890123
regions:
- us-east-1
- us-east-1
- name: The same type of update, but wait for the update to complete in all stacks
community.aws.cloudformation_stack_set:
Expand All @@ -217,7 +217,7 @@
- 123456789012
- 234567890123
regions:
- us-east-1
- us-east-1
- name: Register new accounts (create new stack instances) with an existing stack set.
community.aws.cloudformation_stack_set:
Expand All @@ -234,7 +234,7 @@
- 234567890123
- 345678901234
regions:
- us-east-1
- us-east-1
"""

RETURN = r"""
Expand Down Expand Up @@ -315,7 +315,6 @@
other:
Type: "AWS::SNS::Topic"
Properties: {}
"""

import datetime
Expand Down
18 changes: 10 additions & 8 deletions plugins/modules/cloudfront_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@
state: present
distribution_id: E1RP5A2MJ8073O
comment: modified by cloudfront.py again
aliases: [ 'www.my-distribution-source.com', 'zzz.aaa.io' ]
aliases:
- 'www.my-distribution-source.com'
- 'zzz.aaa.io'
- name: update a distribution's aliases and comment using an alias as a reference
community.aws.cloudfront_distribution:
Expand All @@ -652,20 +654,20 @@
state: present
caller_reference: unique test distribution ID
origins:
- id: 'my test origin-000111'
domain_name: www.example.com
origin_path: /production
custom_headers:
- header_name: MyCustomHeaderName
header_value: MyCustomHeaderValue
- id: 'my test origin-000111'
domain_name: www.example.com
origin_path: /production
custom_headers:
- header_name: MyCustomHeaderName
header_value: MyCustomHeaderValue
default_cache_behavior:
target_origin_id: 'my test origin-000111'
forwarded_values:
query_string: true
cookies:
forward: all
headers:
- '*'
- '*'
viewer_protocol_policy: allow-all
smooth_streaming: true
compress: true
Expand Down
Loading

0 comments on commit 441c788

Please sign in to comment.