main.yml 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. - file:
  3. path: "{{ etcd_ca_dir }}/{{ item }}"
  4. state: directory
  5. mode: 0700
  6. owner: root
  7. group: root
  8. with_items:
  9. - certs
  10. - crl
  11. - 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. - assemble:
  20. src: "{{ etcd_ca_dir }}/fragments"
  21. dest: "{{ etcd_ca_dir }}/openssl.cnf"
  22. - command: touch index.txt
  23. args:
  24. chdir: "{{ etcd_ca_dir }}"
  25. creates: "{{ etcd_ca_dir }}/index.txt"
  26. - copy:
  27. dest: "{{ etcd_ca_dir }}/serial"
  28. content: "01"
  29. force: no
  30. - command: >
  31. openssl req -config openssl.cnf -newkey rsa:4096
  32. -keyout ca.key -new -out ca.crt -x509 -extensions etcd_v3_ca_self
  33. -batch -nodes -subj /CN=etcd-signer@{{ ansible_date_time.epoch }}
  34. args:
  35. chdir: "{{ etcd_ca_dir }}"
  36. creates: "{{ etcd_ca_dir }}/ca.crt"
  37. environment:
  38. SAN: ''