I am using ansible to collect the network device's dispaly cu, and in the collected content all the digit 1s are replaced with ********.

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?

  1. I did not define no_log in my playbook
  2. ansible version: 2.9.27
  3. 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)

Is your password for some reason maybe 1? Or does the cyw_ssh_more module use no_log=True for enable_password in the argument spec? Without knowing what cyw_ssh_more is and what it does it’s hard to say…

I just found out that indeed the enablepass was set to 1, and it’s nolog. Thank you very much for your explanation!!!

If you set no_log=True because ansible-test complained that the argument didn’t have no_log, note that you can also set no_log=False to mark arguments that are not sensitive, but that trigger the ansible-test warning :slight_smile: