main.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. - name: Install openssl
  3. package: name=openssl state=present
  4. when: not openshift.common.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: path="{{ nuage_ca_key }}"
  17. register: nuage_ca_key_check
  18. delegate_to: "{{ nuage_ca_master }}"
  19. - name: Create CA key
  20. command: openssl genrsa -out "{{ nuage_ca_key }}" 4096
  21. run_once: true
  22. delegate_to: "{{ nuage_ca_master }}"
  23. when: nuage_ca_key_check.stat.exists is defined and nuage_ca_key_check.stat.exists == False
  24. - name: Check if the CA crt already exists
  25. stat: path="{{ nuage_ca_crt }}"
  26. register: nuage_ca_crt_check
  27. delegate_to: "{{ nuage_ca_master }}"
  28. - name: Create CA crt
  29. command: openssl req -new -x509 -key "{{ nuage_ca_key }}" -out "{{ nuage_ca_crt }}" -subj "/CN=nuage-signer"
  30. run_once: true
  31. delegate_to: "{{ nuage_ca_master }}"
  32. when: nuage_ca_crt_check.stat.exists is defined and nuage_ca_crt_check.stat.exists == False
  33. - name: Create the serial file
  34. copy: src=serial.txt dest="{{ nuage_ca_serial }}"
  35. run_once: true
  36. delegate_to: "{{ nuage_ca_master }}"
  37. - name: Copy SSL config file
  38. copy: src=openssl.cnf dest="{{ nuage_ca_dir }}/openssl.cnf"
  39. run_once: true
  40. delegate_to: "{{ nuage_ca_master }}"