Ansible Tower 未在 ec2-remote-facts 模块中正确注册变量
Ansible Tower is not registering variable correctly in ec2-remote-facts module
当我不在 Ansible Tower 上 运行 ec2-remote-facts 模块时,它可以正常工作。下面的第一个示例(不使用 Tower)包括我在后续任务中使用的所有 block_device_mapping 信息。
这是我长期使用 Tower 的一个大问题 运行。我的代码对于这两个示例都是相同的。任何可以引导我走向正确方向的想法。
我唯一的想法是,由于它不是核心模块,因此 Ansible Tower 没有完美同步到模块的最新代码。但我很困惑。谢谢!
Ansible 版本 - ansible 2.2.0.0(运行宁 Ubuntu)
Ansible Tower 版本 - Tower 版本 3.0.3(运行ning on Centos)
---下面的例子----
-Ansible(不使用 Tower)-
ok: [localhost -> localhost] => {
"changed": false,
"instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": [
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": false,
"device_name": "/dev/sdb",
"status": "attached",
"volume_id": "vol-132312313212313"
},
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": true,
"device_name": "/dev/sda1",
"status": "attached",
"volume_id": "vol-123123123123"
},
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": false,
"device_name": "/dev/sdc",
"status": "attached",
"volume_id": "vol-123123123123"
}
],
"client_token": "",
"ebs_optimized": false,
"groups": [
{
"id": "sg-12312313",
"name": "n123123123
}
],
"hypervisor": "xen",
"id": "i-123123123123",
"image_id": "ami-123123123123",
"instance_profile": null,
"interfaces": [
{
"id": "eni-123123123",
"mac_address": "123123123"
}
],
"kernel": null,
"key_name": "my-v123123",
"launch_time": "2017-01-13T17:05:30.000Z",
"monitoring_state": "disabled",
"persistent": false,
"placement": {
"tenancy": "default",
"zone": "us-east-1b"
},
"private_dns_name": "ip-112312312",
"private_ip_address": "10.1.1.4",
"public_dns_name": "",
"public_ip_address": null,
"ramdisk": null,
"region": "us-east-1",
"requester_id": null,
"root_device_type": "ebs",
"source_destination_check": "true",
"spot_instance_request_id": null,
"state": "running",
"tags": {
"CurrentIP": "10.1.1.1.4",
"Name": "d1",
"Type": "d2"
},
"virtualization_type": "hvm",
"vpc_id": "vpc-123123123"
},
Ansible Tower(注意它缺少 block_device_mapping 代码块)
TASK [debug] **********************
ok: [localhost] => {
"db_id.instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"client_token": "",
"ebs_optimized": false,
"groups": [
{
"id": "sg-123123",
"name": "n123123123"
}
],
"hypervisor": "xen",
"id": "i-123123123",
"image_id": "ami-123123",
"instance_profile": null,
"interfaces": [
{
"id": "eni-123123123",
"mac_address": "123123123"
}
],
"kernel": null,
"key_name": "m123123",
"launch_time": "2017-01-13T17:05:30.000Z",
"monitoring_state": "disabled",
"persistent": false,
"placement": {
"tenancy": "default",
"zone": "us-east-1b"
},
"private_dns_name": "ip-1123123123123",
"private_ip_address": "10.1.1.4",
"public_dns_name": "",
"ramdisk": null,
"region": "us-east-1",
"requester_id": null,
"root_device_type": "ebs",
"source_destination_check": "true",
"spot_instance_request_id": null,
"state": "running",
"tags": {
"Name": "123123",
"Type": "123123"
},
"virtualization_type": "hvm",
"vpc_id": "vpc-123123123"
},
我猜你的 Tower box 上确实有旧的 Ansible 版本。
截至今天,官方 Ansible Tower Vagrant box(ansible/tower(virtualbox,3.0.3))内部有 ver 2.1.2:
[vagrant@ansible-tower ~]$ ansible --version
ansible 2.1.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
而ec2_remote_facts
在这个版本中没有block_device_mapping
。
因此,请在您的 Tower box 上更新 Ansible 或应用 this 补丁。
当我不在 Ansible Tower 上 运行 ec2-remote-facts 模块时,它可以正常工作。下面的第一个示例(不使用 Tower)包括我在后续任务中使用的所有 block_device_mapping 信息。
这是我长期使用 Tower 的一个大问题 运行。我的代码对于这两个示例都是相同的。任何可以引导我走向正确方向的想法。
我唯一的想法是,由于它不是核心模块,因此 Ansible Tower 没有完美同步到模块的最新代码。但我很困惑。谢谢!
Ansible 版本 - ansible 2.2.0.0(运行宁 Ubuntu)
Ansible Tower 版本 - Tower 版本 3.0.3(运行ning on Centos)
---下面的例子----
-Ansible(不使用 Tower)-
ok: [localhost -> localhost] => {
"changed": false,
"instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"block_device_mapping": [
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": false,
"device_name": "/dev/sdb",
"status": "attached",
"volume_id": "vol-132312313212313"
},
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": true,
"device_name": "/dev/sda1",
"status": "attached",
"volume_id": "vol-123123123123"
},
{
"attach_time": "2017-01-13T17:05:31.000Z",
"delete_on_termination": false,
"device_name": "/dev/sdc",
"status": "attached",
"volume_id": "vol-123123123123"
}
],
"client_token": "",
"ebs_optimized": false,
"groups": [
{
"id": "sg-12312313",
"name": "n123123123
}
],
"hypervisor": "xen",
"id": "i-123123123123",
"image_id": "ami-123123123123",
"instance_profile": null,
"interfaces": [
{
"id": "eni-123123123",
"mac_address": "123123123"
}
],
"kernel": null,
"key_name": "my-v123123",
"launch_time": "2017-01-13T17:05:30.000Z",
"monitoring_state": "disabled",
"persistent": false,
"placement": {
"tenancy": "default",
"zone": "us-east-1b"
},
"private_dns_name": "ip-112312312",
"private_ip_address": "10.1.1.4",
"public_dns_name": "",
"public_ip_address": null,
"ramdisk": null,
"region": "us-east-1",
"requester_id": null,
"root_device_type": "ebs",
"source_destination_check": "true",
"spot_instance_request_id": null,
"state": "running",
"tags": {
"CurrentIP": "10.1.1.1.4",
"Name": "d1",
"Type": "d2"
},
"virtualization_type": "hvm",
"vpc_id": "vpc-123123123"
},
Ansible Tower(注意它缺少 block_device_mapping 代码块)
TASK [debug] **********************
ok: [localhost] => {
"db_id.instances": [
{
"ami_launch_index": "0",
"architecture": "x86_64",
"client_token": "",
"ebs_optimized": false,
"groups": [
{
"id": "sg-123123",
"name": "n123123123"
}
],
"hypervisor": "xen",
"id": "i-123123123",
"image_id": "ami-123123",
"instance_profile": null,
"interfaces": [
{
"id": "eni-123123123",
"mac_address": "123123123"
}
],
"kernel": null,
"key_name": "m123123",
"launch_time": "2017-01-13T17:05:30.000Z",
"monitoring_state": "disabled",
"persistent": false,
"placement": {
"tenancy": "default",
"zone": "us-east-1b"
},
"private_dns_name": "ip-1123123123123",
"private_ip_address": "10.1.1.4",
"public_dns_name": "",
"ramdisk": null,
"region": "us-east-1",
"requester_id": null,
"root_device_type": "ebs",
"source_destination_check": "true",
"spot_instance_request_id": null,
"state": "running",
"tags": {
"Name": "123123",
"Type": "123123"
},
"virtualization_type": "hvm",
"vpc_id": "vpc-123123123"
},
我猜你的 Tower box 上确实有旧的 Ansible 版本。
截至今天,官方 Ansible Tower Vagrant box(ansible/tower(virtualbox,3.0.3))内部有 ver 2.1.2:
[vagrant@ansible-tower ~]$ ansible --version
ansible 2.1.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
而ec2_remote_facts
在这个版本中没有block_device_mapping
。
因此,请在您的 Tower box 上更新 Ansible 或应用 this 补丁。