-2

我需要做这样的事情:

domain: &domain example.com
ip: &ip 1.2.3.4
Address4: v=spf1 include:*domain ip4:*ip -all

我试过这个但没有用,它说有一个语法错误:

Address4: 'v=spf1 include:'*domain' ip4:'*ip' -all'

实现(我在 Ansible 中使用这些文件)似乎支持连接,例如这工作正常:

Address2: http://*domain # actually this doesn't work, I don't remember the exact example

有任何想法吗?

4

1 回答 1

-2

I don't exactly get why you're trying to concatinate in YAML, since Ansible uses jinja2 as a templating engine:

Defining variables in a vars file for Ansible (in YAML):

domain: example.com
ip: 1.2.3.4

Referencing variables (still in YAML):

Address4: v=spf1 include:{{ domain }} ip4:{{ ip }} -all

When you use the Address4 variable in the template module (I assume), it works the same way.

于 2014-06-09T12:44:47.903 回答