我还在学Ansible。要通过客户端ip复制Ansible中的IP地址
东道主:
[servers]
192.168.0.1
192.168.0.18
192.168.0.19
192.168.0.23
192.168.0.129
192.168.0.130
192.168.0.149server.yml
---
- name: Create update alive crontab
hosts: servers
become: true
tasks:
- name: a crontab job
cron:
minute="0"
job="http://xx.xx.xx.xx/alive.php?ip=clientIP"如何改变每个人的clientIP在server.yml?
发布于 2018-12-26 16:30:44
您正在寻找变量ansible_host
job="http://xx.xx.xx.xx/alive.php?ip={{ ansible_host }“
见示例:
# ansible -m debug -a 'msg="{{ ansible_host }}"' localhost
localhost | SUCCESS => {
"msg": "127.0.0.1"
}https://stackoverflow.com/questions/53934402
复制相似问题