You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a fresh install of Ansible control node, I found that ios_config is not writing the backup to the file. I tried deleting files, but it doesn't create either.
PS: i have downgrade ansible.netcommon and ansible.utils from lastest (7.1.0 / 5.1.2) to (6.1.3 / 4.1.0) because these collections are in these specific version on my good working older control node and them seem to be use in the backup process.
CONFIGURATION
$ ansible-config dump --only-changed
[DEPRECATION WARNING]: PARAMIKO_LOOK_FOR_KEYS option, This option was moved to the plugin itself, use Use the option from
the plugin itself. instead. This feature will be removed from ansible-core in version 2.20. Deprecation warnings can be
disabled by setting deprecation_warnings=False in ansible.cfg.
ANSIBLE_FORCE_COLOR(/home/stefaniak/.ansible.cfg) = True
CALLBACKS_ENABLED(/home/stefaniak/.ansible.cfg) = ['profile_tasks']
CONFIG_FILE() = /home/stefaniak/.ansible.cfg
DEFAULT_FORKS(/home/stefaniak/.ansible.cfg) = 40
DEFAULT_JINJA2_EXTENSIONS(/home/stefaniak/.ansible.cfg) = jinja2.ext.do
EDITOR(env: EDITOR) = nano
HOST_KEY_CHECKING(/home/stefaniak/.ansible.cfg) = False
NETWORK_GROUP_MODULES(/home/stefaniak/.ansible.cfg) = ['arubaoss']
PARAMIKO_LOOK_FOR_KEYS(/home/stefaniak/.ansible.cfg) = False
OS / ENVIRONMENT
My laptop: Kubuntu 24.10
Same on a server: Debian 12
STEPS TO REPRODUCE
- hosts: ciscoserial: 40strategy: freegather_facts: nopre_tasks:
- name: include vars encrypted by vaultinclude_vars: "vars.yml"tasks:
- name: get config to filecisco.ios.ios_config:
backup: yesbackup_options:
dir_path: "{{ playbook_dir }}/git/backup/cisco"filename: "{{ inventory_hostname }}.config"
- name: save running to startup when modifiedcisco.ios.ios_config:
save_when: modified
EXPECTED RESULTS
backup file in a git local repository.
ACTUAL RESULTS
the debug var "backup" seen correct, but no writing is effective, and the task is in 'ok' state, not 'changed' as expected.
(i have normally always 'changed' state because some script delete some line in the backup after).
$ ansible-playbook backup_conf_ios.yml --vault-id ./id.sh -i "$inventory" -vvvv
ansible-playbook [core 2.17.6]
config file = /home/stefaniak/.ansible.cfg
configured module search path = ['/home/stefaniak/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/stefaniak/Documents/Ansible/.network/lib/python3.12/site-packages/ansible
ansible collection location = /home/stefaniak/.ansible/collections:/usr/share/ansible/collections
executable location = /home/stefaniak/Documents/Ansible/.network/bin/ansible-playbook
python version = 3.12.7 (main, Oct 3 2024, 15:15:22) [GCC 14.2.0] (/home/stefaniak/Documents/Ansible/.network/bin/python3)
jinja version = 3.1.4
libyaml = True
Using /home/stefaniak/.ansible.cfg as config file
[DEPRECATION WARNING]: PARAMIKO_LOOK_FOR_KEYS option, This option was moved to the plugin itself, use Use the option from
the plugin itself. instead. This feature will be removed from ansible-core in version 2.20. Deprecation warnings can be
disabled by setting deprecation_warnings=False in ansible.cfg.
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /home/stefaniak/Documents/Ansible/Inventaires/reseau_test as it did not pass its verify_file() method
script declined parsing /home/stefaniak/Documents/Ansible/Inventaires/reseau_test as it did not pass its verify_file() method
auto declined parsing /home/stefaniak/Documents/Ansible/Inventaires/reseau_test as it did not pass its verify_file() method
Not replacing invalid character(s) "{'-'}" in group name (procurve-2626)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
Not replacing invalid character(s) "{'-'}" in group name (procurve-2626)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2610)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2610)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2530)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2530)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2524)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2524)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2510g)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2510g)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2510)
Not replacing invalid character(s) "{'-'}" in group name (procurve-2510)
Not replacing invalid character(s) "{'-'}" in group name (ios-2960x)
Not replacing invalid character(s) "{'-'}" in group name (ios-2960x)
Not replacing invalid character(s) "{'-'}" in group name (ios-2960)
Not replacing invalid character(s) "{'-'}" in group name (ios-2960)
Not replacing invalid character(s) "{'-'}" in group name (ios-2950)
Not replacing invalid character(s) "{'-'}" in group name (ios-2950)
Not replacing invalid character(s) "{'-'}" in group name (iosxe-cat3k)
Not replacing invalid character(s) "{'-'}" in group name (iosxe-cat3k)
Not replacing invalid character(s) "{'-'}" in group name (iosxe-cat9k)
Not replacing invalid character(s) "{'-'}" in group name (iosxe-cat9k)
Parsed /home/stefaniak/Documents/Ansible/Inventaires/reseau_test inventory source with ini plugin
[WARNING]: Found both group and host with same name: fortianalyzer
Loading collection cisco.ios from /home/stefaniak/.ansible/collections/ansible_collections/cisco/ios
Loading callback plugin default of type stdout, v2.0 from /home/stefaniak/Documents/Ansible/.network/lib/python3.12/site-packages/ansible/plugins/callback/default.py
redirecting (type: callback) ansible.builtin.profile_tasks to ansible.posix.profile_tasks
Loading collection ansible.posix from /home/stefaniak/Documents/Ansible/.network/lib/python3.12/site-packages/ansible_collections/ansible/posix
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.
Loading callback plugin ansible.posix.profile_tasks of type aggregate, v2.0 from /home/stefaniak/Documents/Ansible/.network/lib/python3.12/site-packages/ansible_collections/ansible/posix/plugins/callback/profile_tasks.py
PLAYBOOK: backup_conf_ios.yml ***********************************************************************************************
Positional arguments: backup_conf_ios.yml
verbosity: 4
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/home/stefaniak/Documents/Ansible/Inventaires/reseau_test',)
vault_ids: ('./id.sh',)
forks: 40
1 plays in backup_conf_ios.yml
PLAY [cisco] ****************************************************************************************************************
jeudi 14 novembre 2024 10:43:25 +0100 (0:00:00.011) 0:00:00.011 ********
Loading collection ansible.netcommon from /home/stefaniak/.ansible/collections/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /home/stefaniak/.ansible/collections/ansible_collections/ansible/utils
Trying secret ScriptVaultSecret(filename='/home/stefaniak/Documents/Ansible/Actions/Backup-network/id.sh') for vault_id=default
TASK [include vars encrypted by vault] **************************************************************************************
task path: /home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:6
ok: [SW-d001-3850] => {
"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result",
"changed": false
}
jeudi 14 novembre 2024 10:43:25 +0100 (0:00:00.153) 0:00:00.165 ********
Loading collection ansible.netcommon from /home/stefaniak/.ansible/collections/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /home/stefaniak/.ansible/collections/ansible_collections/ansible/utils
<SW-d001-3850> attempting to start connection
<SW-d001-3850> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/stefaniak/Documents/Ansible/.network/bin/ansible-connection
<SW-d001-3850> local domain socket does not exist, starting it
<SW-d001-3850> control socket path is /home/stefaniak/.ansible/pc/1eab787f00
<SW-d001-3850> Loading collection ansible.builtin from
<SW-d001-3850> Loading collection ansible.netcommon from /home/stefaniak/.ansible/collections/ansible_collections/ansible/netcommon
<SW-d001-3850> Loading collection ansible.utils from /home/stefaniak/.ansible/collections/ansible_collections/ansible/utils
<SW-d001-3850> Loading collection cisco.ios from /home/stefaniak/.ansible/collections/ansible_collections/cisco/ios
<SW-d001-3850> local domain socket listeners started successfully
<SW-d001-3850> loaded cliconf plugin ansible_collections.cisco.ios.plugins.cliconf.ios from path /home/stefaniak/.ansible/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py for network_os cisco.ios.ios
<SW-d001-3850> ssh type is set to auto
<SW-d001-3850> autodetecting ssh_type
<SW-d001-3850> ssh type is now set to libssh
<SW-d001-3850> Loading collection ansible.builtin from
<SW-d001-3850> local domain socket path is /home/stefaniak/.ansible/pc/1eab787f00
<SW-d001-3850> ESTABLISH LOCAL CONNECTION FOR USER: stefaniak
<SW-d001-3850> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2 `"&& mkdir "` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412 `" && echo ansible-tmp-1731577406.465556-60620-45241263646412="` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412 `" ) && sleep 0'
Using module file /home/stefaniak/.ansible/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py
<SW-d001-3850> PUT /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/tmp00p8vyhi TO /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412/AnsiballZ_ios_config.py
<SW-d001-3850> EXEC /bin/sh -c 'chmod u+x /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412/ /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412/AnsiballZ_ios_config.py && sleep 0'
<SW-d001-3850> EXEC /bin/sh -c '/home/stefaniak/Documents/Ansible/.network/bin/python3 /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412/AnsiballZ_ios_config.py && sleep 0'
<SW-d001-3850> EXEC /bin/sh -c 'rm -f -r /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577406.465556-60620-45241263646412/ > /dev/null 2>&1 && sleep 0'
TASK [get config to file] ***************************************************************************************************
task path: /home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:9
ok: [SW-d001-3850] => {
"__backup__": "Building configuration...\n\nCurrent configuration : 42772 bytes\n!\n! Last configuration change at 08:24:18 CET Thu Nov 14 2024 by admin\n! NVRAM config last updated at 10:05:58 CET Thu Nov 14 2024 by admin\n!\nversion 16.12\n**[***]**\nend",
"changed": false,
"invocation": {
"module_args": {
"after": null,
"backup": true,
"backup_options": {
"dir_path": "/home/stefaniak/Documents/Ansible/Actions/Backup-network/git/backup/cisco",
"filename": "SW-d001-3850.config"
},
"before": null,
"defaults": false,
"diff_against": null,
"diff_ignore_lines": null,
"intended_config": null,
"lines": null,
"match": "line",
"multiline_delimiter": "@",
"parents": null,
"replace": "line",
"running_config": null,
"save_when": "never",
"src": null
}
}
}
jeudi 14 novembre 2024 10:43:33 +0100 (0:00:07.354) 0:00:07.519 ********
Loading collection ansible.netcommon from /home/stefaniak/.ansible/collections/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /home/stefaniak/.ansible/collections/ansible_collections/ansible/utils
<SW-d001-3850> attempting to start connection
<SW-d001-3850> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/stefaniak/Documents/Ansible/.network/bin/ansible-connection
<SW-d001-3850> found existing local domain socket, using it!
<SW-d001-3850> invoked shell using ssh_type: libssh
<SW-d001-3850> ssh connection done, setting terminal
<SW-d001-3850> loaded terminal plugin for network_os cisco.ios.ios
<SW-d001-3850> firing event: on_open_shell()
<SW-d001-3850> ssh connection has completed successfully
<SW-d001-3850> updating play_context for connection
<SW-d001-3850> Loading collection ansible.builtin from
<SW-d001-3850> local domain socket path is /home/stefaniak/.ansible/pc/1eab787f00
<SW-d001-3850> ESTABLISH LOCAL CONNECTION FOR USER: stefaniak
<SW-d001-3850> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2 `"&& mkdir "` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986 `" && echo ansible-tmp-1731577413.611274-60651-14978217557986="` echo /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986 `" ) && sleep 0'
Using module file /home/stefaniak/.ansible/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py
<SW-d001-3850> PUT /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/tmpehl51mv2 TO /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986/AnsiballZ_ios_config.py
<SW-d001-3850> EXEC /bin/sh -c 'chmod u+x /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986/ /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986/AnsiballZ_ios_config.py && sleep 0'
<SW-d001-3850> EXEC /bin/sh -c '/home/stefaniak/Documents/Ansible/.network/bin/python3 /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986/AnsiballZ_ios_config.py && sleep 0'
<SW-d001-3850> EXEC /bin/sh -c 'rm -f -r /home/stefaniak/.ansible/tmp/ansible-local-60613dvsf6en2/ansible-tmp-1731577413.611274-60651-14978217557986/ > /dev/null 2>&1 && sleep 0'
TASK [save running to startup when modified] ********************************************************************************
task path: /home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:15
changed: [SW-d001-3850] => {
"changed": true,
"invocation": {
"module_args": {
"after": null,
"backup": false,
"backup_options": null,
"before": null,
"defaults": false,
"diff_against": null,
"diff_ignore_lines": null,
"intended_config": null,
"lines": null,
"match": "line",
"multiline_delimiter": "@",
"parents": null,
"replace": "line",
"running_config": null,
"save_when": "modified",
"src": null
}
}
}
PLAY RECAP ******************************************************************************************************************
SW-d001-3850 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
jeudi 14 novembre 2024 10:43:51 +0100 (0:00:18.010) 0:00:25.529 ********
===============================================================================
save running to startup when modified ------------------------------------------------------------------------------- 18.01s
/home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:15 --------------------------------------------
get config to file --------------------------------------------------------------------------------------------------- 7.35s
/home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:9 ---------------------------------------------
include vars encrypted by vault -------------------------------------------------------------------------------------- 0.15s
/home/stefaniak/Documents/Ansible/Actions/Backup-network/backup_conf_ios.yml:6 ---------------------------------------------
Tempory Solution
If some of you have the same problem. I have made a tempory solution with a builtin copy module in my playbook :
- hosts: ciscoserial: 40strategy: freegather_facts: nopre_tasks:
- name: include vars encrypted by vaultinclude_vars: "vars.yml"tasks:
- name: get config to filecisco.ios.ios_config:
backup: yesbackup_options:
dir_path: "{{ playbook_dir }}/git/backup/cisco"filename: "{{ inventory_hostname }}.config"register: debug
- name: config to file because a bug of no writing files for cisco.ios.ios_configcopy:
content: "{{ debug['__backup__'] }}"dest: "{{ playbook_dir }}/git/backup/cisco/{{ inventory_hostname }}.config"delegate_to: localhostwhen: debug["__backup__"] is definedvars:
ansible_connection: local
- name: save running to startup when modifiedcisco.ios.ios_config:
save_when: modified
The text was updated successfully, but these errors were encountered:
I don't think this is a bug. Your playbook with the collections you have installed works perfectly fine here.
In your example run Ansible is marking the get config to file task as ok because a file with the same content is already present. Can you delete the file, re-run the job, and post the output?
SUMMARY
On a fresh install of Ansible control node, I found that ios_config is not writing the backup to the file. I tried deleting files, but it doesn't create either.
ISSUE TYPE
COMPONENT NAME
ios_config
ANSIBLE VERSION
COLLECTION VERSION
PS: i have downgrade ansible.netcommon and ansible.utils from lastest (7.1.0 / 5.1.2) to (6.1.3 / 4.1.0) because these collections are in these specific version on my good working older control node and them seem to be use in the backup process.
CONFIGURATION
OS / ENVIRONMENT
My laptop: Kubuntu 24.10
Same on a server: Debian 12
STEPS TO REPRODUCE
EXPECTED RESULTS
backup file in a git local repository.
ACTUAL RESULTS
the debug var "backup" seen correct, but no writing is effective, and the task is in 'ok' state, not 'changed' as expected.
(i have normally always 'changed' state because some script delete some line in the backup after).
Tempory Solution
If some of you have the same problem. I have made a tempory solution with a builtin copy module in my playbook :
The text was updated successfully, but these errors were encountered: