57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/kitchen/provisioner/salt_solo.rb', line 57
def install_command
debug(diagnose())
salt_install = config[:salt_install]
salt_url = config[:salt_bootstrap_url]
chef_url = config[:chef_bootstrap_url]
bootstrap_options = config[:salt_bootstrap_options]
salt_version = config[:salt_version]
salt_apt_repo = config[:salt_apt_repo]
salt_apt_repo_key = config[:salt_apt_repo_key]
<<-INSTALL
sh -c '
#{Util.shell_helpers}
# what version of salt is installed?
SALT_VERSION=`salt-call --version | cut -d " " -f 2`
if [ -z "${SALT_VERSION}" -a "#{salt_install}" = "bootstrap" ]
then
do_download #{salt_url} /tmp/bootstrap-salt.sh
#{sudo('sh')} /tmp/bootstrap-salt.sh #{bootstrap_options}
elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "apt" ]
then
. /etc/lsb-release
echo "deb #{salt_apt_repo}/salt-#{salt_version} ${DISTRIB_CODENAME} main" | #{sudo('tee')} /etc/apt/sources.list.d/salt-#{salt_version}.list
do_download #{salt_apt_repo_key} /tmp/repo.key
#{sudo('apt-key')} add /tmp/repo.key
#{sudo('apt-get')} update
#{sudo('apt-get')} install -y salt-minion
elif [ -z "${SALT_VERSION}" ]
then
echo "No salt-minion installed and I do not know how to install one!"
exit 2
elif [ "${SALT_VERSION}" = "#{salt_version}" -o "#{salt_version}" = "latest" ]
then
echo "You asked for #{salt_version} and you have already got ${SALT_VERSION} installed, sweet!"
elif [ ! -z "${SALT_VERSION}" -a "#{salt_install}" = "bootstrap" ]
then
echo "You asked for bootstrap install and you have got ${SALT_VERSION}, hope thats ok!"
else
echo "You asked for #{salt_version} and you have got ${SALT_VERSION} installed, dunno how to fix that, sorry!"
exit 2
fi
# install chef omnibus so that busser works :(
# TODO: work out how to install enough ruby
# and set busser: { :ruby_bindir => '/usr/bin/ruby' } so that we dont need the
# whole chef client
if [ ! -d "/opt/chef" ]
then
echo "-----> Installing Chef Omnibus"
do_download #{chef_url} /tmp/install.sh
#{sudo('sh')} /tmp/install.sh
fi
'
INSTALL
end
|