Open mpsOxygen opened 2 years 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
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
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:
name: backup dell switch
hosts: switches
connection: ansible.netcommon.network_cli
gather_facts: no
ignore_errors: yes
tasks:
local_action: command ping -w 2 {{ ansible_host }}
register: ping_result
dellemc.os9.os9_facts:
gather_subset:
- config
when: (ansible_network_os == 'dellemc.os9.os9' and ping_result.rc == 0)
dellemc.os6.os6_facts:
gather_subset:
- config
when: (ansible_network_os == 'dellemc.os6.os6' and ping_result.rc == 0)
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
— 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: @.**@.>>
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:
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)
ISSUE TYPE
COMPONENT NAME
dellemc.os9.os9_config
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
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
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.