kubeasz/24.restore.yml

75 lines
1.4 KiB
YAML
Raw Normal View History

# cluster-restore playbook
# read the guide: 'op/cluster_restore.md'
2018-07-23 16:59:44 +08:00
# to restore CA sth on 'deploy' node
2018-07-23 16:59:44 +08:00
- hosts: deploy
tasks:
- name: Restoring dirs of CA sth
2018-07-23 16:59:44 +08:00
file: name=/etc/kubernetes/ssl/ state=directory
- name: Restoring CA sth
2018-07-23 16:59:44 +08:00
copy:
src: "{{ base_dir }}/roles/cluster-backup/files/ca/{{ item }}"
dest: "{{ ca_dir }}/{{ item }}"
with_items:
- ca.pem
- ca-key.pem
- ca.csr
- ca-csr.json
- ca-config.json
- hosts: deploy
roles:
- deploy
# pre-tasks on all nodes
2018-07-23 16:59:44 +08:00
- hosts: all
roles:
- prepare
# [optional] only needed by multi-master cluster
2018-07-23 16:59:44 +08:00
- hosts: lb
roles:
- lb
# to install etcd cluster
2018-07-23 16:59:44 +08:00
- hosts: etcd
roles:
- etcd
# to install docker
2018-07-23 16:59:44 +08:00
- hosts:
- kube-master
- kube-node
roles:
- docker
# to set up 'kube-master' nodes
2018-07-23 16:59:44 +08:00
- hosts:
- kube-master
roles:
- kube-master
- kube-node
#
2018-07-23 16:59:44 +08:00
tasks:
- name: Making master nodes SchedulingDisabled
2018-07-23 16:59:44 +08:00
shell: "{{ bin_dir }}/kubectl cordon {{ inventory_hostname }} "
when: DEPLOY_MODE != "allinone"
ignore_errors: true
- name: Setting master role name
2018-07-23 16:59:44 +08:00
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=master --overwrite"
ignore_errors: true
# to set up 'kube-node' nodes
2018-07-23 16:59:44 +08:00
- hosts:
- kube-node
roles:
- kube-node
# to restore data of etcd cluster
2018-07-23 16:59:44 +08:00
- hosts: etcd
roles:
- cluster-restore