尝试构建与属性匹配的服务器列表(在本例中为ec2_tag),以便为特定任务调度特定服务器.
我正在尝试与selectattr匹配:
servers: "{{ hostvars[inventory_hostname]|selectattr('ec2_tag_Role','match','cassandra_db_seed_node') | map(attribute='inventory_hostname') |list}}"
虽然我从Ansible得到了类似错误:
fatal: [X.X.X.X]: Failed! => {"Failed": true,"msg": "Unexpected templating type error occurred on ({{ hostvars[inventory_hostname]|selectattr('ec2_tag_Role','cassandra_db_seed_node') | map(attribute='inventory_hostname') |list}}): expected string or buffer"}
我在这里错过了什么?