-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsalt-userdata.yml
74 lines (58 loc) · 2.58 KB
/
salt-userdata.yml
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#cloud-config
#
# Salt Master Cloud init config
#
# ALMOST SAME AS userdata.yml we’ll use for other nodes, BUT we’ll use 127.0.0.1 in resolv.conf and package includes salt-master
#
#
# To learn more about Cloud-Init details, refer to:
#
# Ref:
# - http://cloudinit.readthedocs.org/en/latest/topics/examples.html#call-a-url-when-finished
# - https://help.ubuntu.com/community/CloudInit
# - http://stackoverflow.com/questions/23411408/how-do-i-set-up-cloud-init-on-custom-amis-in-aws-centos
#
# Get current VM userdata (OpenStack internal API call accessible from any VM)
#
# curl http://169.254.169.254/openstack/2013-10-17/user_data
#
manage_etc_hosts: false # Has to be set to false for everybody. Otherwise we need a DNS
manage-resolv-conf: false
locale: en_US.UTF-8
timezone: America/New_York
package_upgrade: true
package_update: true
package_reboot_if_required: true
# This is run at EVERY boot, good to ensure things are at the right place
bootcmd:
- sysctl -w net.ipv6.conf.all.disable_ipv6=1
- grep -q -e 'nameserver' /etc/resolvconf/resolv.conf.d/head || printf "nameserver 127.0.0.1\n" >> /etc/resolvconf/resolv.conf.d/head
# For production, comment ^ and uncomment below
#- grep -q -e 'wpdn' /etc/resolvconf/resolv.conf.d/base || printf "search production.wpdn\ndomain production.wpdn\nnameserver 8.8.8.8" > /etc/resolvconf/resolv.conf.d/base
- grep -q -e 'wpdn' /etc/resolvconf/resolv.conf.d/base || printf "search production.wpdn\ndomain production.wpdn\nnameserver 8.8.8.8" > /etc/resolvconf/resolv.conf.d/base
- grep -q -e 'wpdn' /etc/resolv.conf || resolvconf -u
runcmd:
- sysctl -w net.ipv6.conf.all.disable_ipv6=1
- sed -i "s/127.0.0.1 localhost/127.0.1.1 $(hostname).staging.wpdn $(hostname)\n127.0.0.1 localhost/" /etc/hosts
#- sed -i "s/127.0.0.1 localhost/127.0.1.1 $(hostname).production.wpdn $(hostname)\n127.0.0.1 localhost/" /etc/hosts
- add-apt-repository -y ppa:saltstack/salt
- apt-get update
- apt-get -y upgrade
- apt-get -y autoremove
- apt-get -y upgrade salt-minion
write_files:
- encoding: b64
content: bGV2ZWw6IHN0YWdpbmc=
# For production, comment ^ and uncomment below
#content: bGV2ZWw6IHByb2R1Y3Rpb24=
path: /etc/salt/grains
# The content ^ contains a base64 encoded string that contains exactly "level:staging" (without quotes)
# it was meant to make sure that cloudinit wouldn’t break because it was taking previous attempts as part
# of the rest of this YAML document.
packages:
- salt-minion
- salt-common
- python-software-properties
- software-properties-common
- salt-master
# vim: et ts=2 sw=2 ft=yaml: