fuel-ccp-tests/fuel_ccp_tests/templates/cloudinit-user-data.yaml

55 lines
1.6 KiB
YAML

| # All the data below will be stored as a string object
#cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
ssh_pwauth: True
users:
- name: vagrant
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
chpasswd:
list: |
vagrant:vagrant
expire: False
bootcmd:
# Block access to SSH while node is preparing
- cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
runcmd:
# Configure dhclient
- sudo echo "nameserver 8.8.8.8" >> /etc/resolvconf/resolv.conf.d/base
- sudo resolvconf -u
# Prepare network connection
- sudo ifup {interface_name}
- sudo route add default gw {gateway} {interface_name}
- sudo ifup ens4
- sudo ifup ens5
# Prepare necessary packages on the node
- sudo apt-get update
- sudo apt-get upgrade -y
- sudo apt-get install -y git python-setuptools python-dev python-pip gcc libssl-dev libffi-dev vim software-properties-common
- sudo apt-get autoremove -y
- sudo pip install -U setuptools pip
- sudo pip install 'cryptography>=1.3.2'
- sudo pip install 'cffi>=1.6.0'
# Node is ready, allow SSH access
- sudo iptables -D INPUT -p tcp --dport 22 -j DROP
write_files:
- path: /etc/network/interfaces.d/99-fuel-ccp-tests.cfg
content: |
auto ens3
iface ens3 inet dhcp
auto ens4
iface ens4 inet dhcp
# 3rd interface should be UP without IP address
auto ens5
iface ens5 inet manual
pre-up ifconfig $IFACE up
post-down ifconfig $IFACE down