Skip to content

Commit

Permalink
ci: Update CI (and update example docstrings) for new and breaking ch…
Browse files Browse the repository at this point in the history
…anges in ansible-lint (#503)
  • Loading branch information
jamesholland-uk authored Oct 5, 2023
1 parent 39f2842 commit 9e9d934
Show file tree
Hide file tree
Showing 22 changed files with 130 additions and 133 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ jobs:
run:
working-directory: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
steps:
- uses: actions/checkout@v3
with:
path: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}

- name: Check out code
uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main

Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/panos_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@

EXAMPLES = """
# Set the password of user admin to "badpassword"
- name: set admin password
panos_admin:
ip_address: "192.168.1.1"
password: "admin"
admin_username: admin
admin_password: "badpassword"
- name: set admin password
panos_admin:
ip_address: "192.168.1.1"
password: "admin"
admin_username: admin
admin_password: "badpassword"
"""

RETURN = """
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/panos_administrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@

EXAMPLES = """
# Configure user "foo"
- name: configure foo administrator
panos_administrator:
provider: '{{ provider }}'
admin_username: 'foo'
admin_password: 'secret'
superuser: true
- name: configure foo administrator
panos_administrator:
provider: '{{ provider }}'
admin_username: 'foo'
admin_password: 'secret'
superuser: true
"""

RETURN = """
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/panos_application_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
provider: '{{ provider }}'
name: 'Software Updates'
value:
- ms-update
- apple-update
- adobe-update
- google-update
- ms-product-activation
- ms-update
- apple-update
- adobe-update
- google-update
- ms-product-activation
"""

RETURN = """
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/panos_bgp_policy_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
"""

EXAMPLES = """
"""

RETURN = """
Expand Down
60 changes: 30 additions & 30 deletions plugins/modules/panos_bgp_policy_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,38 +200,38 @@

EXAMPLES = """
# Add a BGP Policy
- name: Create Policy Import Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
vr_name: 'default'
name: 'import-rule-001'
type: 'import'
enable: true
action: 'allow'
address_prefix:
- name: '10.1.1.0/24'
- name: '10.1.2.0/24'
exact: false
- name: '10.1.3.0/24'
exact: true
action_dampening: 'dampening-profile'
- name: Create Policy Import Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
vr_name: 'default'
name: 'import-rule-001'
type: 'import'
enable: true
action: 'allow'
address_prefix:
- name: '10.1.1.0/24'
- name: '10.1.2.0/24'
exact: false
- name: '10.1.3.0/24'
exact: true
action_dampening: 'dampening-profile'
- name: Create Policy Export Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
vr_name: 'default'
name: 'export-rule-001'
type: 'export'
enable: true
action: 'allow'
- name: Create Policy Export Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
vr_name: 'default'
name: 'export-rule-001'
type: 'export'
enable: true
action: 'allow'
- name: Remove Export Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
state: 'absent'
vr_name: 'default'
name: 'export-rule-001'
type: 'export'
- name: Remove Export Rule
panos_bgp_policy_rule:
provider: '{{ provider }}'
state: 'absent'
vr_name: 'default'
name: 'export-rule-001'
type: 'export'
"""

RETURN = """
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
- name: commit changes by specified admins to firewall
panos_commit:
provider: '{{ provider }}'
admins: ['admin1','admin2']
admins: ['admin1', 'admin2']
"""

RETURN = """
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/panos_commit_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
- name: commit changes by specified admins on firewall
panos_commit_firewall:
provider: '{{ credentials }}'
admins: ['netops','secops','cloudops']
admins: ['netops', 'secops', 'cloudops']
description: 'Saturday change window'
- name: commit only policy and object changes on firewall
panos_commit_firewall:
provider: '{{ credentials }}'
exclude_device_and_network: True
exclude_device_and_network: true
"""

RETURN = r"""
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/panos_commit_panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@
- name: commit changes by specified admins on panorama
panos_commit_panorama:
provider: '{{ credentials }}'
admins: ['netops','secops','cloudops']
admins: ['netops', 'secops', 'cloudops']
description: 'Saturday change window'
- name: commit specific device group changes on panorama
panos_commit_panorama:
provider: '{{ credentials }}'
device_groups: ['production','development','testing']
device_groups: ['production', 'development', 'testing']
- name: commit log collector group changes on panorama
panos_commit_panorama:
provider: '{{ credentials }}'
log_collector_groups: ['us-west-loggers','apac-loggers','latam-loggers']
log_collector_groups: ['us-west-loggers', 'apac-loggers', 'latam-loggers']
description: 'Log collector changes'
"""

Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/panos_commit_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
provider: '{{ credentials }}'
style: 'template'
name: 'APAC Regional Template'
force_template_values: True
force_template_values: true
- name: push log collector group configs
panos_commit_push:
Expand All @@ -117,7 +117,7 @@
provider: '{{ credentials }}'
style: 'device group'
name: '{{ item }}'
sync: False
sync: false
loop:
- Production Firewalls
- Staging Firewalls
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/panos_custom_url_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
name: 'Internet Access List'
description: 'Description One'
url_value:
- microsoft.com
- redhat.com
- microsoft.com
- redhat.com
- name: Remove Custom Url Category 'Internet Access List'
panos_custom_url_category:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_dhcp_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
provider: '{{ provider }}'
dhcp_interface: 'ethernet1/1'
interface: 'ethernet1/1'
ipv4_enabled: True
ipv4_enabled: true
ipv4_servers:
- '1.1.1.1'
- '2.2.2.2'
Expand Down
84 changes: 42 additions & 42 deletions plugins/modules/panos_ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,48 +199,48 @@
"""

EXAMPLES = """
- name: set ports to HA mode
panos_interface:
provider: '{{ provider }}'
if_name: "{{ item }}"
mode: "ha"
enable_dhcp: false
with_items:
- ethernet1/1
- ethernet1/2
- ethernet1/3
- ethernet1/4
- ethernet1/5
- name: Configure Active/Standby HA
panos_ha:
provider: '{{ provider }}'
state: present
ha_peer_ip: "192.168.50.1"
ha1_ip_address: "192.168.50.2"
ha1_netmask: "255.255.255.252"
ha1_port: "ethernet1/1"
ha2_port: "ethernet1/3"
- name: Configure Active/Active HA
panos_ha:
provider: "{{ provider }}"
state: present
ha_mode: "active-active"
ha_device_id: 0
ha_session_owner_selection: "first-packet"
ha_session_setup: "first-packet"
ha_peer_ip: "192.168.50.1"
ha_peer_ip_backup: "192.168.50.5"
ha1_port: "ethernet1/1"
ha1_ip_address: "192.168.50.2"
ha1_netmask: "255.255.255.252"
ha1b_port: "ethernet1/2"
ha1b_ip_address: "192.168.50.6"
ha1b_netmask: "255.255.255.252"
ha2_port: "ethernet1/3"
ha2b_port: "ethernet1/4"
ha3_port: "ethernet1/5"
- name: set ports to HA mode
panos_interface:
provider: '{{ provider }}'
if_name: "{{ item }}"
mode: "ha"
enable_dhcp: false
with_items:
- ethernet1/1
- ethernet1/2
- ethernet1/3
- ethernet1/4
- ethernet1/5
- name: Configure Active/Standby HA
panos_ha:
provider: '{{ provider }}'
state: present
ha_peer_ip: "192.168.50.1"
ha1_ip_address: "192.168.50.2"
ha1_netmask: "255.255.255.252"
ha1_port: "ethernet1/1"
ha2_port: "ethernet1/3"
- name: Configure Active/Active HA
panos_ha:
provider: "{{ provider }}"
state: present
ha_mode: "active-active"
ha_device_id: 0
ha_session_owner_selection: "first-packet"
ha_session_setup: "first-packet"
ha_peer_ip: "192.168.50.1"
ha_peer_ip_backup: "192.168.50.5"
ha1_port: "ethernet1/1"
ha1_ip_address: "192.168.50.2"
ha1_netmask: "255.255.255.252"
ha1b_port: "ethernet1/2"
ha1b_ip_address: "192.168.50.6"
ha1b_netmask: "255.255.255.252"
ha2_port: "ethernet1/3"
ha2b_port: "ethernet1/4"
ha3_port: "ethernet1/5"
"""

RETURN = """
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/panos_ike_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@
name: 'IKEGW-Ansible'
version: 'ikev2'
interface: 'ethernet1/1'
enable_passive_mode: True
enable_liveness_check: True
enable_passive_mode: true
enable_liveness_check: true
liveness_check_interval: '5'
peer_ip_value: '1.2.3.4'
pre_shared_key: 'CHANGEME'
ikev2_crypto_profile: 'IKE-Ansible'
commit: False
commit: false
- name: Create IKE gateway (dynamic)
panos_ike_gateway:
Expand All @@ -225,7 +225,7 @@
interface: 'ethernet1/1'
peer_ip_type: dynamic
pre_shared_key: 'CHANGEME'
commit: False
commit: false
"""

RETURN = """
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_l3_subinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
provider: '{{ provider }}'
name: "ethernet1/1.5"
tag: 1
create_default_route: True
create_default_route: true
zone_name: "public"
# Update ethernet1/2.7 with a static IP address in zone dmz.
Expand Down
24 changes: 12 additions & 12 deletions plugins/modules/panos_loadcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@

EXAMPLES = """
# Import and load config file from URL
- name: import configuration
panos_import:
ip_address: "192.168.1.1"
password: "admin"
url: "{{ConfigURL}}"
category: "configuration"
register: result
- name: load configuration
panos_loadcfg:
ip_address: "192.168.1.1"
password: "admin"
file: "{{result.filename}}"
- name: import configuration
panos_import:
ip_address: "192.168.1.1"
password: "admin"
url: "{{ConfigURL}}"
category: "configuration"
register: result
- name: load configuration
panos_loadcfg:
ip_address: "192.168.1.1"
password: "admin"
file: "{{result.filename}}"
"""

RETURN = """
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
panos_op:
provider: '{{ provider }}'
cmd: 'set serial-number "123456"'
ignore_disconnect: True
ignore_disconnect: true
"""

RETURN = """
Expand Down
Loading

0 comments on commit 9e9d934

Please sign in to comment.