是否可以在自定义端口和代理转发上使用带有堡垒的Kubespray?如果不支持,需要做哪些更改?
发布于 2018-08-18 09:23:53
始终如此,因为您可以在三个不同的级别进行配置:通过主机用户的~/.ssh/config,通过带有group_vars的整个剧本,或者作为内联配置(即,在命令行上或在清单文件中)。
ssh配置希望是简单的:
Host 1.2.* *.example.com # or whatever pattern matches the target instances
ProxyJump someuser@some-bastion:1234
# and then the Agent should happen automatically, unless you mean
# ForwardAgent yes接下来我将讨论内联配置,因为它更简单一些:
ansible-playbook -i whatever \
-e '{"ansible_ssh_common_args": "-o ProxyJump=\"someuser@jump-host:1234\""}' \
cluster.yaml或者以同样的方式通过清单:
master-host-0 ansible_host=1.2.3.4 ansible_ssh_common_args="-o ProxyJump='someuser@jump-host:1234'"或者通过group_vars,您可以将其添加到现有的group_vars/all.yml中,或者如果不存在,则创建包含all.yml文件的group_vars目录,作为包含清单文件的目录的子级
如果您的ssh配置比您希望在清单/命令行/group_vars中编码的更复杂,您还可以通过ansible_ssh_extra_args变量指示ansible调用的ssh使用专用的配置文件:
ansible-playbook -e '{"ansible_ssh_extra_args": "-F /path/to/special/ssh_config"}' ...发布于 2019-05-16 01:13:38
在我需要访问特定端口上的主机的情况下,我只需将主机的~/.ssh/config修改为:
Host 10.40.45.102
ForwardAgent yes
User root
ProxyCommand ssh -W %h:%p -p 44057 root@example.com
Host 10.40.45.104
ForwardAgent yes
User root
ProxyCommand ssh -W %h:%p -p 44058 root@example.com其中10.40.*是内部IP。
https://stackoverflow.com/questions/51897569
复制相似问题