Ich benutze ansible cloudformation um Stack mit 20 Instanzen zu erstellen. Jetzt im ansible Ausgang kann ich nur die Instanz-IDs sehen.Wie kann ich ec2 instance ip von instance id in ansible
Jetzt, nachdem der Stapel erstellt wurde, möchte ich mit ihnen verbinden und konfigurieren, aber ich bin mir nicht sicher, wie thos ips oder hostnames von Instanz-ID erhalten können.
Cloudformation Ausgang ist wie dieser
{
"last_updated_time": null,
"logical_resource_id": "test2",
"physical_resource_id": "i-24tf97306",
"resource_type": "AWS::EC2::Instance",
"status": "CREATE_COMPLETE",
"status_reason": null
},
{
"last_updated_time": null,
"logical_resource_id": "test1",
"physical_resource_id": "i-6533184348",
"resource_type": "AWS::EC2::Instance",
"status": "CREATE_COMPLETE",
"status_reason": null
}
In der aktuellen Version ec2_remote_facts Öffentlichkeit nicht zur Verfügung stellt, hat es https: //github.com/ansible/ansible-modules-extras/pull/1509 – user3098466
ja , können Sie Fix lokal anwenden oder 'public_dns_name' verwenden –