本文介绍了Playbook中的Ansible Change SSH端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是库存文件
---
[de-servers]
192.26.32.32
[uk-servers]
172.21.1.23
172.32.2.11
我的剧本看起来像这样:
and my playbook is look like this:
- name: Install de-servers configurations
hosts: de-servers
roles:
- de-server-setup
- name: Install uk-servers configurations
hosts: uk-servers
roles:
- uk-server-setup
- name: Do some other job on de-servers (cannot be done until uk-servers is installed)
hosts: de-servers
roles:
- de-servers-rest-of-jobs
在角色de-servers-setup角色中,ssh端口从22更改为8888,因此在调用最后一个任务时失败,因为它无法通过22端口连接到主机. 如何克服此ssh端口更改?
In role de-servers-setup role the ssh port is changed from 22 to 8888, so when the last task is called it fails because it cannot connect to host through 22 port. How to overcome this ssh port change?
推荐答案
在角色de-server-setup
中添加任务以更改ansible_port
主机变量.
In the role de-server-setup
add a task to change the ansible_port
host variable.
- name: Change ssh port to 8888
set_fact:
ansible_port: 8888
这篇关于Playbook中的Ansible Change SSH端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!