blob: dd34ede714ec724c9a06fb59602f0746e32dabc7 [file] [log] [blame]
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +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 # - sed -i -e '/^PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
26 - service sshd restart
27 output:
28 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
29
30 runcmd:
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020031 - if lvs vg0; then pvresize /dev/vda3; fi
32 - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
33
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030034 - export TERM=linux
35 - export LANG=C
36 # Configure dhclient
37 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
38 - sudo resolvconf -u
39
40 # Enable grub menu using updated config below
41 - update-grub
42
43 # Prepare network connection
44 - sudo ifup {interface_name}
45 #- sudo route add default gw {gateway} {interface_name}
46
47 # Create swap
Dmitry Tyzhnenko7c7b7d82018-07-20 15:35:07 +030048 # - fallocate -l 4G /swapfile
49 # - chmod 600 /swapfile
50 # - mkswap /swapfile
51 # - swapon /swapfile
52 # - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030053
54
55 ############## TCP Cloud cfg01 node ##################
56 #- sleep 120
57 # - echo "Preparing base OS"
58 - echo "nameserver 172.17.41.2" > /etc/resolv.conf;
59 # - which wget >/dev/null || (apt-get update; apt-get install -y wget)
60
61 # Configure Ubuntu mirrors
62 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial main restricted universe" > /etc/apt/sources.list
63 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial-updates main restricted universe" >> /etc/apt/sources.list
64 # - echo "deb [arch=amd64] http://mirror.mirantis.com/{{ REPOSITORY_SUITE }}/ubuntu/ xenial-security main restricted universe" >> /etc/apt/sources.list
65
66 # - echo "deb [arch=amd64] http://apt.mirantis.com/xenial {{ REPOSITORY_SUITE }} salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
67 # - wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
68 # - echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
69 # - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
70
71 # - apt-get clean
72 # - eatmydata apt-get update && apt-get -y upgrade
73
74 # Install common packages
75 # - eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
76
77 # Install salt-minion and stop it until it is configured
78 # - eatmydata apt-get install -y salt-minion && service salt-minion stop
79
80 # Install latest kernel
81 # - eatmydata apt-get install -y {{ os_env('LINUX_KERNEL_HWE_PACKAGE_NAME', 'linux-image-extra-4.10.0-42-generic') }}
82
83 # Register compute node in salt master
84 # - salt-call event.send "reclass/minion/classify" "{{ "{{" }}\"node_master_ip\": \"{{ ETH0_IP_ADDRESS_CFG01 }}\", \"node_os\": \"xenial\", \"node_domain\": \"{{ DOMAIN_NAME }}\", \"node_cluster\": \"{{ LAB_CONFIG_NAME }}\"{{ "}}" }}"
85
86
87 ########################################################
88 # Node is ready, allow SSH access
89 #- echo "Allow SSH access ..."
90 #- sudo iptables -D INPUT -p tcp --dport 22 -j DROP
91 # - reboot
92 ########################################################
93
94 write_files:
95 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
96 content: |
97 GRUB_RECORDFAIL_TIMEOUT=30
98 GRUB_TIMEOUT=3
99 GRUB_TIMEOUT_STYLE=menu
100
101 - path: /etc/network/interfaces
102 content: |
103 # The loopback network interface
104 auto lo
105 iface lo inet loopback
106 auto {interface_name}
107 iface {interface_name} inet dhcp
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200108
109 - path: /usr/share/growlvm/image-layout.yml
110 content: |
111 root:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200112 size: '30%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200113 home:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200114 size: '1G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200115 var_log:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200116 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200117 var_log_audit:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200118 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200119 var_tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200120 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200121 tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +0200122 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +0200123 owner: root:root
124
125 growpart:
126 mode: auto
127 devices:
128 - '/'
129 - '/dev/vda3'
130 ignore_growroot_disabled: false