Ask Your Question
0

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

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

snowch gravatar image

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

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@10.0.2.15'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. 
VAGRANTFILE_API_VERSION = "2"

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

sudo yum install -y http://rdo.fedorapeople.org/rdo-release.rpm 
sudo yum install -y openstack-packstack 
echo 'vagrant\n' | packstack --allinone 
SCRIPT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "centos64"   
  config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box"

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

2 answers

Sort by ยป oldest newest most voted
1

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

snowch gravatar image

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

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 http://rdo.fedorapeople.org/rdo-release.rpm
sudo yum install -y openstack-packstack expect

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

SCRIPT
edit flag offensive delete link more
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 1,463 times

Last updated: Dec 27 '13