Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

8 years ago
8 years ago
  1. ---
  2. - name: 'install openvpn-openssl package'
  3. opkg:
  4. name: 'openvpn-openssl'
  5. state: 'present'
  6. tags:
  7. - 'packages'
  8. # Shouldn't be required for TLSv1.3
  9. #
  10. #- name: create openvpn dh2048
  11. # shell: 'openssl dhparam -out /etc/openvpn/dh2048.pem 2048'
  12. # args:
  13. # creates: /etc/openvpn/dh2048.pem
  14. # notify: reload openvpn
  15. - name: 'upload server ca'
  16. copy:
  17. content: '{{ openvpn_tls_server_ca }}{{ tls_root_ca }}'
  18. dest: '/etc/openvpn/server_ca.crt'
  19. tags:
  20. - 'tls_int'
  21. - name: 'upload user ca'
  22. copy:
  23. content: '{{ openvpn_tls_user_ca }}{{ tls_root_ca }}'
  24. dest: '/etc/openvpn/user_ca.crt'
  25. notify: 'reload openvpn'
  26. tags:
  27. - 'tls_int'
  28. - name: 'generate and sign server certificate'
  29. import_role: name='ca_cert'
  30. vars:
  31. ca_cert_common_name: '{{ host_fqdn }}'
  32. ca_cert_proto: 'tls'
  33. ca_cert_tls_ca_path: '/etc/openvpn/server_ca.crt'
  34. ca_cert_tls_key_path: '/etc/openvpn/openvpn.key'
  35. ca_cert_tls_csr_path: '/etc/openvpn/openvpn.csr'
  36. ca_cert_tls_cert_path: '/etc/openvpn/openvpn.crt'
  37. - name: 'write openvpn configuration'
  38. template:
  39. dest: '/etc/config/openvpn'
  40. src: 'openvpn.j2'
  41. owner: 'root'
  42. group: 'root'
  43. mode: '0400'
  44. register: config_updated
  45. notify: 'reload openvpn'
  46. - name: 'commit openvpn configuration to uci'
  47. shell: 'uci commit openvpn'
  48. notify: 'reload openvpn'
  49. when: config_updated.changed
  50. ...