main.yaml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. - name: Install openssl
  3. package: name=openssl state=present
  4. when: not openshift_is_atomic | bool
  5. register: result
  6. until: result is succeeded
  7. - name: Create CA directory
  8. file: path="{{ nuage_ca_dir }}" state=directory
  9. run_once: true
  10. delegate_to: "{{ nuage_ca_master }}"
  11. - name: Create certificate directory
  12. file: path="{{ nuage_ca_master_crt_dir }}" state=directory
  13. run_once: true
  14. delegate_to: "{{ nuage_ca_master }}"
  15. - name: Check if the CA key already exists
  16. stat:
  17. path: "{{ nuage_ca_key }}"
  18. get_checksum: false
  19. get_attributes: false
  20. get_mime: false
  21. register: nuage_ca_key_check
  22. delegate_to: "{{ nuage_ca_master }}"
  23. - name: Create CA key
  24. command: openssl genrsa -out "{{ nuage_ca_key }}" 4096
  25. run_once: true
  26. delegate_to: "{{ nuage_ca_master }}"
  27. when: nuage_ca_key_check.stat.exists is defined and nuage_ca_key_check.stat.exists == False
  28. - name: Check if the CA crt already exists
  29. stat:
  30. path: "{{ nuage_ca_crt }}"
  31. get_checksum: false
  32. get_attributes: false
  33. get_mime: false
  34. register: nuage_ca_crt_check
  35. delegate_to: "{{ nuage_ca_master }}"
  36. - name: Create CA crt
  37. command: openssl req -new -x509 -key "{{ nuage_ca_key }}" -out "{{ nuage_ca_crt }}" -subj "/CN=nuage-signer"
  38. run_once: true
  39. delegate_to: "{{ nuage_ca_master }}"
  40. when: nuage_ca_crt_check.stat.exists is defined and nuage_ca_crt_check.stat.exists == False
  41. - name: Create the serial file
  42. copy: src=serial.txt dest="{{ nuage_ca_serial }}"
  43. run_once: true
  44. delegate_to: "{{ nuage_ca_master }}"
  45. - name: Copy SSL config file
  46. copy: src=openssl.cnf dest="{{ nuage_ca_dir }}/openssl.cnf"
  47. run_once: true
  48. delegate_to: "{{ nuage_ca_master }}"