Ansible AXW 忽略 extra_vars
Ansible AXW ignores extra_vars
我想通过 AWX-API 启动一个作业模板,包括一些 extra_vars,但我收到的每个响应都有一个空的 extra_vars 字段。我已经检查了有关它的文档:
https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#extra-variables
其中指出,您必须设置 ask_variables_on_launch: true
and/or 在调查中具有相应的变量。我的请求检查了这两个条件:
请求
POST: https://my.awx.host/api/v2/job_templates/7/launch/
正文
{
"can_start_without_user_input": false,
"passwords_needed_to_start": [],
"ask_scm_branch_on_launch": false,
"ask_variables_on_launch": true,
"ask_tags_on_launch": false,
"ask_diff_mode_on_launch": false,
"ask_skip_tags_on_launch": false,
"ask_job_type_on_launch": false,
"ask_limit_on_launch": false,
"ask_verbosity_on_launch": false,
"ask_inventory_on_launch": false,
"ask_credential_on_launch": false,
"survey_enabled": true,
"variables_needed_to_start": [
"application_server_name",
"server_location",
"application_server_type",
"ssh_keys"
],
"credential_needed_to_start": false,
"inventory_needed_to_start": false,
"job_template_data": {
"name": "template name ",
"id": 7,
"description": ""
},
"defaults": {
"extra_vars": {
"application_server_name": "some name",
"server_location": "some location",
"application_server_type": "some type",
"ssh_keys": [
{
"name": "key1"
},
{
"name": "key2"
},
{
"name": "key3"
}
]
},
"diff_mode": false,
"limit": "",
"job_tags": "",
"skip_tags": "",
"job_type": "run",
"verbosity": 2,
"inventory": {
"name": "AWX Tower (Localhost) my.awx.host",
"id": 1
},
"credentials": [
{
...
}
],
"scm_branch": ""
}}
回应
{
"variables_needed_to_start": [
"'application_server_name' value missing",
"'server_location' value missing",
"'application_server_type' value missing",
"'ssh_keys' value missing"
]}
我有点困惑,因为我根据文档做了所有事情。调查所需的值甚至在同一个 Request Body 中。有人可以帮忙解决这个问题吗?
我正在使用 AWX 16.0.0
Ansible 版本 2.9.15
谢谢
所以实际上,您只需发送额外的变量,而不是您从 AWX 获得的整个响应 + 变量。我不知道,如果我没有在文档中看到它,或者它是否很明显但我没有明白。
ask_variables_on_launch还是要真!
我想通过 AWX-API 启动一个作业模板,包括一些 extra_vars,但我收到的每个响应都有一个空的 extra_vars 字段。我已经检查了有关它的文档: https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#extra-variables
其中指出,您必须设置 ask_variables_on_launch: true
and/or 在调查中具有相应的变量。我的请求检查了这两个条件:
请求
POST: https://my.awx.host/api/v2/job_templates/7/launch/
正文
{
"can_start_without_user_input": false,
"passwords_needed_to_start": [],
"ask_scm_branch_on_launch": false,
"ask_variables_on_launch": true,
"ask_tags_on_launch": false,
"ask_diff_mode_on_launch": false,
"ask_skip_tags_on_launch": false,
"ask_job_type_on_launch": false,
"ask_limit_on_launch": false,
"ask_verbosity_on_launch": false,
"ask_inventory_on_launch": false,
"ask_credential_on_launch": false,
"survey_enabled": true,
"variables_needed_to_start": [
"application_server_name",
"server_location",
"application_server_type",
"ssh_keys"
],
"credential_needed_to_start": false,
"inventory_needed_to_start": false,
"job_template_data": {
"name": "template name ",
"id": 7,
"description": ""
},
"defaults": {
"extra_vars": {
"application_server_name": "some name",
"server_location": "some location",
"application_server_type": "some type",
"ssh_keys": [
{
"name": "key1"
},
{
"name": "key2"
},
{
"name": "key3"
}
]
},
"diff_mode": false,
"limit": "",
"job_tags": "",
"skip_tags": "",
"job_type": "run",
"verbosity": 2,
"inventory": {
"name": "AWX Tower (Localhost) my.awx.host",
"id": 1
},
"credentials": [
{
...
}
],
"scm_branch": ""
}}
回应
{
"variables_needed_to_start": [
"'application_server_name' value missing",
"'server_location' value missing",
"'application_server_type' value missing",
"'ssh_keys' value missing"
]}
我有点困惑,因为我根据文档做了所有事情。调查所需的值甚至在同一个 Request Body 中。有人可以帮忙解决这个问题吗?
我正在使用 AWX 16.0.0 Ansible 版本 2.9.15 谢谢
所以实际上,您只需发送额外的变量,而不是您从 AWX 获得的整个响应 + 变量。我不知道,如果我没有在文档中看到它,或者它是否很明显但我没有明白。
ask_variables_on_launch还是要真!