所以我有一个如下所示的变量:
app_settings:
- category: "system.social"
setting: "facebook"
value: "{{ lookup('file', '{{inventory_dir}}/app-settings/system_social_facebook.content') }}"
- category: "system.social"
setting: "google"
value: "{{ lookup('file', '{{inventory_dir}}/app-settings/system_social_google.content') }}"
所以,如何将额外的变量传递给ansible塔作业模板是通过使用curl命令的脚本,如下所示:
curl -lk -u $ _user:$ password -H'Content-Type:application / json'-XPOST -d()“ extra_vars”:“ --- \ nvarname = var_value”
如何将多值变量传递给awx模板的curl命令?
app_settings: {{ category: 'system.social', setting: 'facebook', value: '{{ lookup('file', 'roles/app-settings-provision/templates/system_social_facebook.content') }}' },{ category: 'system.social', setting: 'google', value: '{{ lookup('file', 'roles/app-settings-provision/templates/system_social_google.content') }}' }, { category: 'system.social', setting: 'linkedIn', value: '{{ lookup('file', 'roles/app-settings-provision/templates/system_social_linkedin.content') }}' }