Hi all
Got a weird issue where I’m trying upload a bash script as user-data - via the launch config module.
Any help regarding this is appreciated - even if it’s a method of debugging this - there are no errors which is why I’m confused.
I’m sucking in the user-data as a file which seems fine as ansible reports no errors.
However, the instance launched doesn’t show any user-data as registered and the launch config web console does not tell me anything about my file.
The output from ansible is below:
`
TASK: [lc | Launch Configs] ***************************************************
ok: [localhost] => (item={‘instance_type’: u’t2.small’, ‘lc_security_groups’: u’sg-b1423ad4’, ‘image_id’: u’ami-edfd6e9a’, ‘lc_name’: ‘OpenVPNAS’, ‘assign_public_ip’: True, ‘user_data’: u’#!/bin/bash\n\n# Setup the ansible repo\napt-get install software-properties-common\napt-add-repository ppa:ansible/ansible\n# Refresh apt\napt-get update\n# Install ansible\napt-get install ansible\n# Setup env vars\necho “localhost” > ~/ansible_hosts\nexport ANSIBLE_HOSTS=~/ansible_hosts\n# Setup ssh for git pull\nmkdir /root/.ssh\n\nSSH_PRIV=“-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAyb2wJh.SSH-KEY-REMOVED-BY-STPHEN…RuzLaDA==\n-----END RSA PRIVATE KEY-----”\nKNOWN_HOSTS='github.com,192.30.252.128 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='\n\necho $SSH_PRIV > /root/.ssh/id_rsa\nchmod 600 /root/.ssh/id_rsa\n\necho $KNOWN_HOSTS > /root/.ssh/known_hosts\nchmod 644 /root/.ssh/known_hosts\nchown -R root /root/.ssh\n\nansible-pull -C master -U git://github.com/trainsmart/ansible.git -d /root/ansible\nexit 0’})
`
When I ssh to the launched instance, there is nothing in cloud-init to tell me that any user data is present:
`
root@ip-172-16-0-125:/var/lib/cloud/instances/i-5b761dbd# cat user-data.txt
root@ip-172-16-0-125:/var/lib/cloud/instances/i-5b761dbd#
`
I’m wondering if I need to supply the file in some format other than “normal” but the ec2_lc module documentation isn’t very explicit about this. From what I read, you just need to supply the file as a “normal” text file, not a mime formatted blob.
ansible version: ansible 1.8.4
environment: OSX Yosemite
Any help regarding this is appreciated - even if it’s a method of debugging this - there are no errors which is why I’m confused.