You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.6 KiB

  1. ---
  2. - name: slurp kubeadm certs
  3. slurp:
  4. src: "{{ item }}"
  5. with_items:
  6. - "{{ kube_cert_dir }}/apiserver.crt"
  7. - "{{ kube_cert_dir }}/apiserver.key"
  8. - "{{ kube_cert_dir }}/apiserver-kubelet-client.crt"
  9. - "{{ kube_cert_dir }}/apiserver-kubelet-client.key"
  10. - "{{ kube_cert_dir }}/ca.crt"
  11. - "{{ kube_cert_dir }}/ca.key"
  12. - "{{ kube_cert_dir }}/front-proxy-ca.crt"
  13. - "{{ kube_cert_dir }}/front-proxy-ca.key"
  14. - "{{ kube_cert_dir }}/front-proxy-client.crt"
  15. - "{{ kube_cert_dir }}/front-proxy-client.key"
  16. - "{{ kube_cert_dir }}/sa.key"
  17. - "{{ kube_cert_dir }}/sa.pub"
  18. register: kubeadm_certs
  19. delegate_to: "{{ groups['kube-master']|first }}"
  20. - name: kubeadm | write out kubeadm certs
  21. copy:
  22. dest: "{{ item.item }}"
  23. content: "{{ item.content | b64decode }}"
  24. owner: root
  25. group: root
  26. mode: 0600
  27. no_log: true
  28. register: copy_kubeadm_certs
  29. with_items: "{{ kubeadm_certs.results }}"
  30. when: inventory_hostname != groups['kube-master']|first
  31. - name: kubeadm | Init other uninitialized masters
  32. command: timeout -k 600s 600s {{ bin_dir }}/kubeadm init --config={{ kube_config_dir }}/kubeadm-config.yaml --ignore-preflight-errors=all
  33. register: kubeadm_init
  34. retries: 10
  35. until: kubeadm_init is succeeded or "field is immutable" in kubeadm_init.stderr
  36. when:
  37. - inventory_hostname != groups['kube-master']|first
  38. - not kubeadm_already_run.stat.exists
  39. failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
  40. environment:
  41. PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
  42. notify: Master | restart kubelet