main.yaml 1.5 KB

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