0

I'd like to pass configuration file to an instance through metadata. Currently for testing purposes I'm just concatenating text inside the blueprint, like this:

RE_vm:
    type: cloudify.openstack.nodes.Server
    properties:
      resource_id: { concat: ['router_cp_', { get_input: client_name }] }
      server:
        image: { get_input: re_image }
        flavor: { get_input: re_flavor }
        key_name: ''
      install_agent: false
      openstack_config: *openstack_config
    interfaces:
      cloudify.interfaces.lifecycle:
        create:
          inputs:
            args:
              meta:
                hostname: { concat: ['vMX-RE-', { get_input: client_name }] }
                (...)
              files:
                "/var/db/configfile": { concat: ["groups {\n
    re0 {\n
        system {\n
            host-name %hostname%;\n
        }\n
        interfaces {\n
            unit 0 {\n
                address ", { get_attribute: [left_port, fixed_ip_address] }, "/", { get_input: left_network_mask }, ";\n
            }\n
        }\n
    }\n
    global {\n
        system {\n
            root-authentication {\n
                encrypted-password \"", { get_secret: encrypted_password }, "\"; ## SECRET-DATA\n
            }\n
        }\n
    }\n
}\n
 "]}
    relationships:
      - target: mgmt_port
        type: cloudify.openstack.server_connected_to_port

But for real-life use, this is not feasible. How can I point to an external file and pass it to the instance?

I haven't found any apparent way of doing that in the documentation.

And preferably I'd like to dynamically fill some variables, based on inputs or some rules (like in Ansible templates). How can I do that with Cloudify?

daro
  • 39
  • 6

1 Answers1

0

If I understand correctly what you are asking for, you can either use SSH connection to the VM (using fabric plugin) and upload the file or it's content to the VM; Or you could use the cloudify-utilities-plugin and use the configuration plugin for this.

For dynamically filling the inputs, you can change the inputs value when creating the deployment, inputs could be in a file (with file changed per deployment), or added to the cfy deployment create as variables, in cmd line or UI.