forked from sjones4/euca-me
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloud-config.yaml
28 lines (28 loc) · 1.08 KB
/
cloud-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#cloud-config
packages:
- httpd
write_files:
- path: /etc/httpd/conf/httpd.conf
owner: root:root
permissions: '0644'
content: |@@HTTPD_CONF@@
- path: /etc/pdns/pdns.conf
owner: root:root
permissions: '0644'
content: |@@PDNS_CONF@@
- path: /opt/euca-me.py
owner: root:root
permissions: '0755'
content: |@@EUCA-ME_PY@@
runcmd:
- yum -y -t --enablerepo epel install pdns pdns-backend-pipe
- chkconfig --level 345 httpd on
- service httpd start
- aws ec2 describe-addresses --output text --region us-west-1 --filter Name=tag:Name,Values=euca.me | cut -f 2 > /tmp/eipalloc.txt
- wget -q -O - http://169.254.169.254/latest/meta-data/instance-id > /tmp/instance-id.txt
- aws ec2 associate-address --region us-west-1 --allow-reassociation --instance-id $(</tmp/instance-id.txt) --allocation-id $(</tmp/eipalloc.txt)
- sleep 10
- wget -q -O - http://169.254.169.254/latest/meta-data/public-ipv4 > /tmp/public-ipv4.txt
- sed --in-place "s/127.0.0.1/$(</tmp/public-ipv4.txt)/" /opt/euca-me.py
- chkconfig --level 345 pdns on
- service pdns start