我使用的是ansible 2.1.0。我正在查看此页面http://ryaneschinger.com/blog/securing-a-server-with-ansible/并运行以下部分的剧本:
- name: Add authorized keys for deploy user
authorized_key: user={{ username }}
key="{{ lookup('file', item) }}"
with_items: public_keys
当我运行时,我得到[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{public_keys}}').
有什么不被弃用的方法呢?
答案 0 :(得分:3)
正如documentation中所述,with_循环中的裸变量应改为使用“{{var}}”语法,这有助于消除歧义。
所以,它只是告诉你改变这个:
with_items: public_keys
到此:
with_items: "{{ public_keys }}"