【发布时间】:2020-07-13 06:58:21
【问题描述】:
我想使用 Ansible 以某种方式将以下条目插入到 /etc/hosts 文件中。
10.33.5.44 ip-10-33-5-44
这里的架构是 ip 应该有一个对应于 IP 的别名,前缀为 ip-,其中点 . 将替换为破折号 -。
但要获得这个 IP,我只能考虑对 DNS 名称执行主机命令,例如
host euwest2-test-box.company.com
> euwest2-test-box.company.com has address 10.33.5.44
谁能建议如何让它发挥作用?有可能吗?
【问题讨论】:
-
所以你只想在你的主机中创建一个别名,前缀为
ip-? -
是的,以 ip- 为前缀,也将点替换为“-”
标签: ansible