Skip to content

Instantly share code, notes, and snippets.

@strigazi
Created October 9, 2019 15:14
Show Gist options
  • Save strigazi/6099e56422d348e46031d2452232395e to your computer and use it in GitHub Desktop.
Save strigazi/6099e56422d348e46031d2452232395e to your computer and use it in GitHub Desktop.
Content-Type: multipart/mixed; boundary="===============0805081514788562408=="
MIME-Version: 1.0
--===============0805081514788562408==
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config"
# Capture all subprocess output into a logfile
# Useful for troubleshooting cloud-init issues
output: {all: '| tee -a /var/log/cloud-init-output.log'}
--===============0805081514788562408==
Content-Type: text/cloud-boothook; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="boothook.sh"
#!/bin/bash
# FIXME(shadower) this is a workaround for cloud-init 0.6.3 present in Ubuntu
# 12.04 LTS:
# https://bugs.launchpad.net/heat/+bug/1257410
#
# The old cloud-init doesn't create the users directly so the commands to do
# this are injected though nova_utils.py.
#
# Once we drop support for 0.6.3, we can safely remove this.
# in case heat-cfntools has been installed from package but no symlinks
# are yet in /opt/aws/bin/
cfn-create-aws-symlinks
# Do not remove - the cloud boothook should always return success
exit 0
--===============0805081514788562408==
Content-Type: text/part-handler; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="part-handler.py"
# part-handler
#
# 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.
import datetime
import errno
import os
import sys
def list_types():
return(["text/x-cfninitdata"])
def handle_part(data, ctype, filename, payload):
if ctype == "__begin__":
try:
os.makedirs('/var/lib/heat-cfntools', int("700", 8))
except OSError:
ex_type, e, tb = sys.exc_info()
if e.errno != errno.EEXIST:
raise
return
if ctype == "__end__":
return
timestamp = datetime.datetime.now()
with open('/var/log/part-handler.log', 'a') as log:
log.write('%s filename:%s, ctype:%s\n' % (timestamp, filename, ctype))
if ctype == 'text/x-cfninitdata':
with open('/var/lib/heat-cfntools/%s' % filename, 'w') as f:
f.write(payload)
# TODO(sdake) hopefully temporary until users move to heat-cfntools-1.3
with open('/var/lib/cloud/data/%s' % filename, 'w') as f:
f.write(payload)
--===============0805081514788562408==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename
{
"ignition": { "version": "3.0.0" },
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Run heat-container-agent\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nExecStartPre=mkdir -p /var/lib/heat-container-agent\nExecStartPre=mkdir -p /var/run/heat-config\nExecStartPre=mkdir -p /var/run/os-collect-config\nExecStartPre=mkdir -p /opt/stack/os-config-refresh\nExecStartPre=mkdir -p /srv/magnum\nExecStartPre=-/bin/podman rm -f heat-container-agent\nExecStart=/bin/podman run \\\n --name heat-container-agent \\\n --privileged \\\n --volume /srv/magnum:/srv/magnum \\\n --volume /opt/stack/os-config-refresh:/opt/stack/os-config-refresh \\\n --volume /run/systemd:/run/systemd \\\n --volume /etc/:/etc/ \\\n --volume /var/lib:/var/lib \\\n --volume /var/run:/var/run \\\n --volume /var/log:/var/log \\\n --volume /tmp:/tmp \\\n --volume /dev:/dev \\\n --net=host \\\n docker.io/openstackmagnum/heat-container-agent:train-dev \\\n /usr/bin/start-heat-container-agent\n\nExecStop=/bin/podman stop heat-container-agent\n\n[Install]\nWantedBy=multi-user.target\n",
"enabled": true,
"name": "heat-container-agent.service"
}
]
},
"storage": {
"files": [
{
"filesystem": "root",
"path": "/etc/hostname",
"mode": 420,
"contents": { "source": "data:,strigazi-coreos-004" }
}
]
},
"passwd": {
"users": [
{
"name": "fedora",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAlKi4GIqp9BG9buHOziaL0TeW7bHrd+nVkhuW8BNQC5H4VPj2AJXq2d/2UrRRrdLFiQTEKuPFWhwYw3GzTYq8fZTMVjU7buIbqKx5xCa//k7htNIwNRj5ao/6B3sBubQUI+jeDmDil/sRgL9lfC77eqVFr5G7SGmKWBm+3rGYkPu6M1xFmeodpLeuwIhBj2rfiP+cU6nacnpIgp/FjVSilmEW94yuf1g7RwkeYlu6nEas1SHXI0Lf50lEwiY322prlrhzgOTnEo6cpFwZjM4L+ih1enLAhHRc5QsfArP3M2Jn9LEKy5t9BLgIHfEimTTM7eTjHm9t2hSoUTT6Ts/w0Q== [email protected]"
]
}
]
}
}
--===============0805081514788562408==
Content-Type: text/x-cfninitdata; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cfn-init-data"
{"os-collect-config": {"heat": {"password": "***", "user_id": "***", "region_name": "cern", "stack_id": "strigazi-coreos-004/691c9ab8-9e88-4cf6-8cd3-d8ecf0037762", "resource_name": "kube-master", "auth_url": "***", "project_id": "***"}, "collectors": ["ec2", "heat", "local"]}, "deployments": []}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment