Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 1 | wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add - |
| 2 | add-apt-repository http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest |
| 3 | apt update |
| 4 | apt install -y salt-master salt-minion reclass make |
| 5 | |
| 6 | rm /etc/salt/minion_id |
| 7 | rm -f /etc/salt/pki/minion/minion_master.pub |
| 8 | echo "id: all01.local" > /etc/salt/minion |
| 9 | echo "master: localhost" >> /etc/salt/minion |
| 10 | |
| 11 | [ ! -d /etc/salt/master.d ] && mkdir -p /etc/salt/master.d |
| 12 | cat <<-EOF > /etc/salt/master.d/master.conf |
| 13 | file_roots: |
| 14 | base: |
| 15 | - /usr/share/salt-formulas/env |
| 16 | pillar_opts: False |
| 17 | open_mode: True |
| 18 | reclass: &reclass |
| 19 | storage_type: yaml_fs |
| 20 | inventory_base_uri: /srv/salt/reclass |
| 21 | ext_pillar: |
| 22 | - reclass: *reclass |
| 23 | master_tops: |
| 24 | reclass: *reclass |
| 25 | EOF |
| 26 | |
| 27 | [ ! -d /etc/reclass ] && mkdir /etc/reclass |
| 28 | cat <<-EOF > /etc/reclass/reclass-config.yml |
| 29 | storage_type: yaml_fs |
| 30 | pretty_print: True |
| 31 | output: yaml |
| 32 | inventory_base_uri: /srv/salt/reclass |
| 33 | EOF |
| 34 | |
| 35 | service salt-master restart |
| 36 | service salt-minion restart |
| 37 | |
| 38 | git clone https://github.com/andreyshestakov/mcp-aio /srv/salt/reclass |
| 39 | cd /srv/salt/reclass |
| 40 | git clone https://gerrit.mcp.mirantis.net/p/salt-models/reclass-system.git classes/system |
| 41 | ln -s /usr/share/salt-formulas/reclass/service classes/service |
| 42 | |
| 43 | export FORMULAS_BASE=https://gerrit.mcp.mirantis.net/salt-formulas |
| 44 | export FORMULAS_PATH=/root/formulas |
| 45 | export FORMULAS_BRANCH=master |
| 46 | |
| 47 | mkdir -p ${FORMULAS_PATH} |
| 48 | 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") |
| 49 | for formula_service in "${formula_services[@]}"; do |
| 50 | _BRANCH=${FORMULAS_BRANCH} |
| 51 | [ ! -d "${FORMULAS_PATH}/${formula_service}" ] && { |
| 52 | if ! git ls-remote --exit-code --heads ${FORMULAS_BASE}/${formula_service}.git ${_BRANCH};then |
| 53 | # Fallback to the master branch if the branch doesn't exist for this repository |
| 54 | _BRANCH=master |
| 55 | fi |
| 56 | git clone ${FORMULAS_BASE}/${formula_service}.git ${FORMULAS_PATH}/${formula_service} -b ${_BRANCH} |
| 57 | } || { |
| 58 | cd ${FORMULAS_PATH}/${formula_service}; |
| 59 | git fetch ${_BRANCH} || git fetch --all |
| 60 | git checkout ${_BRANCH} && git pull || git pull; |
| 61 | cd - |
| 62 | } |
| 63 | cd ${FORMULAS_PATH}/${formula_service} |
| 64 | make install |
| 65 | cd - |
| 66 | done |
| 67 | |
Andrey Shestakov | b37cde0 | 2017-05-11 19:23:18 +0300 | [diff] [blame] | 68 | Apply patches (check latest patchset): |
| 69 | cd /root/formulas/nova |
| 70 | git fetch https://gerrit.mcp.mirantis.net/salt-formulas/nova refs/changes/81/4381/5 && git checkout -b config FETCH_HEAD |
| 71 | make install |
| 72 | |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 73 | salt-call state.apply salt |
| 74 | salt-call state.apply linux,ntp,openssh |
| 75 | salt-call state.apply memcached |
| 76 | salt-call state.apply rabbitmq |
| 77 | salt-call state.apply mysql |
| 78 | salt-call state.apply keystone |
| 79 | salt-call state.apply glance |
| 80 | salt-call state.apply neutron |
| 81 | salt-call state.apply nova.controller |
| 82 | salt-call state.apply nova.compute |
| 83 | |
Andrey Shestakov | 4cc37e8 | 2017-05-12 16:03:41 +0300 | [diff] [blame] | 84 | service nova-compute restart |
| 85 | |
Your Name | b50e563 | 2017-05-12 14:18:03 +0000 | [diff] [blame^] | 86 | fallocate -l 10G /lvm.img |
| 87 | losetup /dev/loop0 /lvm.img |
| 88 | echo -e '#!/bin/bash\nlosetup /dev/loop0 /lvm.img' > /etc/rc.local |
| 89 | pvcreate /dev/loop0 |
| 90 | vgcreate cinder-volume /dev/loop0 |
| 91 | |
| 92 | salt-call state.apply cinder |
| 93 | |
| 94 | |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 95 | . /root/keystonercv3 |
| 96 | |
| 97 | wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img |
| 98 | glance image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --file cirros-0.3.5-x86_64-disk.img --progress |
| 99 | |
| 100 | neutron net-create test |
| 101 | neutron subnet-create test 192.168.1.0/24 |
| 102 | |
| 103 | nova flavor-create m1.extra_tiny auto 256 0 1 |
| 104 | |
| 105 | nova boot --flavor m1.extra_tiny --image cirros --nic net-id=d23f9845-cbce-47a6-be15-0603f6a31365 test # UUID of internal network |
Your Name | b50e563 | 2017-05-12 14:18:03 +0000 | [diff] [blame^] | 106 | |
| 107 | cinder create --name test 1 |
| 108 | nova volume-attach test 49a471ec-2e6d-4810-9161-6c191e1370f5 # UUID of volume |