我有
deployment: dev
subnet: "{{ hash(deployment) % 255 }}"
在我的group_vars/localhost
中设置ec2主机。但是,这给了我
fatal: [localhost]: FAILED! => {"failed": true, "msg": "ERROR! ERROR! 'hash' is undefined"}
从部署环境生成子网的更好方法是什么?
答案 0 :(得分:0)
通过
解决subnet: "{{ deployment|hash|int(base=16) % 255 }}"