[Openstack] Access the floating ip address in heat

Davíð Örn Jóhannsson davidoj at siminn.is
Mon May 9 12:04:39 UTC 2016


I’m trying to access the floating ip assigned to an instance created with a heat template and write it to file during creation of the instance, my approach is not working and I’m wondering if anyone has any suggestions on how I could archive this.

    server:
        type: OS::Nova::Server
        properties:
            name: { get_param: server_name }
            image: { get_param: image }
            flavor: { get_param: flavor }
            key_name: { get_param: key_name }
            scheduler_hints:
                group: {get_param: server_group }
            admin_user: { get_param: admin_user }
            networks:
              - port: { get_resource: test_data_server_port }
            user_data_format: RAW
            user_data:
                str_replace:
                    template: |
                        #!/bin/bash -v
                        echo '127.0.0.1 $SERVER_NAME' >> /etc/hosts
                        echo $PROJECT_ID > /etc/project_id
                        echo $FLOATING_IP > /etc/floating_ip

                    params:
                        $SERVER_NAME: { get_param: server_name }
                        $PROJECT_ID: { get_param: 'OS::project_id' }
                        $FLOATING_IP: { get_param: 'OS::Nova::FloatingIP' }

    test_data_server_port:
        type: OS::Neutron::Port
        properties:
            network_id: { get_param: private_net_id }
            security_groups: [{ get_param: test_security_group }, default]
            replacement_policy: AUTO

    association:
        type: OS::Nova::FloatingIPAssociation
        properties:
            floating_ip: { get_resource: floating_ip }
            server_id: { get_resource: test_server }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20160509/afc6b9ea/attachment.html>


More information about the Openstack mailing list