Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint - checkout before action #598

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ jobs:
name: Ansible Lint # Naming the build is important to use it as a status check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main # or version tag instead of 'main'
24 changes: 12 additions & 12 deletions docs/ansible.netcommon.cli_command_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Examples
ansible.netcommon.cli_command:
command: commit replace
prompt: This commit will replace or remove the entire running configuration
answer: yes
answer: "yes"

- name: run command expecting user confirmation
ansible.netcommon.cli_command:
Expand All @@ -178,27 +178,27 @@ Examples

- name: run config mode command and handle prompt/answer
ansible.netcommon.cli_command:
command: '{{ item }}'
command: "{{ item }}"
prompt:
- Exit with uncommitted changes
- Exit with uncommitted changes
answer: y
loop:
- configure
- set system syslog file test any any
- exit
- configure
- set system syslog file test any any
- exit

- name: multiple prompt, multiple answer (mandatory check for all prompts)
ansible.netcommon.cli_command:
command: copy sftp sftp://user@host//user/test.img
check_all: true
prompt:
- Confirm download operation
- Password
- Do you want to change that to the standby image
- Confirm download operation
- Password
- Do you want to change that to the standby image
answer:
- y
- <password>
- y
- y
- <password>
- y



Expand Down
4 changes: 2 additions & 2 deletions docs/ansible.netcommon.cli_config_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ Examples
- name: configure device with config with defaults enabled
ansible.netcommon.cli_config:
config: "{{ lookup('template', 'basic/config.j2') }}"
defaults: yes
defaults: "yes"

- name: Use diff_match
ansible.netcommon.cli_config:
Expand All @@ -325,7 +325,7 @@ Examples
- name: configurable backup path
ansible.netcommon.cli_config:
config: "{{ lookup('template', 'basic/config.j2') }}"
backup: yes
backup: "yes"
backup_options:
filename: backup.cfg
dir_path: /home/user
Expand Down
63 changes: 31 additions & 32 deletions docs/ansible.netcommon.grpc_config_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,37 @@ Examples
.. code-block:: yaml

- name: Merge static route config
ansible.netcommon.grpc_config:
config:
Cisco-IOS-XR-ip-static-cfg:router-static:
default-vrf:
address-family:
vrfipv4:
vrf-unicast:
vrf-prefixes:
vrf-prefix:
- prefix: "1.2.3.6"
prefix-length: 32
vrf-route:
vrf-next-hop-table:
vrf-next-hop-next-hop-address:
- next-hop-address: "10.0.2.2"

state: merged

- name: Merge bgp config
ansible.netcommon.grpc_config:
config: "{{ lookup('file', 'bgp.json') }}"
state: merged

- name: Find diff
diff: True
ansible.netcommon.grpc_config:
config: "{{ lookup('file', 'bgp_start.yml') }}"
state: merged

- name: Backup running config
ansible.netcommon.grpc_config:
backup: yes
ansible.netcommon.grpc_config:
config:
Cisco-IOS-XR-ip-static-cfg:router-static:
default-vrf:
address-family:
vrfipv4:
vrf-unicast:
vrf-prefixes:
vrf-prefix:
- prefix: "1.2.3.6"
prefix-length: 32
vrf-route:
vrf-next-hop-table:
vrf-next-hop-next-hop-address:
- next-hop-address: "10.0.2.2"
state: merged

- name: Merge bgp config
ansible.netcommon.grpc_config:
config: "{{ lookup('file', 'bgp.json') }}"
state: merged

- name: Find diff
diff: true
ansible.netcommon.grpc_config:
config: "{{ lookup('file', 'bgp_start.yml') }}"
state: merged

- name: Backup running config
ansible.netcommon.grpc_config:
backup: true



Expand Down
16 changes: 8 additions & 8 deletions docs/ansible.netcommon.grpc_get_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ Examples
.. code-block:: yaml

- name: Get bgp configuration data
grpc_get:
section:
Cisco-IOS-XR-ip-static-cfg:router-static:
- null
- name: run cli command
grpc_get:
command: 'show version'
display: text
grpc_get:
section:
Cisco-IOS-XR-ip-static-cfg:router-static:
- null
- name: run cli command
grpc_get:
command: "show version"
display: text



Expand Down
86 changes: 45 additions & 41 deletions docs/ansible.netcommon.netconf_config_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -431,64 +431,69 @@ Examples

- name: configure interface while providing different private key file path (for connection=netconf)
ansible.netcommon.netconf_config:
backup: yes
backup: true
register: backup_junos_location
vars:
ansible_private_key_file: /home/admin/.ssh/newprivatekeyfile

- name: configurable backup path
ansible.netcommon.netconf_config:
backup: yes
backup: true
backup_options:
filename: backup.cfg
dir_path: /home/user

- name: "configure using direct native format configuration (cisco iosxr)"
ansible.netcommon.netconf_config:
format: json
content: {
"config": {
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": {
"active": "act",
"description": "test for ansible Loopback999",
"interface-name": "Loopback999"
}
}
}
}
get_filter: {
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
}
}
content:
{
"config":
{
"interface-configurations":
{
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration":
{
"active": "act",
"description": "test for ansible Loopback999",
"interface-name": "Loopback999",
},
},
},
}
get_filter:
{
"interface-configurations":
{
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null,
},
}

- name: "configure using json string format configuration (cisco iosxr)"
ansible.netcommon.netconf_config:
format: json
content: |
{
"config": {
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": {
"active": "act",
"description": "test for ansible Loopback999",
"interface-name": "Loopback999"
}
}
}
}
get_filter: |
{
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
{
"config": {
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": {
"active": "act",
"description": "test for ansible Loopback999",
"interface-name": "Loopback999"
}
}

}
}
get_filter: |
{
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
}
}

# Make a round-trip interface description change, diff the before and after
# this demonstrates the use of the native display format and several utilities
Expand All @@ -512,8 +517,8 @@ Examples
- name: Update the description
ansible.utils.update_fact:
updates:
- path: pre.output.data.interfaces.interface.config.description
value: "Configured by ansible {{ 100 | random }}"
- path: pre.output.data.interfaces.interface.config.description
value: "Configured by ansible {{ 100 | random }}"
register: updated

- name: Apply the new configuration
Expand All @@ -533,7 +538,6 @@ Examples
ansible.utils.fact_diff:
before: "{{ pre.output.data|ansible.utils.to_paths }}"
after: "{{ post.output.data|ansible.utils.to_paths }}"

# TASK [Show the differences between the pre and post configurations] ********
# --- before
# +++ after
Expand Down
28 changes: 14 additions & 14 deletions docs/ansible.netcommon.netconf_get_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ Examples
- name: "get configuration with json filter string and native output (using xmltodict)"
netconf_get:
filter: |
{
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
}
}
{
"interface-configurations": {
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
}
}
display: native

- name: Define the Cisco IOSXR interface filter
Expand All @@ -211,16 +211,17 @@ Examples

- name: "get configuration with direct native filter type"
ansible.netcommon.netconf_get:
filter: {
"interface-configurations": {
filter:
{
"interface-configurations":
{
"@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg",
"interface-configuration": null
"interface-configuration": null,
},
}
}
display: native
register: result


# Make a round-trip interface description change, diff the before and after
# this demonstrates the use of the native display format and several utilities
# from the ansible.utils collection
Expand All @@ -243,8 +244,8 @@ Examples
- name: Update the description
ansible.utils.update_fact:
updates:
- path: pre.output.data.interfaces.interface.config.description
value: "Configured by ansible {{ 100 | random }}"
- path: pre.output.data.interfaces.interface.config.description
value: "Configured by ansible {{ 100 | random }}"
register: updated

- name: Apply the new configuration
Expand All @@ -264,7 +265,6 @@ Examples
ansible.utils.fact_diff:
before: "{{ pre.output.data|ansible.utils.to_paths }}"
after: "{{ post.output.data|ansible.utils.to_paths }}"

# TASK [Show the differences between the pre and post configurations] ********
# --- before
# +++ after
Expand Down
11 changes: 5 additions & 6 deletions docs/ansible.netcommon.pop_ace_filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Examples

.. code-block:: yaml

##Playbook with filter plugin example
## Playbook with filter plugin example
vars:
filter_options:
match_all: true
Expand Down Expand Up @@ -438,7 +438,7 @@ Examples
ansible.builtin.debug:
msg: "{{ acls_data | ansible.netcommon.pop_ace(filter_options=filter_options, match_criteria=match_criteria) }}"

##Output
## Output
# PLAY [Filter plugin example pop_ace] ******************************************************************************************************************

# TASK [Remove ace entries from a provided data] ***********************************************************************************************************
Expand Down Expand Up @@ -572,8 +572,8 @@ Examples
# afi: ipv6


##Playbook with workflow example
tasks:
## Playbook with workflow example
_tasks:
- name: Gather ACLs config from device existing ACLs config
cisco.ios.ios_acls:
state: gathered
Expand All @@ -598,8 +598,7 @@ Examples
state: overridden
config: "{{ clean_acls['clean_acls']['acls'] | from_yaml }}"


##Output
## Output

# PLAYBOOK: pop_ace_example.yml ***********************************************

Expand Down
Loading
Loading