forked from sonata-nfv/tng-sdk-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 6
Cloud init
Bhuvan Sharma edited this page Dec 3, 2019
·
8 revisions
# static networking configuration
network:
version: 1
config:
# Physical interfaces.
- type: physical
name: eth0
mac_address: "c0:d6:9f:2c:e8:80"
# VLAN interface.
- type: vlan
name: eth0.101
vlan_link: eth0
vlan_id: 101
mtu: 1500
bootcmd:
- ifdown eth0
- ifup eth0
datasource:
apply_network_config: True
- Somehow the config doesnt seems to be working on
avi-ci-t2
- Might try with a simpler user, like creating users!
- How do we bake cloud-init config into the image? So that we dont have to add it at the time of spawning new machine?
Re-run cloud-init config
cloud-init clean
cloud-init init
Latest working cloud-init file which should work for almost all scenarios:
#cloud-config
password: osm4u
chpasswd: { expire: False }
ssh_pwauth: True
datasource:
OpenStack:
metadata_urls: ["http://169.254.169.254"]
max_wait: -1
timeout: 10
retries: 5
apply_network_config: True
write_files:
- content: |
#!/bin/bash
hname=$(hostname)
cat /etc/hosts | grep $hname >> /dev/null
if [ $? -ne 0 ];then
sudo bash -c "echo '127.0.0.1 $hname' >> /etc/hosts"
fi
netfile=$(find /etc/network/interfaces.d -name "*.cfg")
for interface in $(ls -1 /sys/class/net | grep ens) ;do
cat $netfile | grep $interface >> /dev/null
if [ $? -ne 0 ];then
sudo bash -c "echo 'auto $interface' >> ${netfile}"
sudo bash -c "echo 'iface $interface inet dhcp' >> ${netfile}"
sudo ifup $interface
fi
done
owner: ubuntu:ubuntu
permissions: '0644'
path: /script.sh
runcmd:
- [ "chmod", "u+x", "/script.sh"]
- [ "/script.sh" ]
The script.sh
script is responsible for network interface activation and is now working from OSM too.
tng-bench --generator osm