Fix packer scripts

* Sync scripts accross debian/ubuntu cases.
* Pre-install ansible, python setuptools, dependencies for
kargo-cli, MCP/CCP CLI build time to speed up dev/CI.
* Add ethtool requirement for a kubelet

Change-Id: I74483725d13fbb1444f9f9bbc5a0c4b817807225
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2016-07-20 12:47:42 +02:00
parent 7cfe94fd40
commit 806e682d8e
6 changed files with 83 additions and 12 deletions

View File

@ -11,7 +11,6 @@
{
"name": "{{user `name`}}",
"iso_checksum_type": "none",
"iso_url": "http://cdimage.debian.org/cdimage/release/8.5.0/amd64/iso-cd/debian-8.5.0-amd64-netinst.iso",
"iso_checksum": "ad4e8c27c561ad8248d5ebc1d36eb172f884057bfeb2c22ead823f59fa8c3dff",
"iso_checksum_type": "SHA256",

View File

@ -1,9 +1,34 @@
#!/bin/bash -eux
#FIXME(bogdando) switch to jessie-backports
cat > /etc/apt/preferences.d/testing << EOF
Package: ansible
Pin: release a=testing
Pin-Priority: 1001
Package: python-setuptools
Pin: release a=testing
Pin-Priority: 1001
Package: python-pkg-resources
Pin: release a=testing
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 100
EOF
cat > /etc/apt/sources.list.d/testing.list << EOF
deb http://http.us.debian.org/debian testing main
deb-src http://http.us.debian.org/debian testing main
EOF
apt-get -y update
apt-get -y dist-upgrade
PACKAGES="
curl
ethtool
htop
isc-dhcp-client
nfs-common
@ -13,6 +38,17 @@ git-review
python-tox
screen
tmux
python-dev
gcc
libssl-dev
libffi-dev
software-properties-common
ansible
python-setuptools
"
#PACKAGES="${PACKAGES} docker-engine"
apt-get -y install $PACKAGES
#Installer/CCP tools
pip install git+https://github.com/kubespray/kargo-cli.git --upgrade
pip install git+https://git.openstack.org/openstack/fuel-ccp.git --upgrade

29
utils/packer/ubuntu16.04/scripts/cleanup.sh Executable file → Normal file
View File

@ -9,6 +9,29 @@ sed '/ens/d' -i /etc/network/interfaces
echo 'auto eth0' >> /etc/network/interfaces
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
# Apt cleanup.
apt autoremove
apt update
apt-get -y autoremove --purge
find /var/cache -type f -exec rm -rf {} \;
find /var/lib/apt -type f | xargs rm -f
rm -rf /dev/.udev/
rm -f /lib/udev/rules.d/75-persistent-net-generator.rules
rm -f /etc/udev/rules.d/70-persistent-net.rules
mkdir -p /etc/udev/rules.d/70-persistent-net.rules
if [ -d "/var/lib/dhcp" ]; then
rm -f /var/lib/dhcp/*
fi
rm -rf /tmp/*
unset HISTFILE
rm -f /root/.bash_history
rm -f /home/vagrant/.bash_history
find /var/log -type f | while read f; do echo -ne '' > $f; done;
>/var/log/lastlog
>/var/log/wtmp
>/var/log/btmp
sync

19
utils/packer/ubuntu16.04/scripts/packages.sh Executable file → Normal file
View File

@ -1,15 +1,10 @@
# add Docker repo:
#apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
#cat > /etc/apt/sources.list.d/docker.list <<EOF
#deb https://apt.dockerproject.org/repo ubuntu-trusty main
#deb https://apt.dockerproject.org/repo ubuntu-xenial main
#EOF
#!/bin/bash -eux
apt-get -y update
apt-get -y dist-upgrade
PACKAGES="
curl
ethtool
htop
isc-dhcp-client
nfs-common
@ -19,6 +14,16 @@ git-review
python-tox
screen
tmux
python-dev
gcc
libssl-dev
libffi-dev
software-properties-common
ansible
"
#PACKAGES="${PACKAGES} docker-engine"
apt-get -y install $PACKAGES
#Installer/CCP tools
pip install git+https://github.com/kubespray/kargo-cli.git --upgrade
pip install git+https://git.openstack.org/openstack/fuel-ccp.git --upgrade

0
utils/packer/ubuntu16.04/scripts/setup.sh Executable file → Normal file
View File

View File

@ -1,5 +1,6 @@
{
"variables": {
"name": "ubuntu-1604-server",
"user": "vagrant",
"password": "vagrant",
"disk_size": "100000"
@ -8,7 +9,7 @@
"builders":
[
{
"name": "ubuntu-1604-server",
"name": "{{user `name`}}",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04-server-amd64.iso",
"iso_checksum": "23e97cd5d4145d4105fbf29878534049",
@ -66,5 +67,12 @@
"scripts/cleanup.sh"
]
}
],
"post-processors": [
{
"type": "shell-local",
"inline": ["qemu-img convert -c -f qcow2 -O qcow2 -o cluster_size=2M ./output-{{user `name`}}/packer-{{user `name`}} ./output-{{user `name`}}/packer-{{user `name`}}.qcow2"]
}
]
}