blob: 9b19200cb0c27a5b6feb89b13150b3c0fa884b03 [file] [log] [blame]
sgudz64ca9812019-03-12 17:31:31 +02001| # All the data below will be stored as a string object
2 #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
3 ssh_pwauth: True
4 users:
5 - name: root
6 sudo: ALL=(ALL) NOPASSWD:ALL
7 shell: /bin/bash
8 ssh_authorized_keys:
9 {% for key in config.underlay.ssh_keys %}
10 - ssh-rsa {{ key['public'] }}
11 {% endfor %}
12
13 disable_root: false
14 chpasswd:
15 list: |
16 root:r00tme
17 expire: False
18
19 bootcmd:
20 # Enable root access
21 - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
22 - service sshd restart
23 output:
24 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
25
26 runcmd:
27 - if lvs vg0; then pvresize /dev/vda3; fi
28 - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
29
30 - export TERM=linux
31 - export LANG=C
32 # Configure dhclient
33 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
34 - sudo resolvconf -u
35
36 # Enable grub menu using updated config below
37 - update-grub
38
39 # Prepare network connection
40 - sudo ifup ens3
41 #- sudo route add default gw {gateway} {interface_name}
42
43 # Create swap
44 - fallocate -l 16G /swapfile
45 - chmod 600 /swapfile
46 - mkswap /swapfile
47 - swapon /swapfile
48 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
49 - service salt-minion restart
50 - sleep 2
51 - salt-call saltutil.refresh_pillar
52 - salt-call saltutil.sync_all
53 - salt-call state.sls linux.network
54 - salt-call state.sls linux.system.repo
55 - salt-call state.sls linux,openssh,salt.minion,ntp,rsyslog
56 - salt-call state.sls nova
57 - salt-call state.sls neutron
58 - salt-call state.highstate
59
60 write_files:
61 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
62 content: |
63 GRUB_RECORDFAIL_TIMEOUT=30
64 GRUB_TIMEOUT=3
65 GRUB_TIMEOUT_STYLE=menu
66
67 - path: /etc/salt/minion.d/minion.conf
68 content: |
69 master: ==SALT_MASTER_IP==
70 id: ==HOSTNAME.DOMAIN_NAME==
71
72 - path: /etc/network/interfaces
73 content: |
74 auto ens3
75 iface ens3 inet dhcp
76
77 - path: /usr/share/growlvm/image-layout.yml
78 content: |
79 root:
80 size: '80%VG'
81 home:
82 size: '1%VG'
83 var_log:
84 size: '5%VG'
85 var_log_audit:
86 size: '2%VG'
87 var_tmp:
88 size: '5%VG'
89 tmp:
90 size: '2%VG'
91 owner: root:root
92
93 growpart:
94 mode: auto
95 devices:
96 - '/'
97 - '/dev/vda3'
98 ignore_growroot_disabled: false