main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. - name: Ensure the generated_configs directory present
  3. file:
  4. path: "{{ openshift_generated_configs_dir }}/{{ item.master_cert_subdir }}"
  5. state: directory
  6. mode: 0700
  7. with_items: masters_needing_certs
  8. - set_fact:
  9. master_certificates:
  10. - ca.crt
  11. - ca.key
  12. - ca.serial.txt
  13. - admin.crt
  14. - admin.key
  15. - admin.kubeconfig
  16. - master.kubelet-client.crt
  17. - master.kubelet-client.key
  18. - master.server.crt
  19. - master.server.key
  20. - openshift-master.crt
  21. - openshift-master.key
  22. - openshift-master.kubeconfig
  23. - openshift-registry.crt
  24. - openshift-registry.key
  25. - openshift-registry.kubeconfig
  26. - openshift-router.crt
  27. - openshift-router.key
  28. - openshift-router.kubeconfig
  29. - serviceaccounts.private.key
  30. - serviceaccounts.public.key
  31. master_31_certificates:
  32. - master.proxy-client.crt
  33. - master.proxy-client.key
  34. - file:
  35. src: "{{ openshift_master_config_dir }}/{{ item.1 }}"
  36. dest: "{{ openshift_generated_configs_dir }}/{{ item.0.master_cert_subdir }}/{{ item.1 }}"
  37. state: hard
  38. with_nested:
  39. - masters_needing_certs
  40. - "{{ master_certificates | union(master_31_certificates) if openshift.common.version_greater_than_3_1_or_1_1 | bool else master_certificates }}"
  41. - name: Create the master certificates if they do not already exist
  42. command: >
  43. {{ openshift.common.admin_binary }} create-master-certs
  44. --hostnames={{ item.openshift.common.all_hostnames | join(',') }}
  45. --master={{ item.openshift.master.api_url }}
  46. --public-master={{ item.openshift.master.public_api_url }}
  47. --cert-dir={{ openshift_generated_configs_dir }}/{{ item.master_cert_subdir }}
  48. --overwrite=false
  49. when: master_certs_missing
  50. with_items: masters_needing_certs