哈希部署环境到子网

时间:2016-01-26 12:44:18

标签: python ansible

我有

deployment: dev
subnet: "{{ hash(deployment) % 255 }}"

在我的group_vars/localhost中设置ec2主机。但是,这给了我

fatal: [localhost]: FAILED! => {"failed": true, "msg": "ERROR! ERROR! 'hash' is undefined"}

从部署环境生成子网的更好方法是什么?

1 个答案:

答案 0 :(得分:0)

通过

解决
subnet: "{{ deployment|hash|int(base=16) % 255 }}"
相关问题