Verified Commit bf24c4c9 authored by Tomáš Sapák's avatar Tomáš Sapák
Browse files

update

parent 8a8633dc
.vault_pass
config.yaml
ansible_hosts
# Ansible repo for setting up Rancher Master and Rancher Slaves
## Installation of Rancher Master
Set destination host in ansible_hosts `[barn]` section.
`ansible-playbook setup-barn.yml`
## Installation of Rancher Slaves (Kubernetes cluster)
* set all hosts in ansible_hosts `[slaves]` section.
* set at least one host per `[etcd] [control] [worker]` from `[slaves]`
* create Custom cluster in Rancher
* copy token_c and ca_checksum_c to config.yaml
* allocate floating ips in OpenStack for slaves and put them in config.yaml
* put OpenStack private network ID into config.yaml
`ansible-playbook setup-slaves.yml`
[barn]
barn.ics.muni.cz
[slaves]
147.251.21.252
147.251.21.251
147.251.21.162
[etcd]
147.251.21.252
[control]
147.251.21.251
[worker]
147.251.21.162
vm_name_c: ['k8s-1','k8s-2','k8s-3']
ip_c: ['147.251.21.252','147.251.21.251','147.251.21.162']
net_id_c: 'openstack-network-id'
token_c: 'rancher-token_c'
ca_checksum_c: 'rancher_ca_checksum_c'
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqZDO96SGyqv3dL8AwRol9msigdVDJSxXHO2gwPcDD3zD5n41ClB5yQW34J9ekWph8O+DIhCUaljwYvWnQrUHtBFobT7DJDWjShcCeoHdugoyTP3RozDlh7WgZU9vrPrM1Jg90KIT69xh04+gEJeFwWSF7gryQQZVllw4HctKh9fh53i+3RvgF1Pw4cNwqD2mzIKpl+ayqVxGmIs8RuX5VUeUKQVXHJGEI2PYxvhaH+o9L6RDH8UTJkGZZZnTkuz21mF+B0BaJ0C+I2rg3l5yrk3Qt5ttiHFPjTN+9ajWIQQVoM4/7cJKLfAa/hpztpvReqDpjAs10umMUzpfTdBt9 tom@athe-note
---
- name: Set authorized key took from file
authorized_key:
user: root
state: present
key: "{{ lookup('file', item) }}"
with_items: '{{ SSH_KEY }}'
when: SSH_KEY is defined
......@@ -13,7 +13,6 @@
remote_user: "{{ REMOTE_USER }}"
become: "{{ BECOME }}"
roles:
- { role: ssh-key, vars: { SSH_KEY: [ 'sapak139890.pub' ] } }
- vim
- base-system
- docker
......
- name: launch instances
- name: Launch instances
hosts: localhost
tasks:
- include_vars: file=config.yaml
......@@ -9,7 +9,15 @@
ip: "{{ ip_c }}"
net_id: "{{ net_id_c }}"
- hosts: slaves
- name: Wait for ansible_hosts
gather_facts: False
hosts: slaves
tasks:
- name: waiting for server to launch
local_action: wait_for host={{ inventory_hostname }} state=started port=22 delay=30 timeout=300 connect_timeout=15
- name: Install prerequisites
hosts: slaves
gather_facts: False
remote_user: "debian"
become: "true"
......@@ -24,14 +32,14 @@
remote_user: "debian"
become: "true"
roles:
- { role: ssh-key, vars: { SSH_KEY: [ 'sapak139890.pub' ] } }
- vim
- base-system
- docker
- { role: vmware-tools, when: ansible_virtualization_type == "VMware" }
- upgrade-reboot
- hosts: etcd
- name: Setup etcd
hosts: etcd
remote_user: "debian"
become: "true"
tasks:
......@@ -44,7 +52,8 @@
domain_name: "https://barn.ics.muni.cz"
type: 'etcd'
- hosts: control
- name: Setup control plane
hosts: control
remote_user: "debian"
become: "true"
tasks:
......@@ -57,7 +66,8 @@
domain_name: "https://barn.ics.muni.cz"
type: 'controlplane'
- hosts: worker
- name: Setup worker
hosts: worker
remote_user: "debian"
become: "true"
tasks:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment