Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

os6_config backup option not working #45

Closed
zerwes opened this issue Feb 3, 2022 · 1 comment
Closed

os6_config backup option not working #45

zerwes opened this issue Feb 3, 2022 · 1 comment

Comments

@zerwes
Copy link

zerwes commented Feb 3, 2022

SUMMARY

The backup option in the os6_config module does not work.
The configuration file is not saved to the specified location (same behavior using the default location)
Same effect with dellos10! See: ansible-collections/dellemc.os10#113

ISSUE TYPE
  • Bug Report
COMPONENT NAME

os6_config

ANSIBLE VERSION

starting from 2.10.0, tested with 2.12.1 and 2.12.2 too.

COLLECTION VERSION
± ansible-galaxy collection list  dellemc.os6

# /home/zerwes/.ansible/collections/ansible_collections
Collection  Version
----------- -------
dellemc.os6 1.0.7  

# /usr/local/lib/python3.9/dist-packages/ansible_collections
Collection  Version
----------- -------
dellemc.os6 1.0.7  

tested with the latest via git too:
ansible-galaxy collection install git@github.com:Rosa-Luxemburgstiftung-Berlin/dellemc.os10.git -p ./collections

CONFIGURATION
± ansible-config dump --only-changed
ANSIBLE_NOCOWS(/home/zerwes/git/ansible-spk8/ansible.cfg) = True
COLLECTIONS_PATHS(/home/zerwes/git/ansible-spk8/ansible.cfg) = ['/home/zerwes/git/ansible-spk8/.collections', '/home/zerwes/.ansible/collections', '/usr/share/ansible/collections']
DEFAULT_HASH_BEHAVIOUR(/home/zerwes/git/ansible-spk8/ansible.cfg) = merge
DEFAULT_HOST_LIST(/home/zerwes/git/ansible-spk8/ansible.cfg) = ['/home/zerwes/git/ansible-spk8/hosts']
DEFAULT_MODULE_PATH(/home/zerwes/git/ansible-spk8/ansible.cfg) = ['/home/zerwes/git/ansible-spk8/library']
DEFAULT_ROLES_PATH(/home/zerwes/git/ansible-spk8/ansible.cfg) = ['/home/zerwes/git/ansible-spk8/roles']
DEFAULT_STRATEGY(/home/zerwes/git/ansible-spk8/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/home/zerwes/git/ansible-spk8/ansible.cfg) = ['/usr/local/lib/python3.9/dist-packages/ansible_mitogen/plugins/strategy']
INTERPRETER_PYTHON(/home/zerwes/git/ansible-spk8/ansible.cfg) = auto_legacy
MAX_FILE_SIZE_FOR_DIFF(/home/zerwes/git/ansible-spk8/ansible.cfg) = 1048576
RETRY_FILES_SAVE_PATH(/home/zerwes/git/ansible-spk8/ansible.cfg) = /home/zerwes/.ansible-retry
OS / ENVIRONMENT

± lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

STEPS TO REPRODUCE
± ansible-playbook -l swu11ber0.ber0.rosalux.org -vvv -D switch_os6_save_config.yml
ansible-playbook [core 2.12.2]
  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/git/ansible-spk8/.collections:/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.dellos6_config to dellemc.os6.os6_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_os6_save_config.yml ******************************************************************************************************************************************************************************
1 plays in switch_os6_save_config.yml

PLAY [switch_access_spk8] *****************************************************************************************************************************************************************************************
META: ran handlers

TASK [save config ...] ********************************************************************************************************************************************************************************************
task path: /home/zerwes/git/ansible-spk8/switch_os6_save_config.yml:9
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: become) ansible.builtin.enable to ansible.netcommon.enable
redirecting (type: action) ansible.builtin.dellos6 to dellemc.os6.os6
redirecting (type: action) ansible.builtin.dellos6 to dellemc.os6.os6
<172.31.249.11> ESTABLISH LOCAL CONNECTION FOR USER: zerwes
<172.31.249.11> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87 `"&& mkdir "` echo /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058 `" && echo ansible-tmp-1643904566.4674978-1666633-233322062188058="` echo /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.dellos6_config to dellemc.os6.os6_config
Using module file /home/zerwes/.ansible/collections/ansible_collections/dellemc/os6/plugins/modules/os6_config.py
<172.31.249.11> PUT /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/tmp8zkxof7_ TO /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058/AnsiballZ_os6_config.py
<172.31.249.11> EXEC /bin/sh -c 'chmod u+x /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058/ /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058/AnsiballZ_os6_config.py && sleep 0'
<172.31.249.11> EXEC /bin/sh -c '/usr/bin/python3 /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058/AnsiballZ_os6_config.py && sleep 0'
<172.31.249.11> EXEC /bin/sh -c 'rm -f -r /home/zerwes/.ansible/tmp/ansible-local-1666629ffpyif87/ansible-tmp-1643904566.4674978-1666633-233322062188058/ > /dev/null 2>&1 && sleep 0'
ok: [swu11ber0.ber0.rosalux.org] => {
    "__backup__": "!Current Configuration:\n!System Description \"Dell EMC Networking N3048EP-ON, 6.6.3.40, Linux 4.14.138, v1.0.5\"\n!System Software Version 6.6.3.40...
    "changed": false,
    "invocation": {
        "module_args": {
            "after": null,
            "backup": true,
            "backup_options": {
                "dir_path": "/tmp/",
                "filename": "swu11ber0.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 ********************************************************************************************************************************************************************************************************
swu11ber0.ber0.rosalux.org : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


± ls /tmp/swu11ber0.ber0.rosalux.org.cfg
ls: cannot access '/tmp/swu11ber0.ber0.rosalux.org.cfg': No such file or directory
- hosts: switch_access_spk8
  connection: network_cli
  gather_facts: no
  strategy: linear
  tasks:
  - name: "save config ..."
    vars:
      ansible_become: yes
    dellos6_config:
      backup: yes
      save: no
      update: check
      backup_options:
        dir_path: "/tmp/"
        filename: "{{ backup_filename }}"
EXPECTED RESULTS

file to be stored in the desired location

ACTUAL RESULTS

config is retrieved (result['__backup__']) but not saved to the file

@zerwes
Copy link
Author

zerwes commented Feb 7, 2022

see solution ansible-collections/dellemc.os10#113
use:

- name: Configuration Retrieval
  connection: ansible.netcommon.network_cli
  gather_facts: false
  become: yes
  become_method: enable
  vars:
    ansible_network_os: dellemc.os6.os6
  tasks:
    - name: Retrieve Configuration
      dellemc.os6.os6_config:
        backup: true
        backup_options:
          # ...

or

- name: Configuration Retrieval
  connection: ansible.netcommon.network_cli
  gather_facts: false
  become: yes
  become_method: enable
  collections:
    - dellemc.os6
  vars:
    ansible_network_os: dellemc.os6.os6
  tasks:
    - name: Retrieve Configuration
      os6_config:
        backup: true
        backup_options:
          # ...

@zerwes zerwes closed this as completed Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant