blob: e7f96f3f1c2ba92754e550df46c7dd3539fda8f1 [file] [log] [blame]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +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: vagrant
7 sudo: ALL=(ALL) NOPASSWD:ALL
8 shell: /bin/bash
9 ssh_authorized_keys:
10 - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGwjUlYn9UsmWmAGSuEA2sICad7WqxgsJR0HKcMbbxi0tn96h4Cq2iGYmzlJ48egLm5R5pxyWnFvL4b/2zb+kKTPCMwRc9nv7xEGosEFNQEoSDd+gYu2CO0dgS2bX/7m2DXmzvhqPjxWQUXXsb0OYAS1r9Es65FE8y4rLaegz8V35xfH45bTCA0W8VSKh264XtGz12hacqsttE/UvyjJTZe+/XV+xJy3WAWxe8J/MuW1VqbqNewTmpTE/LJU8i6pG4msU6+wH99UvsGAOKQOduynUHKWG3VZg5YCjpbbV/t/pfW/vHB3b3jiifQmNhulyiG/CNnSQ5BahtV/7qPsYt vagrant@cfg01
11
12 chpasswd:
13 list: |
14 vagrant:vagrant
15 expire: False
16
17 bootcmd:
18 # Block access to SSH while node is preparing
19 - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
20 output:
21 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
22
23 runcmd:
24 # Configure dhclient
25 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
26 - sudo resolvconf -u
27
28 # Prepare network connection
29 - sudo ifup {interface_name}
30 - sudo route add default gw {gateway} {interface_name}
31 - sudo ifup eth1
32
33 ############## TCP Cloud cfg01 node ##################
34 #- sleep 120
35 - echo "Preparing base OS"
36 - which wget >/dev/null || (apt-get update; apt-get install -y wget)
37
38 - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty main security extra tcp tcp-salt" > /etc/apt/sources.list
39 - wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add -
40
41 - apt-get clean
42 - apt-get update
43 - apt-get -y upgrade
44
45 # Install common packages
46 - apt-get install -y python-pip git
47 - apt-get install -y curl tmux byobu iputils-ping traceroute htop tree
48
49 - apt-get install -y salt-minion
50
51 # To be configured from inventory/fuel-devops by operator or autotests
52 - 'echo "id: {hostname}" >> /etc/salt/minion'
53 - 'echo "master: 172.16.10.2" >> /etc/salt/minion'
54
55 - rm -f /etc/salt/pki/minion/minion_master.pub
56 - service salt-minion restart
57
58 #- echo "Showing node metadata..."
59 #- salt-call pillar.data
60
61 #- echo "Running complete state ..."
62 #- salt-call state.sls linux,openssh,salt
63
64 ########################################################
65 # Node is ready, allow SSH access
66 - echo "Allow SSH access ..."
67 - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
68 ########################################################
69
70 write_files:
71 - path: /etc/network/interfaces.d/99-tcp-tests.cfg
72 content: |
73 auto eth0
74 iface eth0 inet dhcp
75
76 # 2nd interface should be UP without IP address
77 auto eth1
78 iface eth1 inet manual
79 pre-up ifconfig $IFACE up
80 post-down ifconfig $IFACE down