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

Unable to connect to BIG IP device using F5 module #2426

Open
corpslave69 opened this issue Aug 29, 2024 · 4 comments
Open

Unable to connect to BIG IP device using F5 module #2426

corpslave69 opened this issue Aug 29, 2024 · 4 comments

Comments

@corpslave69
Copy link

Playbook: main.yml

---
- name: Read-only operations on F5 BIG-IP
  hosts: f5
  connection: local
  vars:
    provider:
      server: "10.177.85.144"
      user: "user"
      password: "secret"
      validate_certs: "false"

  tasks:
    - name: run show version on remote devices
      bigip_command:
        provider: "{{ provider }}"
        commands: show sys version

Inventory:

[f5]
proxy ansible_host=10.177.85.144

I'm unable to connect to the BIG IP device using SSH. When I run this playbook, I receive this error:

URLError: <urlopen error Tunnel connection failed: 500 handshakefailed>\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1

Why is it trying to connect via HTTP instead of SSH when I have specified connection: local?

@pgouband
Copy link
Contributor

Hi @corpslave69,

By default it's going to use port 443 to reach out API endpoint as explained here https://clouddocs.f5.com/products/orchestration/ansible/devel/modules/bigip_command_module.html#bigip-command-module-3 on transport setup under provider.

You can specify cli transport in provider like the following:

    provider:
      server: "10.177.85.144"
      user: "user"
      password: "secret"
      validate_certs: "false"
      server_port: 22
      transport: cli

@corpslave69
Copy link
Author

Thanks @pgouband ! That resolved my issue but now I'm getting this:

Unexpected failure during module execution: [Errno 8] nodename nor servname provided, or not known

And I've verified that this device is reachable from the control node (My PC) and it's IP is resolvable. Also I am able to SSH to this device using username and password. (I'd also like to note that I've not set up SSH keypair with this device and the SSH login is done through keyboard interactive mode.)

Also is there any way I can add this ansible_ssh_common_args='-o StrictHostKeyChecking=no' parameter to the provider dictionary?

@pgouband
Copy link
Contributor

pgouband commented Aug 30, 2024

Hi @corpslave69,

I'm doing some test with CLI transport but I'm facing a different issue.
Why don't you want to use REST transport to execute tmsh command?

Also, regarding ansible_ssh_common_args='-o StrictHostKeyChecking=no', this can be added to inventory.
Here more information:
https://stackoverflow.com/questions/23074412/how-to-set-host-key-checking-false-in-ansible-inventory-file

@pgouband
Copy link
Contributor

pgouband commented Sep 5, 2024

Hi @corpslave69,

We did some tests with success.

network_cli should be set:

- name: Read-only operations on F5 BIG-IP
  hosts: all
  collections:
    - f5networks.f5_modules
  connection: network_cli

also host file should look like:

[default]
10.1.2.3 ansible_network_os=bigip ansible_user=root ansible_password=mypassword

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

No branches or pull requests

2 participants