Merge pull request #245 from kubespray/fix_flannel_deploy_213
fix flannel deployment, remove docker bridge before restarting
This commit is contained in:
commit
f576d70b3c
5 changed files with 23 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: "Check certs | check if the certs have already been generated on first master"
|
- name: "Check_certs | check if the certs have already been generated on first master"
|
||||||
stat:
|
stat:
|
||||||
path: "{{ kube_cert_dir }}/ca.pem"
|
path: "{{ kube_cert_dir }}/ca.pem"
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: "Check tokens | check if the tokens have already been generated on first master"
|
- name: "Check_tokens | check if the tokens have already been generated on first master"
|
||||||
stat:
|
stat:
|
||||||
path: "{{ kube_token_dir }}/known_tokens.csv"
|
path: "{{ kube_token_dir }}/known_tokens.csv"
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: certs | write openssl config
|
- name: Gen_certs | write openssl config
|
||||||
template:
|
template:
|
||||||
src: "openssl.conf.j2"
|
src: "openssl.conf.j2"
|
||||||
dest: "{{ kube_config_dir }}/openssl.conf"
|
dest: "{{ kube_config_dir }}/openssl.conf"
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: gen_certs|default(false)
|
when: gen_certs|default(false)
|
||||||
|
|
||||||
- name: certs | copy certs generation script
|
- name: Gen_certs | copy certs generation script
|
||||||
copy:
|
copy:
|
||||||
src: "make-ssl.sh"
|
src: "make-ssl.sh"
|
||||||
dest: "{{ kube_script_dir }}/make-ssl.sh"
|
dest: "{{ kube_script_dir }}/make-ssl.sh"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: gen_certs|default(false)
|
when: gen_certs|default(false)
|
||||||
|
|
||||||
- name: certs | run cert generation script
|
- name: Gen_certs | run cert generation script
|
||||||
command: "{{ kube_script_dir }}/make-ssl.sh -f {{ kube_config_dir }}/openssl.conf -d {{ kube_cert_dir }}"
|
command: "{{ kube_script_dir }}/make-ssl.sh -f {{ kube_config_dir }}/openssl.conf -d {{ kube_cert_dir }}"
|
||||||
run_once: yes
|
run_once: yes
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
master_certs: ['ca-key.pem', 'admin.pem', 'admin-key.pem', 'apiserver-key.pem', 'apiserver.pem']
|
master_certs: ['ca-key.pem', 'admin.pem', 'admin-key.pem', 'apiserver-key.pem', 'apiserver.pem']
|
||||||
node_certs: ['ca.pem', 'node.pem', 'node-key.pem']
|
node_certs: ['ca.pem', 'node.pem', 'node-key.pem']
|
||||||
|
|
||||||
- name: certs | Get the certs from first master
|
- name: Gen_certs | Get the certs from first master
|
||||||
slurp:
|
slurp:
|
||||||
src: "{{ kube_cert_dir }}/{{ item }}"
|
src: "{{ kube_cert_dir }}/{{ item }}"
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
run_once: true
|
run_once: true
|
||||||
notify: set secret_changed
|
notify: set secret_changed
|
||||||
|
|
||||||
- name: certs | Copy certs on masters
|
- name: Gen_certs | Copy certs on masters
|
||||||
copy:
|
copy:
|
||||||
content: "{{ item.content|b64decode }}"
|
content: "{{ item.content|b64decode }}"
|
||||||
dest: "{{ item.source }}"
|
dest: "{{ item.source }}"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
when: inventory_hostname in groups['kube-master'] and sync_certs|default(false) and
|
when: inventory_hostname in groups['kube-master'] and sync_certs|default(false) and
|
||||||
inventory_hostname != groups['kube-master'][0]
|
inventory_hostname != groups['kube-master'][0]
|
||||||
|
|
||||||
- name: certs | Copy certs on nodes
|
- name: Gen_certs | Copy certs on nodes
|
||||||
copy:
|
copy:
|
||||||
content: "{{ item.content|b64decode }}"
|
content: "{{ item.content|b64decode }}"
|
||||||
dest: "{{ item.source }}"
|
dest: "{{ item.source }}"
|
||||||
|
@ -54,19 +54,14 @@
|
||||||
inventory_hostname in groups['kube-node'] and sync_certs|default(false) and
|
inventory_hostname in groups['kube-node'] and sync_certs|default(false) and
|
||||||
inventory_hostname != groups['kube-master'][0]
|
inventory_hostname != groups['kube-master'][0]
|
||||||
|
|
||||||
- name: certs | check certificate permissions
|
- name: Gen_certs | check certificate permissions
|
||||||
file:
|
file:
|
||||||
path={{ kube_cert_dir }}
|
path={{ kube_cert_dir }}
|
||||||
group={{ kube_cert_group }}
|
group={{ kube_cert_group }}
|
||||||
owner=kube
|
owner=kube
|
||||||
recurse=yes
|
recurse=yes
|
||||||
|
|
||||||
- shell: ls {{ kube_cert_dir}}/*key.pem
|
- name: Gen_certs | set permissions on keys
|
||||||
register: keyfiles
|
shell: chmod 0600 {{ kube_cert_dir}}/*key.pem
|
||||||
|
when: inventory_hostname in groups['kube-master']
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: certs | set permissions on keys
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
mode: 0600
|
|
||||||
with_items: "{{ keyfiles.stdout_lines }}"
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: tokens | copy tokens generation script
|
- name: Gen_tokens | copy tokens generation script
|
||||||
copy:
|
copy:
|
||||||
src: "kube-gen-token.sh"
|
src: "kube-gen-token.sh"
|
||||||
dest: "{{ kube_script_dir }}/kube-gen-token.sh"
|
dest: "{{ kube_script_dir }}/kube-gen-token.sh"
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: gen_tokens|default(false)
|
when: gen_tokens|default(false)
|
||||||
|
|
||||||
- name: tokens | generate tokens for master components
|
- name: Gen_tokens | generate tokens for master components
|
||||||
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
||||||
environment:
|
environment:
|
||||||
TOKEN_DIR: "{{ kube_token_dir }}"
|
TOKEN_DIR: "{{ kube_token_dir }}"
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: gen_tokens|default(false)
|
when: gen_tokens|default(false)
|
||||||
|
|
||||||
- name: tokens | generate tokens for node components
|
- name: Gen_tokens | generate tokens for node components
|
||||||
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
command: "{{ kube_script_dir }}/kube-gen-token.sh {{ item[0] }}-{{ item[1] }}"
|
||||||
environment:
|
environment:
|
||||||
TOKEN_DIR: "{{ kube_token_dir }}"
|
TOKEN_DIR: "{{ kube_token_dir }}"
|
||||||
|
@ -36,14 +36,14 @@
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: gen_tokens|default(false)
|
when: gen_tokens|default(false)
|
||||||
|
|
||||||
- name: tokens | Get list of tokens from first master
|
- name: Gen_tokens | Get list of tokens from first master
|
||||||
shell: "(find {{ kube_token_dir }} -maxdepth 1 -type f)"
|
shell: "(find {{ kube_token_dir }} -maxdepth 1 -type f)"
|
||||||
register: tokens_list
|
register: tokens_list
|
||||||
changed_when: false
|
changed_when: false
|
||||||
delegate_to: "{{groups['kube-master'][0]}}"
|
delegate_to: "{{groups['kube-master'][0]}}"
|
||||||
when: sync_tokens|default(false)
|
when: sync_tokens|default(false)
|
||||||
|
|
||||||
- name: tokens | Get the tokens from first master
|
- name: Gen_tokens | Get the tokens from first master
|
||||||
slurp:
|
slurp:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
register: slurp_tokens
|
register: slurp_tokens
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
when: sync_tokens|default(false)
|
when: sync_tokens|default(false)
|
||||||
notify: set secret_changed
|
notify: set secret_changed
|
||||||
|
|
||||||
- name: tokens | Copy tokens on masters
|
- name: Gen_tokens | Copy tokens on masters
|
||||||
copy:
|
copy:
|
||||||
content: "{{ item.content|b64decode }}"
|
content: "{{ item.content|b64decode }}"
|
||||||
dest: "{{ item.source }}"
|
dest: "{{ item.source }}"
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
---
|
---
|
||||||
|
- name: delete default docker bridge
|
||||||
|
command: ip link delete docker0
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: restart docker
|
||||||
|
|
||||||
- name: restart docker
|
- name: restart docker
|
||||||
command: /bin/true
|
command: /bin/true
|
||||||
notify:
|
notify:
|
||||||
|
@ -6,11 +11,6 @@
|
||||||
- reload docker
|
- reload docker
|
||||||
- reload kubelet
|
- reload kubelet
|
||||||
|
|
||||||
- name: delete default docker bridge
|
|
||||||
command: ip link delete docker0
|
|
||||||
ignore_errors: yes
|
|
||||||
notify: restart docker
|
|
||||||
|
|
||||||
- name : reload systemd
|
- name : reload systemd
|
||||||
shell: systemctl daemon-reload
|
shell: systemctl daemon-reload
|
||||||
when: ansible_service_mgr == "systemd"
|
when: ansible_service_mgr == "systemd"
|
||||||
|
|
Loading…
Reference in a new issue