作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我根据 this tutorial 创建了我的第一个 ansible playbook ,所以它看起来像这样:
---
- hosts: hostb
tasks:
- name: Create file
file:
path: /tmp/yallo
state: touch
- hosts: my_hosts
sudo: yes
tasks:
- name: Create user
user:
name: mario
shell: /bin/zsh
- name: Install zlib
yum:
name: zlib
state: latest
[my_hosts]
hostA
hostB
ssh: Could not resolve hostname hostb: Name or service not known
最佳答案
好的,所以 Ansible list 可以基于以下格式:
IP Address
DHCP or Hosts file hostname reference localhost/cassie.local
hostname ansible_host=IP Address
[group_name]
Example
# Grouping
[test-group]
# IP reference
192.168.1.3
# Local hosts file reference
localhost
# Create your own alias
test ansible_host=192.168.1.4
# Create your alias with port and user to login as
test-2 ansible_host=192.168.1.5 ansible_port=1234 ansible_user=ubuntu
Grouping of hosts will only end when the end of file or another group detected. So if you wish to have hosts that don't belong to a group, make sure they're defined above the group definition.
test-group
,如果你遵循;它将在所有主机上执行:
ansible test-group -u ubuntu -m ping
关于ssh - "Could not resolve hostname"Ansible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47616861/
我是一名优秀的程序员,十分优秀!