{# Copyright 2016 Rackspace
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-#}
#cloud-config
# vim: syntax=yaml
#
# This configuration with take user-data dict and build a cloud-init
# script utilizing the write_files module. The user-data dict should be a
# Key Value pair where the Key is the path to store the file and the Value
# is the data to store at that location
#
# Example:
#     {'/root/path/to/file.cfg': 'I'm a file, write things in me'}
write_files:
{%-  for key, value in user_data.items() %}
-   path: {{ key }}
    content: |
        {{ value|indent(8) }}
{%- endfor -%}

{# restart agent now that configurations are in place #}
runcmd:
-   service amphora-agent restart
