blob: 49edd85944705f83f4b471df672651cca91f5a22 [file] [log] [blame]
wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
add-apt-repository http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest
apt update
apt install -y salt-master salt-minion reclass make
rm /etc/salt/minion_id
rm -f /etc/salt/pki/minion/minion_master.pub
echo "id: all01.local" > /etc/salt/minion
echo "master: localhost" >> /etc/salt/minion
[ ! -d /etc/salt/master.d ] && mkdir -p /etc/salt/master.d
cat <<-EOF > /etc/salt/master.d/master.conf
file_roots:
base:
- /usr/share/salt-formulas/env
pillar_opts: False
open_mode: True
reclass: &reclass
storage_type: yaml_fs
inventory_base_uri: /srv/salt/reclass
ext_pillar:
- reclass: *reclass
master_tops:
reclass: *reclass
EOF
[ ! -d /etc/reclass ] && mkdir /etc/reclass
cat <<-EOF > /etc/reclass/reclass-config.yml
storage_type: yaml_fs
pretty_print: True
output: yaml
inventory_base_uri: /srv/salt/reclass
EOF
service salt-master restart
service salt-minion restart
git clone https://github.com/andreyshestakov/mcp-aio /srv/salt/reclass
cd /srv/salt/reclass
git clone https://gerrit.mcp.mirantis.net/p/salt-models/reclass-system.git classes/system
ln -s /usr/share/salt-formulas/reclass/service classes/service
export FORMULAS_BASE=https://gerrit.mcp.mirantis.net/salt-formulas
export FORMULAS_PATH=/root/formulas
export FORMULAS_BRANCH=master
mkdir -p ${FORMULAS_PATH}
declare -a formula_services=("linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "mysql" "grafana" "libvirt" "rsyslog" "memcached" "rabbitmq" "apache" "keystone" "glance" "nova" "neutron")
for formula_service in "${formula_services[@]}"; do
_BRANCH=${FORMULAS_BRANCH}
[ ! -d "${FORMULAS_PATH}/${formula_service}" ] && {
if ! git ls-remote --exit-code --heads ${FORMULAS_BASE}/${formula_service}.git ${_BRANCH};then
# Fallback to the master branch if the branch doesn't exist for this repository
_BRANCH=master
fi
git clone ${FORMULAS_BASE}/${formula_service}.git ${FORMULAS_PATH}/${formula_service} -b ${_BRANCH}
} || {
cd ${FORMULAS_PATH}/${formula_service};
git fetch ${_BRANCH} || git fetch --all
git checkout ${_BRANCH} && git pull || git pull;
cd -
}
cd ${FORMULAS_PATH}/${formula_service}
make install
cd -
done
Apply patches (check latest patchset):
cd /root/formulas/nova
git fetch https://gerrit.mcp.mirantis.net/salt-formulas/nova refs/changes/81/4381/5 && git checkout -b config FETCH_HEAD
make install
salt-call state.apply salt
salt-call state.apply linux,ntp,openssh
salt-call state.apply memcached
salt-call state.apply rabbitmq
salt-call state.apply mysql
salt-call state.apply keystone
salt-call state.apply glance
salt-call state.apply neutron
salt-call state.apply nova.controller
salt-call state.apply nova.compute
service nova-compute restart
. /root/keystonercv3
wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
glance image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --file cirros-0.3.5-x86_64-disk.img --progress
neutron net-create test
neutron subnet-create test 192.168.1.0/24
nova flavor-create m1.extra_tiny auto 256 0 1
nova boot --flavor m1.extra_tiny --image cirros --nic net-id=d23f9845-cbce-47a6-be15-0603f6a31365 test # UUID of internal network