blob: d4915511b0a452203f73e9f2abbc30d12e19dee0 [file] [log] [blame]
sgudz850e6072018-06-05 14:46:53 +03001| # 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
4 ssh_pwauth: True
5 users:
6 - name: root
7 sudo: ALL=(ALL) NOPASSWD:ALL
8 shell: /bin/bash
9 ssh_authorized_keys:
10 {% for key in config.underlay.ssh_keys %}
11 - ssh-rsa {{ key['public'] }}
12 {% endfor %}
13
14 disable_root: false
15 chpasswd:
16 list: |
17 root:r00tme
18 expire: False
19
20 bootcmd:
21 # # Block access to SSH while node is preparing
22 # - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
23 # Enable root access
24 - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
25 - service sshd restart
26 output:
27 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
28
29 runcmd:
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020030 - if lvs vg0; then pvresize /dev/vda3; fi
31 - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
32
sgudz850e6072018-06-05 14:46:53 +030033 - export TERM=linux
34 - export LANG=C
35 # Configure dhclient
36 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
37 - sudo resolvconf -u
38
39 # Enable grub menu using updated config below
40 - update-grub
41
42 # Prepare network connection
43 - sudo ifup {interface_name}
44 #- sudo route add default gw {gateway} {interface_name}
45
46 # Create swap
47 - fallocate -l 4G /swapfile
48 - chmod 600 /swapfile
49 - mkswap /swapfile
50 - swapon /swapfile
51 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
52
53
54 ############## TCP Cloud cfg01 node ##################
55 #- sleep 120
56 # - echo "Preparing base OS"
57 - echo "nameserver 172.18.208.44" > /etc/resolv.conf;
58 # - which wget >/dev/null || (apt-get update; apt-get install -y wget)
59
60 # Configure Ubuntu mirrors
61 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial main restricted universe" > /etc/apt/sources.list
62 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial-updates main restricted universe" >> /etc/apt/sources.list
63 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial-security main restricted universe" >> /etc/apt/sources.list
64
65 # - echo "deb [arch=amd64] http://apt.mirantis.com/xenial {{ REPOSITORY_SUITE }} salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
66 # - wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
67 # - echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
68 # - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
69
70 # - apt-get clean
71 # - eatmydata apt-get update && apt-get -y upgrade
72
73 # Install common packages
74 # - eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
75
76 # Install salt-minion and stop it until it is configured
77 # - eatmydata apt-get install -y salt-minion && service salt-minion stop
78
79 # Install latest kernel
80 # - eatmydata apt-get install -y {{ os_env('LINUX_KERNEL_HWE_PACKAGE_NAME', 'linux-image-extra-4.10.0-42-generic') }}
81
82 ########################################################
83 # Node is ready, allow SSH access
84 #- echo "Allow SSH access ..."
85 #- sudo iptables -D INPUT -p tcp --dport 22 -j DROP
86 # - reboot
87 ########################################################
88
89 write_files:
90 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
91 content: |
92 GRUB_RECORDFAIL_TIMEOUT=30
93 GRUB_TIMEOUT=3
94 GRUB_TIMEOUT_STYLE=menu
95
96 - path: /etc/network/interfaces
97 content: |
98 # The loopback network interface
99 auto lo
100 iface lo inet loopback
101 auto {interface_name}
102 iface {interface_name} inet dhcp
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200103
104 - path: /usr/share/growlvm/image-layout.yml
105 content: |
106 root:
107 size: '50%VG'
108 home:
109 size: '100M'
110 var_log:
111 size: '15%VG'
112 var_log_audit:
113 size: '500M'
114 var_tmp:
115 size: '500M'
116 tmp:
117 size: '500M'
118 owner: root:root
119
120 growpart:
121 mode: auto
122 devices:
123 - '/'
124 - '/dev/vda3'
125 ignore_growroot_disabled: false