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.

30 lines
981 B

  1. ---
  2. - name: tokens | generate tokens for master components
  3. sudo: False
  4. local_action: command "{{ role_path }}/scripts/kube-gen-token.sh" "{{ item[0] }}-{{ item[1] }}"
  5. environment:
  6. TOKEN_DIR: "{{ role_path }}/files/tokens"
  7. with_nested:
  8. - [ "system:kubectl" ]
  9. - "{{ groups['kube-master'] }}"
  10. register: gentoken_master
  11. changed_when: "'Added' in gentoken_master.stdout"
  12. notify: set secret_changed
  13. - name: tokens | generate tokens for node components
  14. sudo: False
  15. local_action: command "{{ role_path }}/scripts/kube-gen-token.sh" "{{ item[0] }}-{{ item[1] }}"
  16. environment:
  17. TOKEN_DIR: "{{ role_path }}/files/tokens"
  18. with_nested:
  19. - [ 'system:kubelet' ]
  20. - "{{ groups['kube-node'] }}"
  21. register: gentoken_node
  22. changed_when: "'Added' in gentoken_node.stdout"
  23. notify: set secret_changed
  24. - name: tokens | Copy tokens on master
  25. copy:
  26. src: "tokens"
  27. dest: "/etc/kubernetes"
  28. when: inventory_hostname in "{{ groups['kube-master'] }}"