From 20b2965fd9772c951630e2a11c13974a9a40da74 Mon Sep 17 00:00:00 2001 From: Jim Riordan Date: Thu, 1 Jun 2017 09:59:17 +1000 Subject: [PATCH] make vagrant user configurable from config.yaml RELATED_BUG: 1569237 RELATED_BUG: 1589721 Change-Id: I57b5c9ea124b071c6d31b8c825c9cb1d2e89a8ce --- Vagrantfile | 1 + config.yaml.sample | 7 +++++++ puppet/manifests/default.pp | 4 +++- puppet/modules/user/manifests/vagrant.pp | 6 +++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 1806543..a55d2c9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -69,6 +69,7 @@ def configure_vm(name, vm, conf) "is_compute" => (name != "manager"), "use_ldap" => conf["use_ldap"] || false, "extra_images" => conf["extra_images"] || "", + "vagrant_username" => conf["vagrant_username"] || "ubuntu", } # add all the rest of the content in the conf file conf.each do |k, v| diff --git a/config.yaml.sample b/config.yaml.sample index 3a65c5e..2c15d2e 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -40,6 +40,9 @@ bridge_int: eth1 #box_name: 'my.favorite' #box_url: http://gallifrey/vagrant/devstack-2014-02-19.box +# Vagrant username used in box image, e.g. ubuntu +#vagrant_username: vagrant + # Non upstream Git URL to fetch Devstack from instead. #devstack_git: /home/vagrant/openstack/devstack @@ -69,6 +72,10 @@ bridge_int: eth1 #ip_address_manager: 10.0.10.10 #ip_address_compute: 10.0.10.20 +# Name of network interface in virtual machine - e.g. enp0s8 in ubuntu +#guest_interface_default: eth1 +#host_ip_iface: eth1 + # Extra images to download and add to glance, a list of url's comma separated # for new images to be added to glance #extra_images: https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img,https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img diff --git a/puppet/manifests/default.pp b/puppet/manifests/default.pp index 598dade..fd73d4a 100644 --- a/puppet/manifests/default.pp +++ b/puppet/manifests/default.pp @@ -1,7 +1,9 @@ node default { include base include user::stack - include user::vagrant + class {'user::vagrant': + username => $::vagrant_username, + } include grenade include devstack } diff --git a/puppet/modules/user/manifests/vagrant.pp b/puppet/modules/user/manifests/vagrant.pp index 60c5993..de08c0d 100644 --- a/puppet/modules/user/manifests/vagrant.pp +++ b/puppet/modules/user/manifests/vagrant.pp @@ -5,14 +5,14 @@ class user::vagrant( $username = 'vagrant' ) { - file {'/home/vagrant/.bashrc': + file {"/home/${username}/.bashrc": owner => $username, group => $username, mode => '0644', source => 'puppet:///modules/user/stack_bashrc', } - file {'/home/vagrant/devstack': + file {"/home/${username}/devstack": owner => $username, group => $username, mode => '0644', @@ -20,7 +20,7 @@ class user::vagrant( target => '/home/stack/devstack', } - file {'/home/vagrant/grenade': + file {"/home/${username}/grenade": owner => $username, group => $username, mode => '0644',