Skip to content

Instantly share code, notes, and snippets.

@ashwini-mhatre
Created April 20, 2023 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwini-mhatre/4b2971f4b88d2ad458a13d9e788229d2 to your computer and use it in GitHub Desktop.
Save ashwini-mhatre/4b2971f4b88d2ad458a13d9e788229d2 to your computer and use it in GitHub Desktop.
INTERFACE remediate
ansible-playbook [core 2.13.7]
config file = /Users/amhatre/ansible-collections/playbooks/ansible.cfg
configured module search path = ['/Users/amhatre/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/amhatre/ansible_venvs/py3.8.5_final/lib/python3.8/site-packages/ansible
ansible collection location = /Users/amhatre/ansible-collections/collections
executable location = /Users/amhatre/ansible_venvs/py3.8.5_final/bin/ansible-playbook
python version = 3.8.5 (default, Jan 7 2021, 17:04:44) [Clang 12.0.0 (clang-1200.0.32.28)]
jinja version = 3.1.2
libyaml = True
Using /Users/amhatre/ansible-collections/playbooks/ansible.cfg as config file
host_list declined parsing /Users/amhatre/ansible-collections/playbooks/inventory/inventory.yaml as it did not pass its verify_file() method
script declined parsing /Users/amhatre/ansible-collections/playbooks/inventory/inventory.yaml as it did not pass its verify_file() method
Parsed /Users/amhatre/ansible-collections/playbooks/inventory/inventory.yaml inventory source with ini plugin
Skipping callback 'awx_display', as we already have a stdout callback.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: test_remediate.yaml **************************************************
1 plays in /Users/amhatre/ansible-collections/playbooks/test_remediate.yaml
PLAY [Restore config in network.] **********************************************
META: ran handlers
TASK [INTERFACES Manager] ******************************************************
task path: /Users/amhatre/ansible-collections/playbooks/test_remediate.yaml:6
TASK [network.interfaces.run : Include tasks] **********************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/interfaces/roles/run/tasks/main.yml:2
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/interfaces/roles/run/tasks/includes/remediate.yaml for 10.0.150.115 => (item={'name': 'remediate'})
TASK [Invoke gather function] **************************************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/interfaces/roles/run/tasks/includes/remediate.yaml:2
TASK [network.base.resource_manager : Run the platform specific tasks] *********
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/main.yml:2
[WARNING]: TASK: network.base.resource_manager : Run the platform specific
tasks: The loop variable 'item' is already in use. You should set the
`loop_var` value in the `loop_control` option for the task to something else to
avoid variable collisions and unexpected behavior.
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/./remediate.yaml for 10.0.150.115 => (item=/Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/remediate.yaml)
TASK [network.base.resource_manager : Set default path] ************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/remediate.yaml:2
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"inventory_directory": "./inventory"
},
"changed": false
}
TASK [network.base.resource_manager : Get list of SOT files] *******************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/remediate.yaml:7
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
<10.0.150.115> ESTABLISH LOCAL CONNECTION FOR USER: amhatre
<10.0.150.115> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj `"&& mkdir "` echo /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288 `" && echo ansible-tmp-1681984418.040695-35702-142369775332288="` echo /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288 `" ) && sleep 0'
Using module file /Users/amhatre/ansible_venvs/py3.8.5_final/lib/python3.8/site-packages/ansible/modules/find.py
<10.0.150.115> PUT /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/tmpb9kingv7 TO /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288/AnsiballZ_find.py
<10.0.150.115> EXEC /bin/sh -c 'chmod u+x /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288/ /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288/AnsiballZ_find.py && sleep 0'
<10.0.150.115> EXEC /bin/sh -c '/Users/amhatre/ansible_venvs/py3.8.5_final/bin/python /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288/AnsiballZ_find.py && sleep 0'
<10.0.150.115> EXEC /bin/sh -c 'rm -f -r /Users/amhatre/.ansible/tmp/ansible-local-356803ngu0esj/ansible-tmp-1681984418.040695-35702-142369775332288/ > /dev/null 2>&1 && sleep 0'
ok: [10.0.150.115] => {
"changed": false,
"examined": 3,
"files": [
{
"atime": 1677138631.4488409,
"ctime": 1677138630.422227,
"dev": 16777221,
"gid": 20,
"gr_name": "staff",
"inode": 24562605,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0644",
"mtime": 1677138630.4012318,
"nlink": 1,
"path": "inventory/host_vars/10.0.150.115/l3_interfaces.yaml",
"pw_name": "amhatre",
"rgrp": true,
"roth": true,
"rusr": true,
"size": 124,
"uid": 501,
"wgrp": false,
"woth": false,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
},
{
"atime": 1681811800.9191914,
"ctime": 1681811800.53858,
"dev": 16777221,
"gid": 20,
"gr_name": "staff",
"inode": 26270526,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0644",
"mtime": 1681811800.3272855,
"nlink": 1,
"path": "inventory/host_vars/10.0.150.115/l2_interfaces.yaml",
"pw_name": "amhatre",
"rgrp": true,
"roth": true,
"rusr": true,
"size": 160,
"uid": 501,
"wgrp": false,
"woth": false,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
},
{
"atime": 1681906602.7822738,
"ctime": 1681906601.5412874,
"dev": 16777221,
"gid": 20,
"gr_name": "staff",
"inode": 26270395,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0644",
"mtime": 1681906601.5412874,
"nlink": 1,
"path": "inventory/host_vars/10.0.150.115/interfaces.yaml",
"pw_name": "amhatre",
"rgrp": true,
"roth": true,
"rusr": true,
"size": 186,
"uid": 501,
"wgrp": false,
"woth": false,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
}
],
"invocation": {
"module_args": {
"age": null,
"age_stamp": "mtime",
"contains": null,
"depth": null,
"excludes": null,
"file_type": "file",
"follow": false,
"get_checksum": false,
"hidden": false,
"paths": [
"./inventory/host_vars/10.0.150.115"
],
"patterns": [
"*.yaml"
],
"read_whole_file": false,
"recurse": false,
"size": null,
"use_regex": false
}
},
"matched": 3,
"msg": "All paths examined",
"skipped_paths": {}
}
TASK [network.base.resource_manager : Set state as overridden to restore config] ***
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/remediate.yaml:15
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"state": "overridden"
},
"changed": false
}
TASK [network.base.resource_manager : Rectify drift] ***************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/tasks/remediate.yaml:19
[WARNING]: TASK: network.base.resource_manager : Rectify drift: The loop
variable 'item' is already in use. You should set the `loop_var` value in the
`loop_control` option for the task to something else to avoid variable
collisions and unexpected behavior.
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml for 10.0.150.115 => (item=l3_interfaces.yaml)
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml for 10.0.150.115 => (item=l2_interfaces.yaml)
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml for 10.0.150.115 => (item=interfaces.yaml)
TASK [network.base.resource_manager : Set facts] *******************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:2
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"lst": "l3_interfaces",
"name": "cisco.iosxr.iosxr_l3_interfaces",
"resource": "l3_interfaces"
},
"changed": false
}
TASK [network.base.resource_manager : Grab the resource facts] *****************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:8
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"module_vars": {
"l3_interfaces": [
{
"ipv4": [
{
"address": "198.51.100.1/24"
}
],
"name": "GigabitEthernet0/0/0/0"
},
{
"name": "GigabitEthernet0/0/0/1"
}
]
}
},
"ansible_included_var_files": [
"/Users/amhatre/ansible-collections/playbooks/inventory/host_vars/10.0.150.115/l3_interfaces.yaml"
],
"changed": false
}
TASK [network.base.resource_manager : Set default state] ***********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:13
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [network.base.resource_manager : Include tasks] ***************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:18
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml for 10.0.150.115
TASK [network.base.resource_manager : Apply provided configuration] ************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml:2
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: {{ module_vars[resource] }}
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_connection": "ansible.netcommon.network_cli",
"ansible_network_os": "cisco.iosxr.iosxr",
"before": [
{
"ipv4": [
{
"address": "198.51.100.1/24"
}
],
"name": "GigabitEthernet0/0/0/0"
},
{
"name": "GigabitEthernet0/0/0/1"
}
],
"changed": false,
"commands": [],
"invocation": {
"module_args": {
"config": [
{
"ipv4": [
{
"address": "198.51.100.1 255.255.255.0",
"secondary": null
}
],
"ipv6": null,
"name": "GigabitEthernet0/0/0/0"
},
{
"ipv4": null,
"ipv6": null,
"name": "GigabitEthernet0/0/0/1"
}
],
"running_config": null,
"state": "overridden"
}
},
"resource_module_name": "cisco.iosxr.iosxr_l3_interfaces"
}
TASK [network.base.resource_manager : Apply configuration] *********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:23
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [network.base.resource_manager : Set facts] *******************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:2
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"lst": "l2_interfaces",
"name": "cisco.iosxr.iosxr_l2_interfaces",
"resource": "l2_interfaces"
},
"changed": false
}
TASK [network.base.resource_manager : Grab the resource facts] *****************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:8
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"module_vars": {
"l2_interfaces": [
{
"name": "GigabitEthernet0/0/0/0"
},
{
"l2protocol": [
{
"cpsv": "tunnel"
}
],
"l2transport": true,
"name": "GigabitEthernet0/0/0/1",
"propagate": true
}
]
}
},
"ansible_included_var_files": [
"/Users/amhatre/ansible-collections/playbooks/inventory/host_vars/10.0.150.115/l2_interfaces.yaml"
],
"changed": false
}
TASK [network.base.resource_manager : Set default state] ***********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:13
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [network.base.resource_manager : Include tasks] ***************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:18
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml for 10.0.150.115
TASK [network.base.resource_manager : Apply provided configuration] ************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml:2
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: {{ module_vars[resource] }}
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_connection": "ansible.netcommon.network_cli",
"ansible_network_os": "cisco.iosxr.iosxr",
"before": [
{
"name": "GigabitEthernet0/0/0/0"
},
{
"l2protocol": [
{
"cpsv": "tunnel"
}
],
"l2transport": true,
"name": "GigabitEthernet0/0/0/1",
"propagate": true
}
],
"changed": false,
"commands": [],
"invocation": {
"module_args": {
"config": [
{
"encapsulation": null,
"l2protocol": null,
"l2transport": null,
"name": "GigabitEthernet0/0/0/0",
"native_vlan": null,
"propagate": null,
"q_vlan": null
},
{
"encapsulation": null,
"l2protocol": [
{
"cdp": null,
"cpsv": "tunnel",
"pvst": null,
"stp": null,
"vtp": null
}
],
"l2transport": true,
"name": "GigabitEthernet0/0/0/1",
"native_vlan": null,
"propagate": true,
"q_vlan": null
}
],
"running_config": null,
"state": "overridden"
}
},
"resource_module_name": "cisco.iosxr.iosxr_l2_interfaces"
}
TASK [network.base.resource_manager : Apply configuration] *********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:23
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [network.base.resource_manager : Set facts] *******************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:2
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"lst": "interfaces",
"name": "cisco.iosxr.iosxr_interfaces",
"resource": "interfaces"
},
"changed": false
}
TASK [network.base.resource_manager : Grab the resource facts] *****************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:8
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
ok: [10.0.150.115] => {
"ansible_facts": {
"module_vars": {
"interfaces": [
{
"description": "this is interface0",
"enabled": true,
"name": "GigabitEthernet0/0/0/0"
},
{
"description": "this is interface1",
"enabled": true,
"name": "GigabitEthernet0/0/0/1"
}
]
}
},
"ansible_included_var_files": [
"/Users/amhatre/ansible-collections/playbooks/inventory/host_vars/10.0.150.115/interfaces.yaml"
],
"changed": false
}
TASK [network.base.resource_manager : Set default state] ***********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:13
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
TASK [network.base.resource_manager : Include tasks] ***************************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:18
included: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml for 10.0.150.115
TASK [network.base.resource_manager : Apply provided configuration] ************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/edit_resource.yaml:2
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: {{ module_vars[resource] }}
[WARNING]: Persistent connection logging is enabled for 10.0.150.115. This will
log ALL interactions and WILL NOT redact sensitive configuration like
passwords. USE WITH CAUTION!
changed: [10.0.150.115] => {
"after": [
{
"description": "this is interface0",
"enabled": true,
"name": "GigabitEthernet0/0/0/0"
},
{
"description": "this is interface1",
"enabled": true,
"name": "GigabitEthernet0/0/0/1"
}
],
"ansible_connection": "ansible.netcommon.network_cli",
"ansible_network_os": "cisco.iosxr.iosxr",
"before": [
{
"description": "this is interface0",
"enabled": true,
"name": "GigabitEthernet0/0/0/0"
},
{
"description": "this is interface1",
"enabled": false,
"name": "GigabitEthernet0/0/0/1"
}
],
"changed": true,
"commands": [
"interface GigabitEthernet0/0/0/1",
"no shutdown"
],
"invocation": {
"module_args": {
"config": [
{
"description": "this is interface0",
"duplex": null,
"enabled": true,
"mtu": null,
"name": "GigabitEthernet0/0/0/0",
"speed": null
},
{
"description": "this is interface1",
"duplex": null,
"enabled": true,
"mtu": null,
"name": "GigabitEthernet0/0/0/1",
"speed": null
}
],
"running_config": null,
"state": "overridden"
}
},
"resource_module_name": "cisco.iosxr.iosxr_interfaces"
}
TASK [network.base.resource_manager : Apply configuration] *********************
task path: /Users/amhatre/ansible-collections/collections/ansible_collections/network/base/roles/resource_manager/includes/configure.yaml:23
skipping: [10.0.150.115] => {
"changed": false,
"skip_reason": "Conditional result was False"
}
META: role_complete for 10.0.150.115
META: role_complete for 10.0.150.115
META: ran handlers
META: ran handlers
PLAY RECAP *********************************************************************
10.0.150.115 : ok=20 changed=1 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment