ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.68k stars 23.86k forks source link

routeros_command wait_for contains fails when the string contains "yes" #58473

Closed tbaschak closed 4 years ago

tbaschak commented 5 years ago
SUMMARY

When running a command with routeros_command and using wait_for: "result[0] contains yes" will fail, but wait_for: result[0] contains ye works as expected.

Similarly, the same thing happens if you do "wait_for: result[0] contains true"

ISSUE TYPE
COMPONENT NAME

routeros_command or wait_for

ANSIBLE VERSION
ansible 2.8.1
  config file = /home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.cfg
  configured module search path = ['/home/gobcn.local/tbaschak/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gobcn.local/tbaschak/dev/bcn/ansible_testing/venv/lib/python3.6/site-packages/ansible
  executable location = /home/gobcn.local/tbaschak/dev/bcn/ansible_testing/venv/bin/ansible
  python version = 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
CONFIGURATION
DEFAULT_HOST_LIST(/home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.cfg) = ['/home/gobcn.local/tbaschak/dev/bcn/ansible_testing/hosts']
DEFAULT_LOG_PATH(/home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.cfg) = /home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.log
DEFAULT_TIMEOUT(/home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.cfg) = 5
HOST_KEY_CHECKING(/home/gobcn.local/tbaschak/dev/bcn/ansible_testing/ansible.cfg) = False
OS / ENVIRONMENT

CentOS 7 Debian Buster Mikrotik RouterOS 6.40.8 & 6.43.4

STEPS TO REPRODUCE
---

- name: Network Getting Started First Playbook
  connection: network_cli
  gather_facts: no
  hosts: testap
  tasks:
  - name: Validate NTP Settings
    routeros_command:
      commands:
        - /system ntp client print
      wait_for:
        - "result[0] contains yes"
EXPECTED RESULTS
---

- name: Network Getting Started First Playbook
  connection: network_cli
  gather_facts: no
  hosts: testap
  tasks:
  - name: Validate NTP Settings
    routeros_command:
      commands:
        - /system ntp client print
      wait_for:
        - result[0] contains ye

This playbook works, adding an s to the end of ye makes it no longer work.

ACTUAL RESULTS

The string yes was not matched if it was contained fully within the contains clause of the wait_for. The same thing happens with tru/true.

ansibot commented 5 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot commented 5 years ago

cc @AnderEnder @gregswift @heuels @jarv @jhoekx click here for bot help

ansibot commented 5 years ago

@tbaschak, just so you are aware we have a dedicated Working Group for network. You can find other people interested in this in #ansible-network on Freenode IRC For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

tbaschak commented 5 years ago

This looks related to issue #11905, where it appears this is a long-standing bug that many people have run into.

Akasurde commented 5 years ago

!component =lib/ansible/modules/network/routeros/routeros_command.py

ansibot commented 5 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

dimasmir commented 4 years ago

Same thing. Already getting used to use ye, tru. Declaring a variable with !!str or |string or quotes does not help.

NilashishC commented 4 years ago

Thank you very much for your interest in Ansible. This plugin is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/community.network

Please re-submit this issue in the above repository.

If you have further questions please stop by IRC or the mailing list:

IRC: #ansible on irc.freenode.net mailing list: https://groups.google.com/forum/#!forum/ansible-project