Content-Type: multipart/mixed; boundary="===============1598784645116016685==" MIME-Version: 1.0 --===============1598784645116016685== Content-Type: text/cloud-config; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cloud-config" runcmd: - setenforce 0 > /dev/null 2>&1 || true user: ec2-user cloud_config_modules: - locale - set_hostname - ssh - timezone - update_etc_hosts - update_hostname - runcmd # Capture all subprocess output into a logfile # Useful for troubleshooting cloud-init issues output: {all: '| tee -a /var/log/cloud-init-output.log'} --===============1598784645116016685== 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 import os import datetime def list_types(): return(["text/x-cfninitdata"]) def handle_part(data, ctype, filename, payload): if ctype == "__begin__": try: os.makedirs('/var/lib/heat-cfntools', 0700) except OSError as e: if e.errno != errno.EEXIST: raise return if ctype == "__end__": return with open('/var/log/part-handler.log', 'a') as log: timestamp = datetime.datetime.now() 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) --===============1598784645116016685== Content-Type: text/x-cfninitdata; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cfn-userdata" #ps1 Get-Date --===============1598784645116016685== Content-Type: text/x-shellscript; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="loguserdata.py" #!/usr/bin/env python import sys import os import subprocess import datetime import pkg_resources from distutils.version import LooseVersion import errno path = '/var/lib/heat-cfntools' def chk_ci_version(): v = LooseVersion(pkg_resources.get_distribution('cloud-init').version) return v >= LooseVersion('0.6.0') def create_log(path): fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0600) return os.fdopen(fd, 'w') def call(args, log): log.write('%s\n' % ' '.join(args)) log.flush() p = subprocess.Popen(args, stdout=log, stderr=log) p.wait() return p.returncode def main(log): if not chk_ci_version(): # pre 0.6.0 - user data executed via cloudinit, not this helper log.write('Unable to log provisioning, need a newer version of' ' cloud-init\n') return -1 userdata_path = os.path.join(path, 'cfn-userdata') os.chmod(userdata_path, 0700) log.write('Provision began: %s\n' % datetime.datetime.now()) log.flush() returncode = call([userdata_path], log) log.write('Provision done: %s\n' % datetime.datetime.now()) if returncode: return returncode if __name__ == '__main__': with create_log('/var/log/heat-provision.log') as log: returncode = main(log) if returncode: log.write('Provision failed') sys.exit(returncode) userdata_path = os.path.join(path, 'provision-finished') with create_log(userdata_path) as log: log.write('%s\n' % datetime.datetime.now()) --===============1598784645116016685== Content-Type: text/x-cfninitdata; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cfn-watch-server" http://67.207.197.36:8003 --===============1598784645116016685== Content-Type: text/x-cfninitdata; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cfn-metadata-server" http://67.207.197.36:8000 --===============1598784645116016685== Content-Type: text/x-cfninitdata; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cfn-boto-cfg" [Boto] debug = 0 is_secure = 0 https_validate_certificates = 1 cfn_region_name = heat cfn_region_endpoint = 67.207.197.36 cloudwatch_region_name = heat cloudwatch_region_endpoint = 67.207.197.36 --===============1598784645116016685==--