create_service_signer_cert.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ---
  2. - name: Create local temp directory for syncing certs
  3. hosts: localhost
  4. connection: local
  5. become: no
  6. gather_facts: no
  7. tasks:
  8. - name: Create local temp directory for syncing certs
  9. local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX
  10. register: local_cert_sync_tmpdir
  11. changed_when: false
  12. - name: Create service signer certificate
  13. hosts: oo_first_master
  14. tasks:
  15. - name: Create remote temp directory for creating certs
  16. command: mktemp -d /tmp/openshift-ansible-XXXXXXX
  17. register: remote_cert_create_tmpdir
  18. changed_when: false
  19. - name: Create service signer certificate
  20. command: >
  21. {{ openshift.common.admin_binary }} ca create-signer-cert
  22. --cert=service-signer.crt
  23. --key=service-signer.key
  24. --name=openshift-service-serving-signer
  25. --serial=service-signer.serial.txt
  26. args:
  27. chdir: "{{ remote_cert_create_tmpdir.stdout }}/"
  28. - name: Retrieve service signer certificate
  29. fetch:
  30. src: "{{ remote_cert_create_tmpdir.stdout }}/{{ item }}"
  31. dest: "{{ hostvars.localhost.local_cert_sync_tmpdir.stdout }}/"
  32. flat: yes
  33. fail_on_missing: yes
  34. validate_checksum: yes
  35. with_items:
  36. - "service-signer.crt"
  37. - "service-signer.key"
  38. - name: Delete remote temp directory
  39. file:
  40. name: "{{ remote_cert_create_tmpdir.stdout }}"
  41. state: absent
  42. changed_when: false
  43. - name: Deploy service signer certificate
  44. hosts: oo_masters_to_config
  45. tasks:
  46. - name: Deploy service signer certificate
  47. copy:
  48. src: "{{ hostvars.localhost.local_cert_sync_tmpdir.stdout }}/{{ item }}"
  49. dest: "{{ openshift.common.config_base }}/master/"
  50. with_items:
  51. - "service-signer.crt"
  52. - "service-signer.key"
  53. - name: Delete local temp directory
  54. hosts: localhost
  55. connection: local
  56. become: no
  57. gather_facts: no
  58. tasks:
  59. - name: Delete local temp directory
  60. file:
  61. name: "{{ local_cert_sync_tmpdir.stdout }}"
  62. state: absent
  63. changed_when: false