main.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Create openshift_generated_configs_dir if it doesn't exist
  3. file:
  4. path: "{{ openshift_generated_configs_dir }}"
  5. state: directory
  6. - name: Create openshift_generated_configs_dir for each etcd host
  7. file:
  8. path: "{{ openshift_generated_configs_dir }}/etcd-{{ item.openshift.common.hostname}}"
  9. state: directory
  10. with_items: etcd_hosts_needing_certs
  11. - name: Generate the etcd client side certs
  12. delegate_to: "{{ openshift_first_master }}"
  13. command: >
  14. {{ openshift.common.admin_binary }} create-server-cert
  15. --cert=client.crt --key=client.key --overwrite=true
  16. --hostnames={{ [item.openshift.common.hostname, item.openshift.common.public_hostname, item.openshift.common.ip]|unique|join(",") }}
  17. --signer-cert={{ openshift_master_ca_cert }}
  18. --signer-key={{ openshift_master_ca_key }}
  19. --signer-serial={{ openshift_master_ca_serial }}
  20. args:
  21. chdir: "{{ openshift_generated_configs_dir }}/etcd-{{ item.openshift.common.hostname }}"
  22. creates: "{{ openshift_generated_configs_dir }}/etcd-{{ item.openshift.common.hostname }}/client.crt"
  23. with_items: etcd_hosts_needing_certs
  24. - name: Copy CA cert
  25. delegate_to: "{{ openshift_first_master }}"
  26. command: "cp {{ openshift_master_ca_cert }} ."
  27. args:
  28. chdir: "{{ openshift_generated_configs_dir }}/etcd-{{ item.openshift.common.hostname }}"
  29. creates: "{{ openshift_generated_configs_dir }}/etcd-{{ item.openshift.common.hostname }}/ca.crt"
  30. with_items: etcd_hosts_needing_certs