Closed allan-silverstein closed 2 years ago
I can confirm this. on ansible 2.9 with the legacy dell so6/10 roles I used this to save the config but since a update to ansible 2.12 and the new collections this is not working anymore.
sample playbook:
- hosts: switch
connection: network_cli
gather_facts: false
strategy: linear
tasks:
- name: fetch dellos10 config
dellos10_config:
backup: true
save: false
update: check
backup_options:
dir_path: /tmp/
filename: "{{ backup_filename }}"
when:
- ansible_network_os == "dellos10"
a sample debug output:
± time ansible-playbook -vvv -l swa31ber0.ber0.rosalux.org -D switch_dellos10_fetch_config.yml
ansible-playbook [core 2.12.1]
config file = /home/zerwes/git/ansible-spk8/ansible.cfg
configured module search path = ['/home/zerwes/git/ansible-spk8/library']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /home/zerwes/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
jinja version = 2.11.3
libyaml = True
Using /home/zerwes/git/ansible-spk8/ansible.cfg as config file
host_list declined parsing /home/zerwes/git/ansible-spk8/hosts as it did not pass its verify_file() method
script declined parsing /home/zerwes/git/ansible-spk8/hosts as it did not pass its verify_file() method
auto declined parsing /home/zerwes/git/ansible-spk8/hosts as it did not pass its verify_file() method
Parsed /home/zerwes/git/ansible-spk8/hosts inventory source with ini plugin
redirecting (type: modules) ansible.builtin.dellos10_config to dellemc.os10.os10_config
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: switch_dellos10_fetch_config.yml ************************************************************************************************************************************************************************
1 plays in switch_dellos10_fetch_config.yml
PLAY [switch] *****************************************************************************************************************************************************************************************************
META: ran handlers
TASK [fetch dellos10 config] **************************************************************************************************************************************************************************************
task path: /home/zerwes/git/ansible-spk8/switch_dellos10_fetch_config.yml:22
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: cliconf) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: action) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: action) ansible.builtin.dellos10 to dellemc.os10.os10
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku `"&& mkdir "` echo /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061 `" && echo ansible-tmp-1643813293.9834929-1446620-232234029997061="` echo /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.dellos10_config to dellemc.os10.os10_config
Using module file /home/zerwes/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/tmpx54mz0x9 TO /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061/AnsiballZ_os10_config.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061/ /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-1446616zsn4aaku/ansible-tmp-1643813293.9834929-1446620-232234029997061/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"__backup__": "! Version 10.5.2.3\n! Last configuration change at Feb 02 14:48:12 2022... _output containing config_",
"changed": false,
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/",
"filename": "swa31ber0.ber0.rosalux.org.cfg"
},
"before": null,
"config": null,
"lines": [],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "check"
}
},
"saved": false
}
META: ran handlers
META: ran handlers
PLAY RECAP ********************************************************************************************************************************************************************************************************
swa31ber0.ber0.rosalux.org : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
real 0m53.060s
user 0m9.415s
sys 0m1.138s
± ls /tmp/swa31ber0.ber0.rosalux.org.cfg*
ls: cannot access '/tmp/swa31ber0.ber0.rosalux.org.cfg*': No such file or directory
The expected cfg ist not saved to the file! Same issue with dellos6!
maybe related / duplicate of #102
as far as I can bisect this at a first try:
2.9
is OK :+1: and 2.10
is broken :-1:
# pip install "ansible>2.9,<2.10"
# ansible --version | head -1 ; pip show ansible | head -2
ansible 2.9.27
Name: ansible
Version: 2.9.27
# rm -rf /tmp/swa31ber0.ber0.rosalux.org*; ansible-playbook -vvv -l swa31ber0.ber0.rosalux.org -D switch_dellos10_fetch_config.yml ; ls -l /tmp/swa31ber0.ber0.rosalux.org*
ansible-playbook 2.9.27
config file = /root/ansible/ansible.cfg
configured module search path = ['/root/ansible/library']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
Using /root/ansible/ansible.cfg as config file
host_list declined parsing /root/ansible/hosts as it did not pass its verify_file() method
script declined parsing /root/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /root/ansible/hosts as it did not pass its verify_file() method
Parsed /root/ansible/hosts inventory source with ini plugin
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.
TASK [fetch config]
task path: /root/ansible/switch_dellos10_fetch_config.yml:21
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/network/dellos10/dellos10_config.py
Pipelining is enabled.
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-93527jdgg7eu `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903 `" && echo ansible-tmp-1643841585.3456714-9355-214195678964903="` echo /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903 `" ) && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/files/stat.py
Pipelining is enabled.
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/files/file.py
Pipelining is enabled.
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 && sleep 0'
<172.31.248.31> PUT /root/.ansible/tmp/ansible-local-93527jdgg7eu/tmpr1tagki8 TO /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903/source
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903/ /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903/source && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/files/copy.py
Pipelining is enabled.
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-93527jdgg7eu/ansible-tmp-1643841585.3456714-9355-214195678964903/ > /dev/null 2>&1 && sleep 0'
changed: [swa31ber0.ber0.rosalux.org] => {
"backup_path": "/tmp/swa31ber0.ber0.rosalux.org.cfg",
"changed": true,
"date": "2022-02-02",
"invocation": {
"module_args": {
"after": null,
"auth_pass": null,
"authorize": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/",
"filename": "swa31ber0.ber0.rosalux.org.cfg"
},
"before": null,
"config": null,
"host": null,
"lines": null,
"match": "line",
"parents": null,
"password": null,
"port": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"ssh_keyfile": null,
"timeout": null,
"update": "check",
"username": null
}
},
"saved": false,
"time": "22:39:45"
}
META: ran handlers
META: ran handlers
PLAY RECAP ********************************************************************************************************************************************************************************************************
swa31ber0.ber0.rosalux.org : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
-rw-r--r-- 1 root root 21105 Feb 2 23:39 /tmp/swa31ber0.ber0.rosalux.org.cfg
# pip uninstall ansible ansible-base ansible-core
# pip install "ansible>2.10,<2.11"
# ansible --version | head -1 ; pip show ansible | head -2
ansible 2.10.17
Name: ansible
Version: 2.10.7
# rm -rf /tmp/swa31ber0.ber0.rosalux.org*; ansible-playbook -vvv -l swa31ber0.ber0.rosalux.org -D switch_dellos10_fetch_config.yml ; ls -l /tmp/swa31ber0.ber0.rosalux.org*
ansible-playbook 2.10.17
config file = /root/ansible/ansible.cfg
configured module search path = ['/root/ansible/library']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
Using /root/ansible/ansible.cfg as config file
host_list declined parsing /root/ansible/hosts as it did not pass its verify_file() method
script declined parsing /root/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /root/ansible/hosts as it did not pass its verify_file() method
Parsed /root/ansible/hosts inventory source with ini plugin
redirecting (type: modules) ansible.builtin.dellos10_config to dellemc.os10.os10_config
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.
TASK [fetch config]
task path: /root/ansible/switch_dellos10_fetch_config.yml:21
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: cliconf) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: action) ansible.builtin.dellos10 to dellemc.os10.os10
redirecting (type: action) ansible.builtin.dellos10 to dellemc.os10.os10
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: root
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-9303sjujunne `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273 `" && echo ansible-tmp-1643840991.2404823-9306-403180865273="` echo /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.dellos10_config to dellemc.os10.os10_config
Using module file /usr/local/lib/python3.9/dist-packages/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<172.31.248.31> PUT /root/.ansible/tmp/ansible-local-9303sjujunne/tmphv2y50vw TO /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273/AnsiballZ_os10_config.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273/ /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-9303sjujunne/ansible-tmp-1643840991.2404823-9306-403180865273/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"__backup__": "! Version 10.5.2.3\n! Last configuration change at Feb 02 22:29:50 ...",
"changed": false,
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/",
"filename": "swa31ber0.ber0.rosalux.org.cfg"
},
"before": null,
"config": null,
"lines": null,
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "check"
}
},
"saved": false
"changed": false,
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/",
"filename": "swa31ber0.ber0.rosalux.org.cfg"
},
"before": null,
"config": null,
"lines": null,
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "check"
}
},
"saved": false
}
META: ran handlers
META: ran handlers
PLAY RECAP ********************************************************************************************************************************************************************************************************
swa31ber0.ber0.rosalux.org : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ls: cannot access '/tmp/swa31ber0.ber0.rosalux.org*': No such file or directory
"ansible==2.10.0" "ansible-base==2.10.1"
is the first broken version, so the reason should be findable via bisecting 2.9.27 and 2.10.0.
But what makes me suspicious:
Finally leaves me with no good feeling in relying on this collection (unfortunately I have to!) ...
just for the record in case it helps someone: my interim fix
--- a/switch.yml
+++ b/switch.yml
@@ -35,43 +35,51 @@
- name: "save config to {{ switch_cfg_backup_dir }}"
vars:
ansible_become: yes
dellos6_config:
backup: yes
save: no
update: check
backup_options:
dir_path: "{{ switch_cfg_backup_dir }}"
filename: "{{ backup_filename }}.orig"
when:
- ansible_network_os == "dellemc.os6.os6"
- not ansible_check_mode
tags: always
+ register: r6
- name: "save config to {{ switch_cfg_backup_dir }}"
dellos10_config:
backup: yes
save: no
update: check
backup_options:
dir_path: "{{ switch_cfg_backup_dir }}"
filename: "{{ backup_filename }}.orig"
when:
- ansible_network_os == "dellemc.os10.os10"
- not ansible_check_mode
tags: always
+ register: r10
+ - name: save cfg to file
+ local_action:
+ module: copy
+ content: "{{ r6['__backup__'] if ansible_network_os == 'dellemc.os6.os6' else r10['__backup__'] }}"
+ dest: "{{ switch_cfg_backup_dir }}/{{ backup_filename }}"
+ tags: always
@zerwes, i am checking on this, pls give me some time. will update once validated.
@zerwes, I have executed the playbook on both ansible versions (ansible [core 2.12.0] & ansible 2.9.26) and its working for me.
The Configuration changes are done and the configurations are saved in the specified file(junk.txt) on the ansible control system in the specified path(/tmp/bkups)
Find the sample playbook which i have executed:
---
- name: Configuration Retrieval Testing
hosts: datacenter
gather_facts: false
connection: network_cli
collections:
- dellemc.os10
tasks:
- name: Retrieve Configuration
os10_config:
backup: true
backup_options:
dir_path: /tmp/bkups
filename: junk.txt
lines:
- ip host junk1 1.1.1.1
- ip host junk2 2.2.2.2
Find the config file (junk.txt) on the ansible control system (/tmp/bkups) after executing the playbook: root@UBUNTU18-VM-38-024:/# ls /tmp/bkups/junk.txt /tmp/bkups/junk.txt root@UBUNTU18-VM-38-024:/#
ansible 2.9.26: Find the execution log for reference
root@UBUNTU18-VM-38-024:~/os10_collections# ansible-playbook -i inventory.yaml config_bkups2.yaml -vvv
ansible-playbook 2.9.26
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
Parsed /root/os10_collections/inventory.yaml inventory source with ini plugin
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.
PLAYBOOK: config_bkups2.yaml ****************************************************************************************************************************************************************************************************
1 plays in config_bkups2.yaml
PLAY [Configuration Retrieval Teseting] *****************************************************************************************************************************************************************************************
META: ran handlers
TASK [Retrieve Configuration] ***************************************************************************************************************************************************************************************************
task path: /root/os10_collections/config_bkups2.yaml:10
Friday 04 February 2022 12:08:34 +0530 (0:00:01.265) 0:00:01.265 *******
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-14034ckJOjI `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839 `" && echo ansible-tmp-1643956719.56-14041-173280246946839="` echo /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-14034ckJOjI/tmpAtz8_r TO /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839/ /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956719.56-14041-173280246946839/ > /dev/null 2>&1 && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-14034ckJOjI `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022 `" && echo ansible-tmp-1643956728.18-14041-276747058141022="` echo /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022 `" ) && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/files/stat.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-14034ckJOjI/tmpfFeg4H TO /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_stat.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/ /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_stat.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_stat.py && sleep 0'
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-14034ckJOjI/tmpC8Ce1h TO /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/source
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/ /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/source && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/files/copy.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-14034ckJOjI/tmpbHKd_J TO /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_copy.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/ /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_copy.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/AnsiballZ_copy.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-14034ckJOjI/ansible-tmp-1643956728.18-14041-276747058141022/ > /dev/null 2>&1 && sleep 0'
changed: [leaf] => {
"backup_path": "/tmp/bkups/junk.txt",
"changed": true,
"commands": [
"ip host junk2 2.2.2.2",
"commit"
],
"date": "2022-02-04",
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/bkups",
"filename": "junk.txt"
},
"before": null,
"config": null,
"lines": [
"ip host junk1 1.1.1.1",
"ip host junk2 2.2.2.2"
],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "merge"
}
},
"saved": false,
"time": "06:38:51",
"updates": [
"ip host junk2 2.2.2.2",
"commit"
]
}
META: ran handlers
META: ran handlers
PLAY RECAP **********************************************************************************************************************************************************************************************************************
leaf : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Friday 04 February 2022 12:08:51 +0530 (0:00:16.468) 0:00:17.733 *******
===============================================================================
Retrieve Configuration -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 16.47s
/root/os10_collections/config_bkups2.yaml:10 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
root@UBUNTU18-VM-38-024:~/os10_collections#
ansible [core 2.12.0]: Find the execution log for reference:
root@Ubuntu20-vm-038-037:~/os10-ansible# ansible-playbook -i inventory.yaml -k config_bkups2.yaml -vvv
ansible-playbook [core 2.12.0]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True
No config file found; using defaults
SSH password:
host_list declined parsing /root/os10-ansible/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/os10-ansible/inventory.yaml as it did not pass its verify_file() method
Parsed /root/os10-ansible/inventory.yaml inventory source with ini plugin
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
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: config_bkups2.yaml ****************************************************************************************************************************************************************************************************
1 plays in config_bkups2.yaml
PLAY [Configuration Retrieval Teseting] *****************************************************************************************************************************************************************************************
META: ran handlers
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
[WARNING]: Collection ansible.netcommon does not support Ansible version 2.12.0
TASK [Retrieve Configuration] ***************************************************************************************************************************************************************************************************
task path: /root/os10-ansible/config_bkups2.yaml:9
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<100.104.40.187> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.187> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093 `" && echo ansible-tmp-1643960298.2389295-1605331-233962922413093="` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.187> PUT /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/tmpfh9kpyaa TO /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093/AnsiballZ_os10_config.py
<100.104.40.187> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093/ /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.187> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.187> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960298.2389295-1605331-233962922413093/ > /dev/null 2>&1 && sleep 0'
<100.104.40.187> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111 `" && echo ansible-tmp-1643960303.88884-1605331-142546273985111="` echo /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111 `" ) && sleep 0'
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/stat.py
<100.104.40.187> PUT /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/tmpmn9rzeaf TO /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_stat.py
<100.104.40.187> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/ /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_stat.py && sleep 0'
<100.104.40.187> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_stat.py && sleep 0'
<100.104.40.187> PUT /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/tmp14i5t96y TO /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/source
<100.104.40.187> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/ /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/source && sleep 0'
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/copy.py
<100.104.40.187> PUT /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/tmpx1xif5d7 TO /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_copy.py
<100.104.40.187> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/ /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_copy.py && sleep 0'
<100.104.40.187> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/AnsiballZ_copy.py && sleep 0'
<100.104.40.187> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-1605320s3hoy6ii/ansible-tmp-1643960303.88884-1605331-142546273985111/ > /dev/null 2>&1 && sleep 0'
changed: [spine] => {
"backup_path": "/tmp/bkups/junk.txt",
"changed": true,
"commands": [
"ip host junk2 2.2.2.2",
"commit"
],
"date": "2022-02-04",
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/bkups",
"filename": "junk.txt"
},
"before": null,
"config": null,
"lines": [
"ip host junk1 1.1.1.1",
"ip host junk2 2.2.2.2"
],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "merge"
}
},
"saved": false,
"time": "07:38:25",
"updates": [
"ip host junk2 2.2.2.2",
"commit"
]
}
META: ran handlers
META: ran handlers
PLAY RECAP **********************************************************************************************************************************************************************************************************************
spine : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
root@Ubuntu20-vm-038-037:~/os10-ansible#
root@Ubuntu20-vm-038-037:/# ls /tmp/bkups/junk.txt
/tmp/bkups/junk.txt
root@Ubuntu20-vm-038-037:/#
For me it does not work on ansible 2.12.1. Looks like you tested on ansible-core 2.12.0. Assuming you do retest on version 2.12.1 and it works for you, where do we go from here? I'm running ansible in a python virtual environment and installed ansible-core using pip install ansible-core. Here are my packages... ` pip list Package Version
ansible-core 2.12.1 bcrypt 3.2.0 cffi 1.15.0 cryptography 36.0.1 Jinja2 3.0.3 MarkupSafe 2.0.1 packaging 21.3 paramiko 2.9.2 pip 21.2.4 pycparser 2.21 PyNaCl 1.5.0 pyparsing 3.0.7 PyYAML 6.0 resolvelib 0.5.5 setuptools 58.1.0 six 1.16.0 `
@allan-silverstein, yes mine also VM machine with Ubuntu. I have tested with ansible version 2.12.0 and ansible 2.9.26 and for both the version its working fine for me.
root@Ubuntu20-vm-038-037:~/os10-ansible# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
root@Ubuntu20-vm-038-037:~/os10-ansible#
root@Ubuntu20-vm-038-037:~/os10-ansible# ansible --version
ansible [core 2.12.0]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True
root@Ubuntu20-vm-038-037:~/os10-ansible#
@allan-silverstein, i will try to execute on ansible version 2.12.1 also. meanwhile please can you share your playbook which you are testing.
I included the playbook in the original post (see above under steps to reproduce)
Hello @prasadapr. Thank you for looking into this. For me it is not working neither. I propose the usage of the updated playbook for us all in order to ensure the presence of the desired backup file from the playbook itself:
---
- name: Configuration Retrieval Teseting
connection: ansible.netcommon.network_cli
gather_facts: false
hosts: all
collections:
- dellemc.os10
vars:
ansible_command_timeout: 120
dir_path: /tmp/bkups
filename: junk.txt
fp2b_filename: "{{ [dir_path, filename,] | path_join }}"
tasks:
- name: ensure old backup file is deleted
file:
path: "{{ fp2b_filename }}"
state: absent
- name: Retrieve Configuration
dellemc.os10.os10_config:
backup: true
backup_options:
dir_path: "{{ dir_path }}"
filename: "{{ filename }}"
lines:
- ip host junk1 1.1.1.1
- no ip host junk1
save: yes
- name: check if the backup file exists
stat:
path: "{{ fp2b_filename }}"
register: _statr
- name: assert the backup file exists
assert:
that: _statr.stat.exists
fail_msg: "gosh darn it! {{ fp2b_filename }} not found!"
success_msg: "yeah! {{ fp2b_filename }} is there!"
...
And the result is for me:
$ ansible-playbook -i hosts -l swa31ber0.ber0.rosalux.org -D dellos10_fetch_config.yml
PLAY [Configuration Retrieval Teseting] ***************************************************************************************************************************************************************************
TASK [ensure old backup file is deleted] **************************************************************************************************************************************************************************
ok: [swa31ber0.ber0.rosalux.org]
TASK [Retrieve Configuration] *************************************************************************************************************************************************************************************
changed: [swa31ber0.ber0.rosalux.org]
TASK [check if the backup file exists] ****************************************************************************************************************************************************************************
ok: [swa31ber0.ber0.rosalux.org]
TASK [assert the backup file exists] ******************************************************************************************************************************************************************************
fatal: [swa31ber0.ber0.rosalux.org]: FAILED! => {
"assertion": "_statr.stat.exists",
"changed": false,
"evaluated_to": false,
"msg": "gosh darn it! /tmp/bkups/junk.txt not found!"
}
PLAY RECAP ********************************************************************************************************************************************************************************************************
swa31ber0.ber0.rosalux.org : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Are you testing against a real device or a gns3 simulation?
If I find the time, I will try to setup a molecule test with the combination of different OS, ansible and python versions. Greetings to all.
@allan-silverstein, as you mentioned i have tested on ansible 2.12.1 and its working fine for me. I have tested with your original playbook (see above under steps to reproduce). but your playbook is not working for me also (means it's not creating the backup directory).
we have to declare collections
and replace dellemc.os10.os10_config with os10_config
in your playbook.
collections:
- dellemc.os10
tasks:
- name: Retrieve Configuration
os10_config:
Please execute my below playbook in your ansible server with -vvv
option to see the complete log.
EX: ansible-playbook -i inventory.yaml config_bkups2.yaml -vvv
---
- name: Configuration Retrieval Testing
hosts: datacenter
gather_facts: false
connection: network_cli
collections:
- dellemc.os10
tasks:
- name: Retrieve Configuration
os10_config:
backup: true
backup_options:
dir_path: /tmp/bkups
filename: junk.txt
lines:
- ip host junk1 1.1.1.1
- ip host junk2 2.2.2.2
hello @prasadapr
What about using the playbook above in order to ensure the presence of the desired backup file from the playbook itself?
Even using -vvv
the error is not directly viewable from the output.
One difference I realized in the output:
I get the "__backup__"
key in the return of the os10_config
, but I can not see this in your output ... any idea where this difference comes from?
@zerwes, the presence of the desired backup file is not mandatory. without providing the filename
and dir_path
also we can write the playbook. we can write the playbook in multiple ways.
And still i am not getting why it's not working for you and reason for getting the error "__backup__" key in the return of the os10_config.
Possible can you provide output log of the ansible-playbook command with -vvv option for better understanding of the error.
@zerwes, Please find the playbook without filename and dir_path.
The backup file will be created in the current directory and file name start with hosts name
.
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections# cat config_bkups2_Issue-113.yaml
---
- name: Configuration Retrieval Teseting
hosts: leaf
gather_facts: false
connection: network_cli
collections:
- dellemc.os10
tasks:
- name: Retrieve Configuration
os10_config:
backup: true
backup_options:
# dir_path: /tmp/bkups
# filename: junk.txt
lines:
- ip host junk1 1.1.1.1
- ip host junk2 2.2.2.2
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections#
Playbook execution and log: ansible-playbook -i inventory.yaml config_bkups2_Issue-113.yaml -vvv
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections# ansible-playbook -i inventory.yaml config_bkups2_Issue-113.yaml -vvv
ansible-playbook [core 2.12.1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /root/prasada/os10-ansible-collections/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/prasada/os10-ansible-collections/inventory.yaml as it did not pass its verify_file() method
Parsed /root/prasada/os10-ansible-collections/inventory.yaml inventory source with ini plugin
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
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: config_bkups2_Issue-113.yaml ******************************************************************************************************************************************************
1 plays in config_bkups2_Issue-113.yaml
PLAY [Configuration Retrieval Teseting] *****************************************************************************************************************************************************
META: ran handlers
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
TASK [Retrieve Configuration] ***************************************************************************************************************************************************************
task path: /root/prasada/os10-ansible-collections/config_bkups2_Issue-113.yaml:9
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-678913rlwjs8pv `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243 `" && echo ansible-tmp-1644211836.727082-678919-64874686197243="` echo /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-678913rlwjs8pv/tmpvvg5krxo TO /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243/ /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-678913rlwjs8pv/ansible-tmp-1644211836.727082-678919-64874686197243/ > /dev/null 2>&1 && sleep 0'
changed: [leaf] => {
"backup_path": "/root/prasada/os10-ansible-collections/backup/leaf_config.2022-02-07@05:30:44",
"changed": true,
"commands": [
"ip host junk1 1.1.1.1",
"ip host junk2 2.2.2.2",
"commit"
],
"date": "2022-02-07",
"filename": "leaf_config.2022-02-07@05:30:44",
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": null,
"before": null,
"config": null,
"lines": [
"ip host junk1 1.1.1.1",
"ip host junk2 2.2.2.2"
],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": false,
"src": null,
"update": "merge"
}
},
"saved": false,
"shortname": "/root/prasada/os10-ansible-collections/backup/leaf_config",
"time": "05:30:44",
"updates": [
"ip host junk1 1.1.1.1",
"ip host junk2 2.2.2.2",
"commit"
]
}
META: ran handlers
META: ran handlers
PLAY RECAP **********************************************************************************************************************************************************************************
leaf : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections#
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections# ls backup/leaf_config.2022-02-07@05\:30\:44
backup/leaf_config.2022-02-07@05:30:44
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections#
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections# ansible --version
ansible [core 2.12.1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True
root@ubuntu20-vm-035-113:~/prasada/os10-ansible-collections#
root@ubuntu20-vm-035-113:~# ansible-galaxy collection list dellemc.os10
# /root/.ansible/collections/ansible_collections
Collection Version
------------ -------
dellemc.os10 1.1.1
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
------------ -------
dellemc.os10 1.1.1
root@ubuntu20-vm-035-113:~#
https://github.com/ansible-collections/dellemc.os10/blob/master/plugins/modules/os10_config.py#L287 strange that this result key is not displayed in @prasadapr results ...
Hello @prasadapr
Of course I can post the verbose output again ()
~/dellemc.os10-issue113 $ cat dellos10_fetch_config.yml
---
- name: Configuration Retrieval Teseting
connection: ansible.netcommon.network_cli
gather_facts: false
hosts: all
collections:
- dellemc.os10
vars:
ansible_command_timeout: 120
dir_path: /tmp/bkups
filename: junk.txt
fp2b_filename: "{{ [dir_path, filename,] | path_join }}"
tasks:
- name: ensure old backup file is deleted
file:
path: "{{ fp2b_filename }}"
state: absent
- name: Retrieve Configuration
dellemc.os10.os10_config:
backup: true
backup_options:
dir_path: "{{ dir_path }}"
filename: "{{ filename }}"
lines:
- ip host junk1 1.1.1.1
- no ip host junk1
save: yes
- name: check if the backup file exists
stat:
path: "{{ fp2b_filename }}"
register: _statr
- name: assert the backup file exists
assert:
that: _statr.stat.exists
fail_msg: "gosh darn it! {{ fp2b_filename }} not found!"
success_msg: "yeah! {{ fp2b_filename }} is there!"
...
output:
ansible-playbook [core 2.12.2]
config file = None
configured module search path = ['/home/zerwes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /home/zerwes/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
jinja version = 2.11.3
libyaml = True
No config file found; using defaults
host_list declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method
script declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method
auto declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method
Parsed /home/zerwes/dellemc.os10-issue113/hosts inventory source with ini plugin
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
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: dellos10_fetch_config.yml *******************************************************************************************************************************************************************************
1 plays in dellos10_fetch_config.yml
PLAY [Configuration Retrieval Teseting] ***************************************************************************************************************************************************************************
META: ran handlers
TASK [ensure old backup file is deleted] **************************************************************************************************************************************************************************
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:14
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9 `"&& mkdir "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260 `" && echo ansible-tmp-1644216652.8898544-629268-96687824616260="` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260 `" ) && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/file.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/tmp7hjatxzi TO /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260/AnsiballZ_file.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260/ /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260/AnsiballZ_file.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260/AnsiballZ_file.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216652.8898544-629268-96687824616260/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"changed": false,
"invocation": {
"module_args": {
"_diff_peek": null,
"_original_basename": null,
"access_time": null,
"access_time_format": "%Y%m%d%H%M.%S",
"attributes": null,
"follow": true,
"force": false,
"group": null,
"mode": null,
"modification_time": null,
"modification_time_format": "%Y%m%d%H%M.%S",
"owner": null,
"path": "/tmp/bkups/junk.txt",
"recurse": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "absent",
"unsafe_writes": false
}
},
"path": "/tmp/bkups/junk.txt",
"state": "absent"
}
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
TASK [Retrieve Configuration] *************************************************************************************************************************************************************************************
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:18
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9 `"&& mkdir "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203 `" && echo ansible-tmp-1644216665.7545483-629296-200460643600203="` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203 `" ) && sleep 0'
Using module file /home/zerwes/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/tmpoiyfj2l3 TO /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203/AnsiballZ_os10_config.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203/ /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216665.7545483-629296-200460643600203/ > /dev/null 2>&1 && sleep 0'
changed: [swa31ber0.ber0.rosalux.org] => {
"__backup__": "! Version 10.5.2.3\n! Last configuration change at Feb 07 06:51:04 2022\n ....",
"changed": true,
"commands": [
"ip host junk1 1.1.1.1",
"no ip host junk1",
"commit"
],
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/bkups",
"filename": "junk.txt"
},
"before": null,
"config": null,
"lines": [
"ip host junk1 1.1.1.1",
"no ip host junk1"
],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": true,
"src": null,
"update": "merge"
}
},
"saved": true,
"updates": [
"ip host junk1 1.1.1.1",
"no ip host junk1",
"commit"
]
}
TASK [check if the backup file exists] ****************************************************************************************************************************************************************************
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:28
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9 `"&& mkdir "` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967 `" && echo ansible-tmp-1644216709.9096904-629432-8274571957967="` echo /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967 `" ) && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/stat.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/tmpcd7vfqnk TO /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967/AnsiballZ_stat.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967/ /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967/AnsiballZ_stat.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967/AnsiballZ_stat.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-6292641umxg7x9/ansible-tmp-1644216709.9096904-629432-8274571957967/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"changed": false,
"invocation": {
"module_args": {
"checksum_algorithm": "sha1",
"follow": false,
"get_attributes": true,
"get_checksum": true,
"get_md5": false,
"get_mime": true,
"path": "/tmp/bkups/junk.txt"
}
},
"stat": {
"exists": false
}
}
TASK [assert the backup file exists] ******************************************************************************************************************************************************************************
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:32
fatal: [swa31ber0.ber0.rosalux.org]: FAILED! => {
"assertion": "_statr.stat.exists",
"changed": false,
"evaluated_to": false,
"msg": "gosh darn it! /tmp/bkups/junk.txt not found!"
}
PLAY RECAP ********************************************************************************************************************************************************************************************************
swa31ber0.ber0.rosalux.org : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
we have to declare
collections
and replacedellemc.os10.os10_config with os10_config
in your playbook. @prasadapr :+1: this makes the difference!- name: Retrieve Configuration - dellemc.os10.os10_config: + os10_config: backup: true
output:
~/dellemc.os10-issue113 12s $ ansible-playbook -vvv -i hosts dellos10_fetch_config.yml ansible-playbook [core 2.12.2] config file = None configured module search path = ['/home/zerwes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible ansible collection location = /home/zerwes/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] jinja version = 2.11.3 libyaml = True No config file found; using defaults host_list declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method script declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method auto declined parsing /home/zerwes/dellemc.os10-issue113/hosts as it did not pass its verify_file() method Parsed /home/zerwes/dellemc.os10-issue113/hosts inventory source with ini plugin redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10 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: dellos10_fetch_config.yml *** 1 plays in dellos10_fetch_config.yml
PLAY [Configuration Retrieval Teseting] *** META: ran handlers
TASK [ensure old backup file is deleted] **
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:14
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4
"&& mkdir "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699
" && echo ansible-tmp-1644217003.9609456-630149-258045354600699="echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699
" ) && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/file.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/tmp8y42vg1l TO /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699/AnsiballZ_file.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699/ /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699/AnsiballZ_file.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699/AnsiballZ_file.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217003.9609456-630149-258045354600699/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"changed": false,
"invocation": {
"module_args": {
"_diff_peek": null,
"_original_basename": null,
"access_time": null,
"access_time_format": "%Y%m%d%H%M.%S",
"attributes": null,
"follow": true,
"force": false,
"group": null,
"mode": null,
"modification_time": null,
"modification_time_format": "%Y%m%d%H%M.%S",
"owner": null,
"path": "/tmp/bkups/junk.txt",
"recurse": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "absent",
"unsafe_writes": false
}
},
"path": "/tmp/bkups/junk.txt",
"state": "absent"
}
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
TASK [Retrieve Configuration] *****
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:18
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4
"&& mkdir "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534
" && echo ansible-tmp-1644217016.8860643-630177-161697297673534="echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534
" ) && sleep 0'
Using module file /home/zerwes/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/tmp5eba48hp TO /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534/AnsiballZ_os10_config.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534/ /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534/AnsiballZ_os10_config.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217016.8860643-630177-161697297673534/ > /dev/null 2>&1 && sleep 0'
changed: [swa31ber0.ber0.rosalux.org] => {
"backup_path": "/tmp/bkups/junk.txt",
"changed": true,
"commands": [
"ip host junk1 1.1.1.1",
"no ip host junk1",
"commit"
],
"date": "2022-02-07",
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/tmp/bkups",
"filename": "junk.txt"
},
"before": null,
"config": null,
"lines": [
"ip host junk1 1.1.1.1",
"no ip host junk1"
],
"match": "line",
"parents": null,
"provider": null,
"replace": "line",
"save": true,
"src": null,
"update": "merge"
}
},
"saved": true,
"time": "07:57:40",
"updates": [
"ip host junk1 1.1.1.1",
"no ip host junk1",
"commit"
]
}
TASK [check if the backup file exists] ****
task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:29
<172.31.248.31> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.248.31> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4
"&& mkdir "echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842
" && echo ansible-tmp-1644217060.7911253-630308-168548399412842="echo /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842
" ) && sleep 0'
Using module file /usr/local/lib/python3.9/dist-packages/ansible/modules/stat.py
<172.31.248.31> PUT /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/tmpya9utq02 TO /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842/AnsiballZ_stat.py
<172.31.248.31> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842/ /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842/AnsiballZ_stat.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842/AnsiballZ_stat.py && sleep 0'
<172.31.248.31> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-630145b0_45ro4/ansible-tmp-1644217060.7911253-630308-168548399412842/ > /dev/null 2>&1 && sleep 0'
ok: [swa31ber0.ber0.rosalux.org] => {
"changed": false,
"invocation": {
"module_args": {
"checksum_algorithm": "sha1",
"follow": false,
"get_attributes": true,
"get_checksum": true,
"get_md5": false,
"get_mime": true,
"path": "/tmp/bkups/junk.txt"
}
},
"stat": {
"atime": 1644217060.3921354,
"attr_flags": "e",
"attributes": [
"extents"
],
"block_size": 4096,
"blocks": 48,
"charset": "us-ascii",
"checksum": "06f1bedff2a6535552d9e7ee2bcbea3fca6529d3",
"ctime": 1644217060.3921354,
"dev": 65025,
"device_type": 0,
"executable": false,
"exists": true,
"gid": 1000,
"gr_name": "zerwes",
"inode": 14287747,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mimetype": "text/plain",
"mode": "0644",
"mtime": 1644217060.3921354,
"nlink": 1,
"path": "/tmp/bkups/junk.txt",
"pw_name": "zerwes",
"readable": true,
"rgrp": true,
"roth": true,
"rusr": true,
"size": 21078,
"uid": 1000,
"version": "1983889355",
"wgrp": false,
"woth": false,
"writeable": true,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
}
}
TASK [assert the backup file exists] ** task path: /home/zerwes/dellemc.os10-issue113/dellos10_fetch_config.yml:33 ok: [swa31ber0.ber0.rosalux.org] => { "changed": false, "msg": "yeah! /tmp/bkups/junk.txt is there!" } META: ran handlers META: ran handlers
PLAY RECAP **** swa31ber0.ber0.rosalux.org : ok=4 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
@zerwes, now with the collections and os10_config its working fine right. Thank you for the verification and update.
Sure @zerwes, will look in to the Issue#114
and will provide the observations and required action will be taken care.
@zerwes, if you are OK, shall we close this issue#113.
@prasadapr yes, this can be closed; thank you for the clarification.
Thanks @zerwes for the confirmation, so i am closing this issue.
Thank you @prasadapr , this now works for me also.
Thanks @allan-silverstein for the update.
SUMMARY
Setting the backup option in the os10_config module does not work. The configuration file is not written to the playbook root directory or any other directory if the backup_options are specfied.
ISSUE TYPE
COMPONENT NAME
os10_config
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
This returned nothing
OS / ENVIRONMENT
fra02-wls01-msw01# show version Dell EMC Networking OS10 Enterprise Copyright (c) 1999-2020 by Dell Inc. All Rights Reserved. OS Version: 10.5.2.2 Build Version: 10.5.2.2.258 Build Time: 2020-12-12T02:56:02+0000 System Type: S4148T-ON Architecture: x86_64 Up Time: 17 weeks 1 day 17:15:01 fra02-wls01-msw01#
STEPS TO REPRODUCE
Running a simple playbook with the following command line:
ansible-playbook -vvv -i inventory -k config_bkups2.yaml
EXPECTED RESULTS
Configuration changes should be made and the the configuration should be saved to a file on the control system (The system that is executing the playbook).
ACTUAL RESULTS
The configuration of the device is changed but the configuration is never saved to the control system.