Ansible 2.7 Multi Line ansible_managed



Python3

安斯布尔 2.7

有没有人在他们的ansible中有一个多行ansible_managed行的例子.cfg ?

在安斯布尔的旧时代,我能够做到...

ansible_managed = "############################# Dev Team Back Again By: {uid} on {host} Using template: {file} #############################"

现在它一定是固定的,因为它在第二行之后切断了。

我可以让你大部分时间到达那里(如果你不被#束缚,一直到(:

ansible_managed =
+++++++++++++++++++++++++++++
Dev Team Back Again
By: {uid} on {host}
Using template: {file}
+++++++++++++++++++++++++++++

会给你输出:

+++++++++++++++++++++++++++++
Dev Team Back Again
By: redacted_user on redacted_host
Using template: b'/Users/redacted_user/./template.yml'
+++++++++++++++++++++++++++++

#字符需要引用。

除了 ' 和 " 之外,还有许多字符是特殊的(或保留的(,不能用作不带引号的标量的第一个字符:[] {}> |* & !% # ` @ ,.

在您的示例中,这本来可以正常工作,但是无论进行什么更改都是不可能的。 您可以在包含#的每行两边加上引号,但它会将它们添加到输出中。

例如:

"###########################"
Dev Team Back Again
By: redacted_user on redacted_host
Using template: b'/Users/redacted_user/./template.yml'
"###########################"

https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html

最新更新