ansible-collections / community.network

Ansible Community Network Collection
http://galaxy.ansible.com/community/network
Other
124 stars 89 forks source link

Unsupported parameters for (community.network.ce_command) module: transport #400

Open Telur44 opened 2 years ago

Telur44 commented 2 years ago

Hello,

I want to use the collection with Huawei S6730 switches.

I went here: _https://docs.ansible.com/ansible/latest/collections/community/network/ce_command_module.html_

And I copied exactly the example provided. However, every time I launch my playbook, I get the following error:

FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "Unsupported parameters for (community.network.ce_command) module: transport Supported parameters include: commands, interval, match, provider, retries, wait_for"}

I understand that the problem comes from "transport" but I really don't see how to solve it.

Could you please help me?

sirkubax commented 2 years ago

seems the same as https://github.com/ansible-collections/community.network/issues/321

I've the same issuem looks like some step is adding this args, probably on the playbook level I did not yet debug it that deeply, bit if you set
export ANSIBLE_KEEP_REMOTE_FILES=1 (just for testing)
and run

ansible-playbook playbooks/ce_command.yml -vvv

- hosts: localhost
  connection: local
  gather_facts: no
  vars:
    #ansible_connection: ansible.netcommon.netconf
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port |default(22) }}"
      username: "{{ username |default('huawei') }}"
      password: "{{ password |default('huawei') }}"
      transport: 'cli'

  tasks:

  - debug:
      msg: "{{ cli }}"

  - name: "Run display version on remote devices"
    ce_command:
      commands: display version
      provider: "{{ cli }}"
      #transport: cli

you can get (path would be different)

python /home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/AnsiballZ_ce_command.py explode
Module expanded into:
/home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/debug_dir

cat /home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/debug_dir/args 
{"ANSIBLE_MODULE_ARGS": {"commands": "display version", "provider": {"host": "localhost", "port": 22, "username": "huawei", "password": "huawei", "transport": "cli", "ssh_keyfile": null, "use_ssl": null, "validate_certs": null, "ti
meout": null}, "transport": "cli", "_ansible_check_mode": false, "_ansible_no_log": false, "_ansible_debug": false, "_ansible_diff": false, "_ansible_verbosity": 3, "_ansible_version": "2.11.2", "_ansible_module_name": "ce_command"
, "_ansible_syslog_facility": "LOG_USER", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p", "vfat"], "_ansible_string_conversion_action": "warn", "_ansible_socket": "/home/kuba/.ansible/pc/c92e282e64", "_ansib
le_shell_executable": "/bin/sh", "_ansible_keep_remote_files": true, "_ansible_tmpdir": "/home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/", "_ansible_remote_tmp": "~/.ansible/tmp"}}

cat /home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/debug_dir/args |jq
{
  "ANSIBLE_MODULE_ARGS": {
    "commands": "display version",
    "provider": {
      "host": "localhost",
      "port": 22,
      "username": "huawei",
      "password": "huawei",
      "transport": "cli",
      "ssh_keyfile": null,
      "use_ssl": null,
      "validate_certs": null,
      "timeout": null
    },
    "transport": "cli",
    "_ansible_check_mode": false,
    "_ansible_no_log": false,
    "_ansible_debug": false,
    "_ansible_diff": false,
    "_ansible_verbosity": 3,
    "_ansible_version": "2.11.2",
    "_ansible_module_name": "ce_command",
    "_ansible_syslog_facility": "LOG_USER",
    "_ansible_selinux_special_fs": [
      "fuse",
      "nfs",
      "vboxsf",
      "ramfs",
      "9p",
      "vfat"
    ],
    "_ansible_string_conversion_action": "warn",
    "_ansible_socket": "/home/kuba/.ansible/pc/c92e282e64",
    "_ansible_shell_executable": "/bin/sh",
    "_ansible_keep_remote_files": true,
    "_ansible_tmpdir": "/home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/",
    "_ansible_remote_tmp": "~/.ansible/tmp"
  }
}

so the extra transport is present in the module input arguments (extra, the one we configure is in the provider` scope, it might be that the whole plugin community.network., not only community.network.ce_command, has some issue

you can remove this from args, and run the module again with execute, it would work 'better' :) not a fix, just a prove that it should work, when the extra transport is not injected externally

vi /home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/debug_dir/args

python /home/kuba/.ansible/tmp/ansible-tmp-1651153489.9478908-149575-68141174905975/AnsiballZ_ce_command.py execute

{"failed": true, "msg": "Command: display version, socket path /home/kuba/.ansible/pc/c92e282e64 does not exist or cannot be found. see troubleshooting socket path issues in the network debug and troubleshooting guide.", "invocatio
n": {"module_args": {"commands": ["display version"], "provider": {"host": "localhost", "port": 22, "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "transport": "cli", "ssh_keyf
ile": null, "use_ssl": null, "validate_certs": null, "timeout": null}, "match": "all", "retries": 10, "interval": 1, "wait_for": null}}}
ansibullbot commented 2 years ago

@Telur44: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

Please set the description of this issue with an appropriate template from: https://github.com/ansible/ansible/tree/devel/.github/ISSUE_TEMPLATE

click here for bot help

ansibullbot commented 2 years ago

@Telur44 This issue is waiting for you to provide the requested data in the description. Please edit the description or the issue will be closed.

click here for bot help

khalil-tabbal commented 7 months ago

Hi @Telur44 did you find a way to interact with Huawei S6730 switches ?

Best regards,