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

Fact discovery has trailing \e[m after each line/value #65

Closed
mjrider opened this issue Jul 13, 2020 · 1 comment · Fixed by #69
Closed

Fact discovery has trailing \e[m after each line/value #65

mjrider opened this issue Jul 13, 2020 · 1 comment · Fixed by #69
Assignees

Comments

@mjrider
Copy link

mjrider commented Jul 13, 2020

SUMMARY

Discoveryed facts have a trailing \e[m after values and or lines
for example

    ansible_net_hostname: "vyos\e[m"
    ansible_net_version: "VyOS 1.3-rolling-202007130117\e[m"
    ansible_net_config:
    - |-
      set interfaces ethernet eth0 address 'dhcp'[m
      set interfaces ethernet eth0 hw-id '08:00:27:cf:54:d5'[m
      set interfaces ethernet eth1 hw-id '08:00:27:7b:6e:55'[m
      set interfaces ethernet eth2 hw-id '08:00:27:8a:84:fe'[m
...
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  vyos.vyos.vyos_facts
ANSIBLE VERSION
ansible 2.9.10
  config file = /home/foobar/git/devops/ansible.cfg
  configured module search path = ['/home/foobar/git/devops/lib/ansible/modules']
  ansible python module location = /home/foobar/ansible/lib/python3.7/site-packages/ansible
  executable location = /home/foobar/bin/ansible
  python version = 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]

CONFIGURATION
ANSIBLE_NOCOLOR(/home/foobar/git/devops/ansible.cfg) = False
ANSIBLE_NOCOWS(/home/foobar/git/devops/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/foobar/git/devops/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/home/foobar/git/devops/ansible.cfg) = -o PasswordAuthentication=no -o ControlMaster=auto -o ControlPersist=600s
COMMAND_WARNINGS(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_ACTION_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/action']
DEFAULT_BECOME_USER(/home/foobar/git/devops/ansible.cfg) = root
DEFAULT_CACHE_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/cache']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/callback']
DEFAULT_CONNECTION_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/connection']
DEFAULT_FILTER_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/filter']
DEFAULT_FORCE_HANDLERS(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_FORKS(/home/foobar/git/devops/ansible.cfg) = 5
DEFAULT_GATHERING(/home/foobar/git/devops/ansible.cfg) = smart
DEFAULT_GATHER_SUBSET(/home/foobar/git/devops/ansible.cfg) = ['all', '!ohai']
DEFAULT_HOST_LIST(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/ansible/vagrant/inventory']
DEFAULT_LOG_PATH(/home/foobar/git/devops/ansible.cfg) = /home/foobar/git/devops/ansible/vagrant/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/lookup']
DEFAULT_MANAGED_STR(/home/foobar/git/devops/ansible.cfg) = Ansible managed file {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_NAME(/home/foobar/git/devops/ansible.cfg) = command
DEFAULT_MODULE_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/modules']
DEFAULT_POLL_INTERVAL(/home/foobar/git/devops/ansible.cfg) = 15
DEFAULT_ROLES_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/roles']
DEFAULT_SCP_IF_SSH(/home/foobar/git/devops/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/foobar/git/devops/ansible.cfg) = yaml
DEFAULT_STRATEGY_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/strategy']
DEFAULT_TEST_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/test']
DEFAULT_TIMEOUT(/home/foobar/git/devops/ansible.cfg) = 10
DEFAULT_VARS_PLUGIN_PATH(/home/foobar/git/devops/ansible.cfg) = ['/home/foobar/git/devops/lib/ansible/plugins/vars']
DEPRECATION_WARNINGS(/home/foobar/git/devops/ansible.cfg) = True
DISPLAY_SKIPPED_HOSTS(/home/foobar/git/devops/ansible.cfg) = True
HOST_KEY_CHECKING(/home/foobar/git/devops/ansible.cfg) = False

OS / ENVIRONMENT

vyos 1.3-rolling-202007130117

STEPS TO REPRODUCE

ansible-playbook -vv -CD playbooks/boxes/vyos.yml

---
- name: vyos setup
  connection: network_cli
  gather_facts: false
  hosts: os.vyos
  vars:
    ansible_network_os: vyos
  tasks:

    - name: Get config for VyOS devices
      vyos.vyos.vyos_facts:
        gather_subset: all
        # gather_network_resources: all

    - name: Display the config
      debug:
        msg: The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}
EXPECTED RESULTS
  msg: "The hostname is vyos and the OS is VyOS 1.3-rolling-202007130117"
ACTUAL RESULTS

What the result i got in the debug print was:

ok: [router] => 
  msg: "The hostname is vyos\e[m and the OS is VyOS 1.3-rolling-202007130117\e[m"
ansible-playbook 2.9.10
  config file = /home/foobar/git/devops/ansible/vagrant/ansible.cfg
  configured module search path = ['/home/foobar/git/devops/lib/ansible/modules']
  ansible python module location = /home/foobar/ansible/lib/python3.7/site-packages/ansible
  executable location = /home/foobar/bin/ansible-playbook
  python version = 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]
Using /home/foobar/git/devops/ansible/vagrant/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method
script declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method
auto declined parsing /home/foobar/git/devops/ansible/vagrant/inventory as it did not pass its verify_file() method

Parsed /home/foobar/git/devops/ansible/vagrant/inventory inventory source with ini plugin
Loading callback plugin yaml of type stdout, v2.0 from /home/foobar/ansible/lib/python3.7/site-packages/ansible/plugins/callback/yaml.py

PLAYBOOK: vyos.yml *******************************************************************************************************************
Positional arguments: playbooks/boxes/vyos.yml
verbosity: 4
connection: smart
timeout: 10
force_handlers: True
become_method: sudo
tags: ('all',)
check: True
diff: True
inventory: ('/home/foobar/git/devops/ansible/vagrant/inventory',)
forks: 5
1 plays in playbooks/boxes/vyos.yml

PLAY [Network Getting Started First Playbook] ****************************************************************************************
META: ran handlers

TASK [Get config for VyOS devices] ***************************************************************************************************
task path: /home/foobar/git/devops/ansible/vagrant/playbooks/boxes/vyos.yml:10
<router.test> attempting to start connection
<router.test> using connection plugin network_cli
<router.test> local domain socket does not exist, starting it
<router.test> control socket path is /home/foobar/.ansible/pc/98284ff3ed
<router.test> local domain socket listeners started successfully
<router.test> loaded cliconf plugin vyos from path /home/foobar/ansible/lib/python3.7/site-packages/ansible/plugins/cliconf/vyos.py for network_os vyos
<router.test> 
<router.test> local domain socket path is /home/foobar/.ansible/pc/98284ff3ed
<router> Attempting python interpreter discovery
<router.test> ESTABLISH LOCAL CONNECTION FOR USER: foobar
<router.test> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<router.test> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
<router> Python interpreter discovery fallback (unsupported Linux distribution: LinuxMint)
Using module file /home/foobar/.ansible/collections/ansible_collections/vyos/vyos/plugins/modules/vyos_facts.py
Pipelining is enabled.
<router.test> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
[WARNING]: Platform linux on host router is using the discovered Python interpreter at /usr/bin/python, but future installation of
another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [router] => changed=false 
  ansible_facts:
    ansible_net_api: cliconf
    ansible_net_commits:
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:38:45 '
      revision: '0'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:36:01 '
      revision: '1'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 11:34:33 '
      revision: '2'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-07-13 11:29:15 '
      revision: '3'
      via: "vyos-boot-config-loader\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 09:28:36 '
      revision: '4'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-07-13 09:28:31 '
      revision: '5'
      via: "cli\e[m"
    - by: vagrant
      comment: "configured by vyos_config\e[m"
      datetime: '2020-07-13 09:28:27 '
      revision: '6'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-07-13 09:28:05 '
      revision: '7'
      via: "boot-config-loader\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 10:32:27 '
      revision: '8'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 10:29:56 '
      revision: '9'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:46:05 '
      revision: '10'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:27:10 '
      revision: '11'
      via: "cli\e[m"
    - by: vagrant
      comment: null
      datetime: '2020-02-05 09:25:30 '
      revision: '12'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:14:16 '
      revision: '13'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:10:29 '
      revision: '14'
      via: "cli\e[m"
    - by: vyos
      comment: null
      datetime: '2020-02-05 09:10:19 '
      revision: '15'
      via: "cli\e[m"
    - by: root
      comment: null
      datetime: '2020-02-05 09:09:06 '
      revision: '16'
      via: "boot-config-loader\e[m"
    ansible_net_config:
    - |-
      set interfaces ethernet eth0 address 'dhcp'[m
      set interfaces ethernet eth0 hw-id '08:00:27:cf:54:d5'[m
      set interfaces ethernet eth1 hw-id '08:00:27:7b:6e:55'[m
      set interfaces ethernet eth2 hw-id '08:00:27:8a:84:fe'[m
      set interfaces ethernet eth3 hw-id '08:00:27:65:b6:67'[m
      set interfaces ethernet eth4 hw-id '08:00:27:12:a0:e9'[m
      set interfaces ethernet eth5 hw-id '08:00:27:08:86:3b'[m
      set interfaces loopback lo[m
      set service ssh disable-host-validation[m
      set service ssh port '22'[m
      set system config-management commit-revisions '20'[m
      set system console device ttyS0 speed '115200'[m
      set system host-name 'vyos'[m
      set system login user vagrant authentication encrypted-password '$6$y8n2l.nAL6byU$.ESxKj7K4wwm.lpf46ckUY0AI.lkezzfJLiS/4ud4Mo.ukhxzWKRQZxjyAUih2E/ZXX7EFxNf1cblgWviI8wb/'[m
      set system login user vagrant authentication plaintext-password ''[m
      set system login user vagrant authentication public-keys vagrant key 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC9cQTmeYT58NGlQAF3LKmEdjvweumyvepakR8A30ohd8m5N0aRvaEWNXpdg0nLLWQI+2YY9IqVd6Ipl6K64pQZVDNUAxNGphQsz4xlQzPsSh0lG572poPdeTvN2rkhL8EL4HcFrCZhYRL5jpWKQ5u6zahdK25qs9L+QeGDI7VGENjXARvLD0z6u2/NlPhdszD0CBIcKRZc+18GiBkoHOTJAj9ChzrMV71vbfXHqrb1AlrUdJ0IUrNnOLkGKWuNkHXD5qfh6phdc+fNtVdbxjkcuKkxoNDSQw8YdQqZGNt0HTpIoBauoWkDC78Ipd3lurK7wTs6l79rca0x5ZUyX3jT'[m
      set system login user vagrant authentication public-keys vagrant type 'ssh-rsa'[m
      set system name-servers-dhcp 'eth0'[m
      set system ntp server 0.pool.ntp.org[m
      set system ntp server 1.pool.ntp.org[m
      set system ntp server 2.pool.ntp.org[m
      set system syslog global facility all level 'info'[m
      set system syslog global facility protocols level 'debug'[m
    - |-
      0   2020-07-13 11:38:45 by vagrant via cli[m
      1   2020-07-13 11:36:01 by vagrant via cli[m
      2   2020-07-13 11:34:33 by vagrant via cli[m
      3   2020-07-13 11:29:15 by root via vyos-boot-config-loader[m
      4   2020-07-13 09:28:36 by vagrant via cli[m
      5   2020-07-13 09:28:31 by vagrant via cli[m
      6   2020-07-13 09:28:27 by vagrant via cli[m
          configured by vyos_config[m
      7   2020-07-13 09:28:05 by root via boot-config-loader[m
      8   2020-02-05 10:32:27 by vagrant via cli[m
      9   2020-02-05 10:29:56 by vagrant via cli[m
      10  2020-02-05 09:46:05 by vagrant via cli[m
      11  2020-02-05 09:27:10 by vagrant via cli[m
      12  2020-02-05 09:25:30 by vagrant via cli[m
      13  2020-02-05 09:14:16 by vyos via cli[m
      14  2020-02-05 09:10:29 by vyos via cli[m
      15  2020-02-05 09:10:19 by vyos via cli[m
      16  2020-02-05 09:09:06 by root via boot-config-loader[m
      17  2020-02-05 09:09:05 by root via init[m
    ansible_net_gather_network_resources: []
    ansible_net_gather_subset:
    - neighbors
    - default
    - config
    ansible_net_hostname: "vyos\e[m"
    ansible_net_neighbors: {}
    ansible_net_python_version: 2.7.16
    ansible_net_serialnum: null
    ansible_net_system: vyos
    ansible_net_version: "VyOS 1.3-rolling-202007130117\e[m"
    ansible_network_resources: {}
    discovered_interpreter_python: /usr/bin/python
  invocation:
    module_args:
      gather_network_resources: null
      gather_subset:
      - all
      provider: null

TASK [Display the config] ************************************************************************************************************
task path: /home/foobar/git/devops/ansible/vagrant/playbooks/boxes/vyos.yml:15
<router.test> attempting to start connection
<router.test> using connection plugin network_cli
<router.test> found existing local domain socket, using it!
<router.test> ssh connection done, setting terminal
<router.test> loaded terminal plugin for network_os vyos
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> firing event: on_open_shell()
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> ssh connection has completed successfully
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<router.test> updating play_context for connection
<router.test> 
<router.test> local domain socket path is /home/foobar/.ansible/pc/98284ff3ed
ok: [router] => 
  msg: "The hostname is vyos\e[m and the OS is VyOS 1.3-rolling-202007130117\e[m"
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************************************************
router                     : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants