main.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. - file:
  3. path: "{{ item }}"
  4. state: directory
  5. mode: 0700
  6. owner: root
  7. group: root
  8. with_items:
  9. - "{{ etcd_ca_new_certs_dir }}"
  10. - "{{ etcd_ca_crl_dir }}"
  11. - "{{ etcd_ca_dir }}/fragments"
  12. - command: cp /etc/pki/tls/openssl.cnf ./
  13. args:
  14. chdir: "{{ etcd_ca_dir }}/fragments"
  15. creates: "{{ etcd_ca_dir }}/fragments/openssl.cnf"
  16. - template:
  17. dest: "{{ etcd_ca_dir }}/fragments/openssl_append.cnf"
  18. src: openssl_append.j2
  19. backup: true
  20. - assemble:
  21. src: "{{ etcd_ca_dir }}/fragments"
  22. dest: "{{ etcd_openssl_conf }}"
  23. - command: touch {{ etcd_ca_db }}
  24. args:
  25. creates: "{{ etcd_ca_db }}"
  26. - copy:
  27. dest: "{{ etcd_ca_serial }}"
  28. content: "01"
  29. force: no
  30. - command: >
  31. openssl req -config {{ etcd_openssl_conf }} -newkey rsa:4096
  32. -keyout {{ etcd_ca_key }} -new -out {{ etcd_ca_cert }}
  33. -x509 -extensions {{ etcd_ca_exts_self }} -batch -nodes
  34. -days {{ etcd_ca_default_days }}
  35. -subj /CN=etcd-signer@{{ ansible_date_time.epoch }}
  36. args:
  37. chdir: "{{ etcd_ca_dir }}"
  38. creates: "{{ etcd_ca_cert }}"
  39. environment:
  40. SAN: 'etcd-signer'