I am using ansible to collect the network device’s dispaly cu, and in the collected content all the digit 1s are replaced with ********. Is this a bug or a feature? How can I turn it off?
- I did not define no_log in my playbook
- ansible version: 2.9.27
- My custom module: using the paramiko library to log in to the network device, session.send to send commands, output = session.recv(2048).decode(“utf-8”, “replace”) to receive the device’s returned value.
---
- name: xunjian
hosts: sw
gather_facts: no
# become: true
# become_method: enable
vars:
skip_lldp_hosts:
- "172.XXXXXXX"
tasks:
- name: get date
local_action:
module: raw date +"%Y-%m-%d"
register: "current_date"
- name: show_ip_all
cyw_ssh_more:
ip: "{{baoleiji_host}}"
name: "{{ ansible_ssh_user}}"
password: "{{ ansible_ssh_pass }}"
enable: "0"
enable_command: "enable"
enable_password: "1"
command: "disp curr"
port: "{{ansible_ssh_port}}"
type: "hw"
delegate_to: localhost
register: dis_curr
- name: lldp
cyw_ssh_more:
ip: "{{baoleiji_host}}"
name: "{{ ansible_ssh_user}}"
password: "{{ ansible_ssh_pass }}"
enable: "0"
enable_command: "enable"
enable_password: "1"
command: "disp lldp nei"
port: "{{ansible_ssh_port}}"
type: "hw"
delegate_to: localhost
register: lldp
when: inventory_hostname not in skip_lldp_hosts
- name: ipv4mac
cyw_ssh_more:
ip: "{{baoleiji_host}}"
name: "{{ ansible_ssh_user}}"
password: "{{ ansible_ssh_pass }}"
enable: "0"
enable_command: "enable"
enable_password: "1"
command: "disp mac-address"
port: "{{ansible_ssh_port}}"
type: "hw"
delegate_to: localhost
register: ipv4mac
- name: log
set_fact:
info_log:
show_ip_all: "{{dis_curr.output}}"
lldp: "{{lldp.output}}"
ipv4mac: "{{ipv4mac.output}}"
- name: save log_info to file
append_file:
flag: "{{hostname}} info_log:"
content: "{{info_log}}"
file_path: "/root/xunjian/sw_{{current_date.stdout_lines[0]}}.txt"
delegate_to: localhost
- Set at least one tag (the experts follow the tags, so the right people will find you if you tag)