diff --git a/CHANGELOG b/CHANGELOG index 6c2cc80..5b2f4dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,17 @@ CHANGELOG ========= +2.8: 2017-07-17 +--------------- +New Feature: +- The virsh console is accessible. + +Updates: +- Ubuntu Xenial 16.04 LTS is now the default cloud image. +- Defaulting user-data templates to use 'ens3' instead of 'eth0' because of "Ubuntu predictable network interface" feature. +- Get Libvirt group from config file. It can change between Ubuntu versions. +- Get Mysql and PostgreSQL candidate versions to install and configure them. + 2.7: 2017-07-16 --------------- New Features: diff --git a/kvm/templates/TEMPLATE-user-data-nat.erb b/kvm/templates/TEMPLATE-user-data-nat.erb index b8e155a..8a347f2 100644 --- a/kvm/templates/TEMPLATE-user-data-nat.erb +++ b/kvm/templates/TEMPLATE-user-data-nat.erb @@ -17,8 +17,8 @@ write_files: iface lo inet loopback # The primary network interface - auto eth0 - iface eth0 inet static + auto ens3 + iface ens3 inet static address <%= var %> netmask 255.255.255.0 gateway 192.168.122.1 diff --git a/kvm/templates/TEMPLATE-user-data.erb b/kvm/templates/TEMPLATE-user-data.erb index 304ebfe..0c55238 100644 --- a/kvm/templates/TEMPLATE-user-data.erb +++ b/kvm/templates/TEMPLATE-user-data.erb @@ -17,8 +17,8 @@ write_files: iface lo inet loopback # The primary network interface - auto eth0 - iface eth0 inet static + auto ens3 + iface ens3 inet static address <%= var %> netmask 255.255.255.0 gateway <%= gateway_ip %> diff --git a/kvm/templates/TEMPLATE.xml.erb b/kvm/templates/TEMPLATE.xml.erb index 4a075e8..b7853d9 100644 --- a/kvm/templates/TEMPLATE.xml.erb +++ b/kvm/templates/TEMPLATE.xml.erb @@ -49,5 +49,11 @@ + + + + + + diff --git a/scripts/install_kvm.sh b/scripts/install_kvm.sh index 6d92278..3b7b73a 100755 --- a/scripts/install_kvm.sh +++ b/scripts/install_kvm.sh @@ -4,8 +4,10 @@ apt-get -y install qemu-utils cloud-utils kvm libvirt-bin libvirt-dev gem install ruby-libvirt --no-ri --no-rdoc --conservative mkdir -p "$1"/{kvm_guests,lib,templates,lists,sources/{iso,cloud_images}} grep -q "export LIBVIRT_DEFAULT_URI=qemu:///system" /etc/environment || echo "export LIBVIRT_DEFAULT_URI=qemu:///system" | tee -a /etc/environment -echo "Add rundeck user to libvirtd and kvm groups" -adduser rundeck libvirtd && adduser rundeck kvm +# Get Libvirt group name from file, it can change between Ubuntu versions. +libvirt_group=$(grep unix_sock_group /etc/libvirt/libvirtd.conf |awk '{print $3}' |cut -d '"' -f 2) +echo "Add rundeck user to $libvirt_group and kvm groups" +adduser rundeck $libvirt_group && adduser rundeck kvm kvm_guests=$(virsh list) if [[ -z "$kvm_guests" ]]; then echo "Restart libvirtd..." diff --git a/scripts/install_rundeck.sh b/scripts/install_rundeck.sh index 472fb2c..300d39e 100755 --- a/scripts/install_rundeck.sh +++ b/scripts/install_rundeck.sh @@ -14,10 +14,11 @@ cp /etc/rundeck/framework.properties.backup /etc/rundeck/framework.properties # Install database if [[ $3 == "mysql" ]]; then - echo "mysql-server-5.7 mysql-server/root_password password $4 - mysql-server-5.7 mysql-server/root_password seen true - mysql-server-5.7 mysql-server/root_password_again password $4 - mysql-server-5.7 mysql-server/root_password_again seen true + mysql_version=`apt-cache policy mysql-server |grep Candidate |grep -o "[0-9]\.[0-9]" |head -n 1` + echo "mysql-server-$mysql_version mysql-server/root_password password $4 + mysql-server-$mysql_version mysql-server/root_password seen true + mysql-server-$mysql_version mysql-server/root_password_again password $4 + mysql-server-$mysql_version mysql-server/root_password_again seen true " | debconf-set-selections export DEBIAN_FRONTEND=noninteractive apt-get install -q -y mysql-server mysql-client libmysqlclient-dev diff --git a/scripts/setup_rundeck_db.rb b/scripts/setup_rundeck_db.rb index cc54c0d..748e336 100755 --- a/scripts/setup_rundeck_db.rb +++ b/scripts/setup_rundeck_db.rb @@ -20,7 +20,8 @@ begin system("gem install pg --no-ri --no-rdoc --conservative") system("su - postgres -c \"createuser pguser -s\"") - %x[/bin/bash -c 'echo -e \"local all postgres peer\nlocal all pguser trust\nlocal all rduser trust\nlocal all all peer\nhost all all 127.0.0.1/32 md5\" | tee /etc/postgresql/9.5/main/pg_hba.conf'] + postgres_version=`apt-cache policy postgresql |grep Candidate |grep -o -P "[0-9]\\.[0-9]"`.chomp + %x[/bin/bash -c 'echo -e \"local all postgres peer\nlocal all pguser trust\nlocal all rduser trust\nlocal all all peer\nhost all all 127.0.0.1/32 md5\" | tee /etc/postgresql/#{postgres_version}/main/pg_hba.conf'] system("systemctl restart postgresql && sleep 5") system("createdb -p 5432 -O pguser -U pguser -E UTF8 #{database_name}") system("createuser -p 5432 -U pguser rduser") diff --git a/vars b/vars index 061bbf7..7521564 100644 --- a/vars +++ b/vars @@ -24,7 +24,7 @@ INTERFACE_OUT="enp0s25" #------------- # Backend: mysql OR postgres BACKEND="mysql" -FIRST_IMAGE_SOURCE="https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img" +FIRST_IMAGE_SOURCE="https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img" SSH_KEYS=["PASTE YOUR SSH PUBLIC KEYS HERE", "ADD THE SECOND ONE HERE", "AND SO ON..."] # Install Bind9 to manage KVM guests' DNS entries.