使用Ansible通过SSH Tunn配置F5

2024-05-15 23:56:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前在通过SSH Bastion主机运行Ansible F5 playbook来配置F5设备时遇到了一个问题,不确定这个问题可能在这个阶段出现在哪里。在

BIGSUDS,SUDS,F5-SDK都是通过pip安装的

我的剧本 ---5楼播放.yml----在

---
- hosts: f5_devices
  gather_facts: false
  connection: local

  tasks:
  - name: f5 test
    bigip_facts:
      server: "{{ inventory_hostname }}"
      user: "{{ ansible_user }}"
      password: "{{ ansible_ssh_pass }}"
      include: "interface"
      validate_certs: false
    delegate_to: localhost
    register: out

  - debug: msg= "{{ out }}"

我有一个“group\u vars”目录和一个包含金库.yml以及变量.yml在

在变量.yml包含我额外的代理信息,要在跳转到f5之前跳过中间ssh主机,它已经成功地与这个设置一起使用,然后才能到达Cisco设备。在


库存文件=ansible_主机

^{pr2}$

在--变量.yml--在

ansible_ssh_pass: "{{ vault_ansible_ssh_pass }}"
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -v bastion1" -o 
StrictHostKeyChecking=no'

ansible playbook-iAnsible_主机f5播放.yml--询问保险库通行证-vvv

更新-添加了“delegate_to:localhost” 现在,还是这个错误

            "session": false,
            "state": "present",
            "user": "admin",
            "validate_certs": false
        }
    },
    "msg": "received exception: <urlopen error [Errno -2] Name or service 
not known>\ntraceback: Traceback (most recent call last):\n  File 
\"/tmp/ansible_cdaERk/ansible_module_bigip_facts.py\", line 1664, in main\n    
saved_active_folder = f5.get_active_folder()\n  File 
\"/tmp/ansible_cdaERk/ansible_module_bigip_facts.py\", line 148, in 
get_active_folder\n    return self.api.System.Session.get_active_folder()\n  
File \"/home/mike/Proj/ansible/lib/python2.7/site-packages/bigsuds.py\", 
line 360, in __getattr__\n    client = self._client_creator('%s.%s' % 
(self._name, attr))\n  File \"/home/mike/Proj/ansible/lib/python2.7/site-
packages/bigsuds.py\", line 170, in _create_client\n    raise 
ConnectionError(str(e))\nConnectionError: <urlopen error [Errno -2] Name or 
service not known>\n"
}

在虚拟环境中运行是虚拟的

如有任何帮助,我们将不胜感激


Tags: inpyfalseymllineansiblefolderf5
1条回答
网友
1楼 · 发布于 2024-05-15 23:56:02

我想,你应该:

  • 删除connection: local
  • 删除f5_devices组的ssh和代理设置
  • bastion1主机添加到您的库存中
  • 然后delegate_to: bastion1

{f5>你的设备将从这里连接到目标模块。在

相关问题 更多 >