Andrey Shestakov | cbcda4d | 2017-07-20 15:39:47 +0300 | [diff] [blame] | 1 | wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | sudo apt-key add - |
| 2 | add-apt-repository http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 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 | |
Andrey Shestakov | ab7d693 | 2017-06-21 17:36:15 +0300 | [diff] [blame] | 38 | git clone https://gerrit.mcp.mirantis.net/p/salt-models/mcp-virtual-aio.git /srv/salt/reclass |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 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} |
Mykyta Karpin | 26f7583 | 2017-06-21 17:53:23 +0300 | [diff] [blame] | 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" "cinder" "heat" "horizon" "ironic" "tftpd-hpa" "bind" "powerdns" "designate") |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 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 | |
Mykyta Karpin | c69a4bd | 2017-06-29 10:39:51 +0300 | [diff] [blame] | 68 | # In case Designate should be deployed with PowerDNS backend, change designate_backend.yml: |
| 69 | cat <<-'EOF' > classes/cluster/designate_backend.yml |
| 70 | classes: |
| 71 | - system.designate.server.backend.pdns |
| 72 | parameters: |
| 73 | _param: |
| 74 | designate_pool_target_type: pdns4 |
| 75 | powerdns_webserver_password: gJ6n3gVaYP8eS |
| 76 | powerdns_webserver_port: 8081 |
| 77 | designate_pdns_api_key: VxK9cMlFL5Ae |
| 78 | designate_pdns_api_endpoint: "http://${_param:single_address}:${_param:powerdns_webserver_port}" |
| 79 | designate_pool_target_options: |
| 80 | api_endpoint: ${_param:designate_pdns_api_endpoint} |
| 81 | api_token: ${_param:designate_pdns_api_key} |
| 82 | powerdns: |
| 83 | server: |
| 84 | axfr_ips: |
| 85 | - ${_param:single_address} |
| 86 | EOF |
| 87 | |
Andrey Shestakov | 9f03a48 | 2017-05-16 17:00:08 +0300 | [diff] [blame] | 88 | # Apply all |
Andrey Shestakov | f12dde9 | 2017-05-17 14:19:52 +0300 | [diff] [blame] | 89 | salt-call state.apply # minimum two times or until success |
Andrey Shestakov | 9f03a48 | 2017-05-16 17:00:08 +0300 | [diff] [blame] | 90 | |
| 91 | # or apply one by one (when fail on some step - repeat or ignore): |
Your Name | d6512c7 | 2017-05-12 15:39:21 +0000 | [diff] [blame] | 92 | #salt-call state.apply salt |
Andrey Shestakov | 9f03a48 | 2017-05-16 17:00:08 +0300 | [diff] [blame] | 93 | #salt-call state.apply linux,ntp,openssh |
| 94 | #salt-call state.apply memcached |
| 95 | #salt-call state.apply rabbitmq |
| 96 | #salt-call state.apply mysql |
| 97 | #salt-call state.apply keystone |
| 98 | #salt-call state.apply glance |
| 99 | #salt-call state.apply neutron |
Andrey Shestakov | d63aa62 | 2017-06-15 14:01:03 +0300 | [diff] [blame] | 100 | #salt-call state.apply nova |
Andrey Shestakov | 9f03a48 | 2017-05-16 17:00:08 +0300 | [diff] [blame] | 101 | #salt-call state.apply cinder |
| 102 | #salt-call state.apply heat |
| 103 | #salt-call state.apply horizon |
Mykyta Karpin | c69a4bd | 2017-06-29 10:39:51 +0300 | [diff] [blame] | 104 | |
| 105 | #If Powerdns Designate backend: |
| 106 | #salt-call state.apply powerdns |
| 107 | |
| 108 | #If Bind9 Designate backend: |
Mykyta Karpin | 26f7583 | 2017-06-21 17:53:23 +0300 | [diff] [blame] | 109 | #salt-call state.apply bind |
Mykyta Karpin | c69a4bd | 2017-06-29 10:39:51 +0300 | [diff] [blame] | 110 | |
Mykyta Karpin | 26f7583 | 2017-06-21 17:53:23 +0300 | [diff] [blame] | 111 | #salt-call state.apply designate |
Andrii Shestakov | bf7bfe7 | 2017-05-25 17:07:06 +0000 | [diff] [blame] | 112 | # Ironic is not available yet. |
| 113 | #salt-call state.apply ironic |
| 114 | #salt-call state.apply tftpd_hpa |
Your Name | d6512c7 | 2017-05-12 15:39:21 +0000 | [diff] [blame] | 115 | |
Andrey Shestakov | b0c2525 | 2017-06-21 16:56:45 +0300 | [diff] [blame] | 116 | service apache2 restart |
Your Name | b50e563 | 2017-05-12 14:18:03 +0000 | [diff] [blame] | 117 | |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 118 | . /root/keystonercv3 |
| 119 | |
| 120 | wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img |
| 121 | glance image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --file cirros-0.3.5-x86_64-disk.img --progress |
| 122 | |
Andrey Shestakov | d63aa62 | 2017-06-15 14:01:03 +0300 | [diff] [blame] | 123 | neutron net-create internal_net |
| 124 | neutron subnet-create --name internal_subnet internal_net 192.168.1.0/24 |
| 125 | |
| 126 | neutron net-create external_network --provider:network_type flat --provider:physical_network physnet1 --router:external |
| 127 | neutron subnet-create --name external_subnet --enable_dhcp=False --allocation-pool=start=172.16.1.2,end=172.16.1.250 --gateway=172.16.1.1 external_network 172.16.1.0/24 |
| 128 | |
| 129 | neutron router-create r1 |
| 130 | neutron router-interface-add r1 internal_subnet |
| 131 | neutron router-gateway-set r1 external_network |
| 132 | |
| 133 | nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 |
| 134 | nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0 |
Andrey Shestakov | b31da5c | 2017-05-03 15:57:12 +0000 | [diff] [blame] | 135 | |
| 136 | nova flavor-create m1.extra_tiny auto 256 0 1 |
| 137 | |
| 138 | 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] | 139 | |
Andrey Shestakov | d63aa62 | 2017-06-15 14:01:03 +0300 | [diff] [blame] | 140 | nova floating-ip-create external_network |
| 141 | nova floating-ip-associate test 172.16.1.7 # floating IP |
| 142 | |
Your Name | b50e563 | 2017-05-12 14:18:03 +0000 | [diff] [blame] | 143 | cinder create --name test 1 |
| 144 | nova volume-attach test 49a471ec-2e6d-4810-9161-6c191e1370f5 # UUID of volume |
Your Name | d6512c7 | 2017-05-12 15:39:21 +0000 | [diff] [blame] | 145 | |
Mykyta Karpin | 26f7583 | 2017-06-21 17:53:23 +0300 | [diff] [blame] | 146 | openstack dns service list |
| 147 | openstack zone create --email dnsmaster@example.tld example.tld. |
| 148 | openstack recordset create --records '10.0.0.1' --type A example.tld. www |
| 149 | nslookup www.example.tld 127.0.0.1 |
| 150 | |
Your Name | d6512c7 | 2017-05-12 15:39:21 +0000 | [diff] [blame] | 151 | # Horizon is available on port :8078 |