9
我認爲這是產生錯誤的劇本的一部分。我應該如何重寫這部分?Ansible:[棄權警告]:不推薦使用裸變量
roles:
- role: json-transform
json_transforms: '{{ clientValidation.json_transforms}}'
它拋出以下警告:
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{json_transforms}}'). This feature will be removed in a
future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
你正在使用什麼Ansible版本?這個語法對我來說看起來有點奇怪,通常我會用類似於''{{role:json-transform,json_transforms:'{{clientValidation.json_transforms}}'}'的方式去做,所以你可能想嘗試一下。 – ydaetskcoR
我正在使用Ansible 2.0.1 我已經嘗試了您提到的內容,但無法正常工作。 – anuiq
語法無關緊要 - @ydaetskcoR僅使用內聯詞典語法而不是擴展的yaml詞典語法。它們在解析的文檔中完全一樣。 – nitzmahone