main.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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. when: nodes_needing_certs | length > 0
  7. - name: Generate the node client config
  8. command: >
  9. {{ openshift.common.admin_binary }} create-api-client-config
  10. --certificate-authority={{ openshift_master_ca_cert }}
  11. --client-dir={{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}
  12. --groups=system:nodes
  13. --master={{ openshift.master.api_url }}
  14. --signer-cert={{ openshift_master_ca_cert }}
  15. --signer-key={{ openshift_master_ca_key }}
  16. --signer-serial={{ openshift_master_ca_serial }}
  17. --user=system:node:{{ item.openshift.common.hostname }}
  18. args:
  19. creates: "{{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}"
  20. with_items: nodes_needing_certs
  21. - name: Generate the node server certificate
  22. command: >
  23. {{ openshift.common.admin_binary }} ca create-server-cert
  24. --cert={{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}/server.crt
  25. --key={{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}/server.key
  26. --overwrite=true
  27. --hostnames={{ item.openshift.common.all_hostnames |join(",") }}
  28. --signer-cert={{ openshift_master_ca_cert }}
  29. --signer-key={{ openshift_master_ca_key }}
  30. --signer-serial={{ openshift_master_ca_serial }}
  31. args:
  32. creates: "{{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}/server.crt"
  33. with_items: nodes_needing_certs