packstack --allinone vagrant setup : how to pass in root password?

asked 2013-12-25 16:48:55 -0600

snowch gravatar image

updated 2013-12-27 05:20:21 -0600

I'm trying to setup packstack --allinone from a vagrant provision shell script, but the script prompts for a password:

[vagrant@localhost ~]$ packstack --allinone 
Welcome to Installer setup utility

Installing: Clean Up...                
[ DONE ] Setting up ssh keys...root@'s password:

How can I set the root password from the script? I've tried the following, but this does not work:

echo 'vagrant\n' | packstack --allinone

My full Vagrantfile is below:

$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. 

$script = <<SCRIPT
set -e
set -x

sudo yum install -y 
sudo yum install -y openstack-packstack 
echo 'vagrant\n' | packstack --allinone 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "centos64"   
  config.vm.box_url = ""

  config.vm.provider :virtualbox do |vb|
     vb.customize ["modifyvm", :id, "--memory", "5120"]
  config.vm.provision "shell", inline: $script 
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-12-26 05:20:38 -0600

snowch gravatar image

updated 2013-12-26 05:44:36 -0600

One option is to use an expect script though this is a bit fragile, it will break if the expected string ever changes:

$script = <<SCRIPT
set -e
set -x

sudo yum install -y
sudo yum install -y openstack-packstack expect

expect << EOF
set timeout -1
spawn "/usr/bin/packstack" "--allinone"
expect "Setting up ssh keys...root@'s password:"
send "vagrant\n"
expect eof

edit flag offensive delete link more

answered 2014-09-10 05:39:07 -0600

JMMIRL gravatar image

I had a similar issue and it turned out that I had multiple .pub keys in my /root/.ssh/ dir. When I cat *.pub >>know_hosts and re-ran the packstack --allinone the problem went away.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-12-25 16:48:55 -0600

Seen: 1,572 times

Last updated: Dec 27 '13