我正在尝试执行备份剧本,但备份时遇到错误。
这是我的代码:
ignore_unreachable: true
错误显示密码无效,但我使用了正确的密码
---
- hosts: cisco
gather_facts: true
vars:
ansible_become: yes
ansible_become_method: enable
ansible_user: translab
ansible_password: cisco
ansible_become_pass: cisco
ansible_network_os: ios
ansible_connection: network_cli
tasks:
- ios_command:
commands: show run
register: show_run
- copy:
content: "{{ show_run.stdout[0]}}"
host: ansibletower
username: root
password: root@123
dest: "/etc/ansible/backup/'{{ inventory_hostname }}'.txt"
delegate_to: ansibletower