ansible-collections / dellemc.os9

GNU General Public License v3.0
8 stars 12 forks source link

os9_config backup options does not work #28

Open mpsOxygen opened 2 years ago

mpsOxygen commented 2 years ago
SUMMARY

I am trying to backup the configuration of an Dell S4048 switch running OS 9 using the example from the documentation and it just does not work. Here is the playbook:


ISSUE TYPE
COMPONENT NAME

dellemc.os9.os9_config

ANSIBLE VERSION
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/razvan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)]
COLLECTION VERSION
$ansible-galaxy collection list community.general
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')
CONFIGURATION
$ ansible-config dump --only-changed
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 15
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = /usr/bin/python3
OS / ENVIRONMENT

test#sh ver Dell EMC Real Time Operating System Software Dell EMC Operating System Version: 2.0 Dell EMC Application Software Version: 9.14(0.1) Copyright (c) 1999-2018 by Dell Inc. All Rights Reserved. Build Time: Fri Aug 10 23:10:14 2018 Build Path: /build/build02/SW/SRC Dell EMC Networking OS uptime is 15 week(s), 4 day(s), 0 hour(s), 25 minute(s)

System image file is "system://A"

System Type: S4048T-ON Control Processor: Intel Rangeley with 3 Gbytes (3177148416 bytes) of memory, core(s) 2.

8G bytes of boot flash memory.

1 48x10G, 6x40G TE/FO G (S4048T-ON) 48 Ten GigabitEthernet/IEEE 802.3 interface(s) 6 Forty GigabitEthernet/IEEE 802.3 interface(s)

STEPS TO REPRODUCE
---
- name: backup dell switch
  hosts: sw2
  connection: ansible.netcommon.network_cli
  gather_facts: yes
  ignore_errors: yes

  tasks:

  - name: 'check if switch is online'
    local_action: command ping -w 1 {{ ansible_host }}
    register: ping_result

  - name: Backup current switch config (dellos9)
    dellemc.os9.os9_config:
      save: yes
      lines: ['hostname {{ inventory_hostname }}']
      backup: yes
      backup_options:
        filename: "{{ inventory_hostname }}.cfg"
        dir_path: /home/name/Documents/ansible/backup
    when: (ansible_network_os == 'dellemc.os9.os9' and ping_result.rc == 0)
EXPECTED RESULTS

I expected to have a file named sw2.cfg appear in the backup directory.

ACTUAL RESULTS

Nothing happens, it just changes the switch hostname and that's it.

$ ansible-playbook sw_dell_backup.yml -vvvv
ansible-playbook 2.9.27
  config file = /home/name/Documents/ansible/ansible.cfg
  configured module search path = ['/home/name/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)]
Using /home/name/Documents/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/name/Documents/ansible/inventory/inventory.ini as it did not pass its verify_file() method
script declined parsing /home/name/Documents/ansible/inventory/inventory.ini as it did not pass its verify_file() method
auto declined parsing /home/name/Documents/ansible/inventory/inventory.ini as it did not pass its verify_file() method
yaml declined parsing /home/name/Documents/ansible/inventory/inventory.ini as it did not pass its verify_file() method
Parsed /home/name/Documents/ansible/inventory/inventory.ini inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3.10/site-packages/ansible/plugins/callback/default.py
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: sw_dell_backup.yml >
 ------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Positional arguments: sw_dell_backup.yml
verbosity: 4
remote_user: root
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/name/Documents/ansible/inventory/inventory.ini',)
forks: 15
1 plays in sw_dell_backup.yml
 ___________________________
< PLAY [backup dell switch] >
 ---------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

 ________________________
< TASK [Gathering Facts] >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /home/name/Documents/ansible/sw_dell_backup.yml:2
<10.1.1.1> attempting to start connection
<10.1.1.1> using connection plugin ansible.netcommon.network_cli
<10.1.1.1> local domain socket does not exist, starting it
<10.1.1.1> control socket path is /home/name/.ansible/pc/f423b6889e
<10.1.1.1> local domain socket listeners started successfully
<10.1.1.1> loaded cliconf plugin ansible_collections.dellemc.os9.plugins.cliconf.os9 from path /home/name/.ansible/collections/ansible_collections/dellemc/os9/plugins/cliconf/os9.py for network_os dellemc.os9.os9
<10.1.1.1> 
<10.1.1.1> local domain socket path is /home/name/.ansible/pc/f423b6889e
<10.1.1.1> ESTABLISH LOCAL CONNECTION FOR USER: name
<10.1.1.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd `"&& mkdir "` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547 `" && echo ansible-tmp-1647867124.661214-20793-91891913939547="` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547 `" ) && sleep 0'
<sw2> Attempting python interpreter discovery
<10.1.1.1> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<10.1.1.1> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
Using module file /usr/lib/python3.10/site-packages/ansible/modules/system/setup.py
<10.1.1.1> PUT /home/name/.ansible/tmp/ansible-local-20784hodup7yd/tmpqv9afgi5 TO /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547/AnsiballZ_setup.py
<10.1.1.1> EXEC /bin/sh -c 'chmod u+x /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547/ /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547/AnsiballZ_setup.py && sleep 0'
<10.1.1.1> EXEC /bin/sh -c '/usr/bin/python /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547/AnsiballZ_setup.py && sleep 0'
<10.1.1.1> EXEC /bin/sh -c 'rm -f -r /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867124.661214-20793-91891913939547/ > /dev/null 2>&1 && sleep 0'
ok: [sw2]
META: ran handlers
 __________________________________
< TASK [check if switch is online] >
 ----------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /home/name/Documents/ansible/sw_dell_backup.yml:10
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: name
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo /tmp/ansible-tmp-1647867127.195107-20913-124010255271215 `" && echo ansible-tmp-1647867127.195107-20913-124010255271215="` echo /tmp/ansible-tmp-1647867127.195107-20913-124010255271215 `" ) && sleep 0'
Using module file /usr/lib/python3.10/site-packages/ansible/modules/commands/command.py
<localhost> PUT /home/name/.ansible/tmp/ansible-local-20784hodup7yd/tmpcxb08h1i TO /tmp/ansible-tmp-1647867127.195107-20913-124010255271215/AnsiballZ_command.py
<localhost> EXEC /bin/sh -c 'chmod u+x /tmp/ansible-tmp-1647867127.195107-20913-124010255271215/ /tmp/ansible-tmp-1647867127.195107-20913-124010255271215/AnsiballZ_command.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /tmp/ansible-tmp-1647867127.195107-20913-124010255271215/AnsiballZ_command.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1647867127.195107-20913-124010255271215/ > /dev/null 2>&1 && sleep 0'
changed: [sw2 -> localhost] => {
    "changed": true,
    "cmd": [
        "ping",
        "-w",
        "1",
        "10.1.1.1"
    ],
    "delta": "0:00:01.002731",
    "end": "2022-03-21 14:52:08.451348",
    "invocation": {
        "module_args": {
            "_raw_params": "ping -w 1 10.1.1.1",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2022-03-21 14:52:07.448617",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data.\n64 bytes from 10.1.1.1: icmp_seq=1 ttl=253 time=6.71 ms\n\n--- 10.1.1.1 ping statistics ---\n1 packets transmitted, 1 received, 0% packet loss, time 0ms\nrtt min/avg/max/mdev = 6.714/6.714/6.714/0.000 ms",
    "stdout_lines": [
        "PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data.",
        "64 bytes from 10.1.1.1: icmp_seq=1 ttl=253 time=6.71 ms",
        "",
        "--- 10.1.1.1 ping statistics ---",
        "1 packets transmitted, 1 received, 0% packet loss, time 0ms",
        "rtt min/avg/max/mdev = 6.714/6.714/6.714/0.000 ms"
    ]
}
 _______________________________________________
< TASK [Backup current switch config (dellos9)] >
 -----------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /home/name/Documents/ansible/sw_dell_backup.yml:14
<10.1.1.1> attempting to start connection
<10.1.1.1> using connection plugin ansible.netcommon.network_cli
<10.1.1.1> found existing local domain socket, using it!
<10.1.1.1> updating play_context for connection
<10.1.1.1> 
<10.1.1.1> local domain socket path is /home/name/.ansible/pc/f423b6889e
<10.1.1.1> ESTABLISH LOCAL CONNECTION FOR USER: name
<10.1.1.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd `"&& mkdir "` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838 `" && echo ansible-tmp-1647867128.867969-20930-13926185487838="` echo /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838 `" ) && sleep 0'
Using module file /home/name/.ansible/collections/ansible_collections/dellemc/os9/plugins/modules/os9_config.py
<10.1.1.1> PUT /home/name/.ansible/tmp/ansible-local-20784hodup7yd/tmp5gke792x TO /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838/AnsiballZ_os9_config.py
<10.1.1.1> EXEC /bin/sh -c 'chmod u+x /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838/ /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838/AnsiballZ_os9_config.py && sleep 0'
<10.1.1.1> EXEC /bin/sh -c '/usr/bin/python /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838/AnsiballZ_os9_config.py && sleep 0'
<10.1.1.1> EXEC /bin/sh -c 'rm -f -r /home/name/.ansible/tmp/ansible-local-20784hodup7yd/ansible-tmp-1647867128.867969-20930-13926185487838/ > /dev/null 2>&1 && sleep 0'
changed: [sw2] => {
    "__backup__": "Current Configuration ...\n! Version 9.14(0.1)\n! Last configuration change at Mon Mar 21 14:39:11 2022 by admin\n! Startup-config last updated at Mon Mar 21 14:51:45 2022 by admin\n!\nboot system stack-unit 1 primary system://A\nboot system stack-unit 1 secondary system://B\n!\nlogging coredump stack-unit  1 \nlogging coredump stack-unit  2 \nlogging coredump stack-unit  3 \nlogging coredump stack-unit  4 \nlogging coredump stack-unit  5 \nlogging coredump stack-unit  6 \n!\nhostname sw2\n!\nprotocol lldp \n!\nredundancy auto-synchronize full\n!\nenable password level 15 7 ************n!\nusername admin password 7 **************** privilege 15\n!\nprotocol spanning-tree pvst \n!\nstack-unit 1 provision S4048T-ON\n!\ninterface TenGigabitEthernet 1/1\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/2\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/3\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/4\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/5\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/6\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/7\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/8\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/9\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/10\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/11\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/12\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/13\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/14\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/15\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/16\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/17\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/18\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/19\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/20\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/21\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/22\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/23\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/24\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/25\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/26\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/27\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/28\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/29\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/30\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/31\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/32\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/33\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/34\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/35\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/36\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/37\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/38\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/39\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/40\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/41\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/42\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/43\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/44\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/45\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/46\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/47\n no ip address\n shutdown\n!\ninterface TenGigabitEthernet 1/48\n description uplink-sw1_stack-port3\n no ip address\n switchport\n no shutdown\n!\ninterface fortyGigE 1/49\n no ip address\n shutdown\n!\ninterface fortyGigE 1/50\n no ip address\n shutdown\n!\ninterface fortyGigE 1/51\n no ip address\n shutdown\n!\ninterface fortyGigE 1/52\n no ip address\n shutdown\n!\ninterface fortyGigE 1/53\n no ip address\n shutdown\n!\ninterface fortyGigE 1/54\n no ip address\n shutdown\n!\ninterface ManagementEthernet 1/1\n no ip address\n shutdown\n!\ninterface ManagementEthernet 2/1\n shutdown\n!\ninterface ManagementEthernet 3/1\n shutdown\n!\ninterface ManagementEthernet 4/1\n shutdown\n!\ninterface ManagementEthernet 5/1\n shutdown\n!\ninterface ManagementEthernet 6/1\n shutdown\n!\ninterface Vlan 1\n!\ninterface Vlan 50\n description aaa\n name aaa\n no ip address\n tagged TenGigabitEthernet 1/48\n no shutdown\n!\ninterface Vlan 52\n description bbb\n name bbb\n no ip address\n shutdown\n!\n\n!\nno ip telnet server enable\n!\nntp server 10.1.0.2\n!\nclock timezone EET 2 0 \nclock summer-time EEST recurring last Sun Mar 3:00 last Sun Oct 4:00 \n!\nip ssh server enable\n!\nline console 0\nline vty 0\nline vty 1\nline vty 2\nline vty 3\nline vty 4\nline vty 5\nline vty 6\nline vty 7\nline vty 8\nline vty 9\n!\nreload-type\n boot-type normal-reload\n config-scr-download enable\n!\nend",
    "changed": true,
    "invocation": {
        "module_args": {
            "after": null,
            "backup": true,
            "backup_options": {
                "dir_path": "/home/name/Documents/ansible/backup",
                "filename": "sw2.cfg"
            },
            "before": null,
            "config": null,
            "lines": [
                "hostname sw2"
            ],
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": true,
            "src": null,
            "update": "merge"
        }
    },
    "saved": true
}
 _______________________________________________
< TASK [Backup current switch config (dellos6)] >
 -----------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /home/name/Documents/ansible/sw_dell_backup.yml:24
skipping: [sw2] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}
META: ran handlers
META: ran handlers
 ____________
< PLAY RECAP >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

sw2                      : ok=3    changed=2    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0  
Bob-Webb commented 2 months ago

I'm having the same issue.

ansible [core 2.14.1] config file = /home/ansible/ansible.cfg configured module search path = ['/opt/ansible/plugins/modules'] ansible python module location = /home/venv_python_3.10/lib/python3.10/site-packages/ansible ansible collection location = /home/ansible/collections:/opt/ansible/collections executable location = /home/bin/ansible python version = 3.10.7 (main, Sep 6 2022, 17:14:03) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)] (/home/venv_python_3.10/bin/python3) jinja version = 3.1.2 libyaml = True

ansible-galaxy collection list community.general

/home/venv_python_3.10/lib/python3.10/site-packages/ansible_collections Collection Version


community.general 6.1.0

ansible-config dump --only-changed ANSIBLE_HOME(env: ANSIBLE_HOME) = /home/ansible BECOME_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/become'] COLLECTIONS_PATHS(/home/ansible/ansible.cfg) = ['/home/ansible/collections', '/opt/ansible/colCONFIG_FILE() = /home/ansible/ansible.cfg DEFAULT_ACTION_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/action'] DEFAULT_CACHE_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/cache'] DEFAULT_CALLBACK_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/callback'] DEFAULT_CONNECTION_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/connection'] DEFAULT_FILTER_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/filter'] DEFAULT_HOST_LIST(/home/ansible/ansible.cfg) = ['/home/netbox_inventory'] DEFAULT_INVENTORY_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/inventory'] DEFAULT_LOOKUP_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/lookup'] DEFAULT_MODULE_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/modules'] DEFAULT_MODULE_UTILS_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/module_utils'] DEFAULT_ROLES_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/roles'] DEFAULT_STRATEGY_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/strategy'] DEFAULT_TERMINAL_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/terminal'] DEFAULT_TEST_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/test'] DEFAULT_VARS_PLUGIN_PATH(/home/ansible/ansible.cfg) = ['/opt/ansible/plugins/vars'] INVENTORY_ENABLED(/home/ansible/ansible.cfg) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml', 'cons

mpsOxygen commented 2 months ago

You're in luck, I will give you my workaround as apparently nobody is going to fix this anytime soon. Here you go:

---
- name: backup dell switch
  hosts: switches
  connection: ansible.netcommon.network_cli
  gather_facts: no
  ignore_errors: yes

  tasks:

  - name: 'check if switch is online'
    local_action: command ping -w 2 {{ ansible_host }}
    register: ping_result

  - name: Backup current switch config (dellos9)
    dellemc.os9.os9_facts:
      gather_subset:
        - config
    when: (ansible_network_os == 'dellemc.os9.os9' and ping_result.rc == 0)

  - name: Backup current switch config (dellos6)
    dellemc.os6.os6_facts:
      gather_subset:
        - config
    when: (ansible_network_os == 'dellemc.os6.os6' and ping_result.rc == 0)

  - name: Salveaza config
    copy:
      content: "{{ ansible_facts.net_config }}"
      dest: "/home/user/ansible/backup/{{ inventory_hostname }}.cfg"
      mode: u=rw,g=r,o=r
    when: ping_result.rc == 0
Bob-Webb commented 2 months ago

Thanks! I’ll give this a try

From: mpsOxygen @.> Sent: Thursday, June 20, 2024 4:57 AM To: ansible-collections/dellemc.os9 @.> Cc: Bob Webb @.>; Comment @.> Subject: Re: [ansible-collections/dellemc.os9] os9_config backup options does not work (Issue #28)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

You're in luck, I will give you my workaround as apparently nobody is going to fix this anytime soon. Here you go:


— Reply to this email directly, view it on GitHubhttps://github.com/ansible-collections/dellemc.os9/issues/28#issuecomment-2180168586, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANSMV2S7IPZE5KEADCGNC6DZIKKNZAVCNFSM6AAAAABJQQTIDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGE3DQNJYGY. You are receiving this because you commented.Message ID: @.**@.>>