main.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ---
  2. # Prüfe Repo-Quelle
  3. - name: Schlüssel hinzufügen
  4. apt_key: keyserver=keyserver.ubuntu.com id=16EF3F64CB201D9C
  5. - name: set fastd-repo
  6. apt_repository: repo='deb http://repo.universe-factory.net/debian/ sid main' state=present
  7. # Fastd-Daemon, Habeged-Daemon
  8. - name: install fastd (vpn daemon) and haveged (entropy daemon)
  9. apt:
  10. pkg: "{{ item }}"
  11. update_cache: yes
  12. state: installed
  13. with_items:
  14. - fastd
  15. - haveged
  16. - name: create config directory
  17. file: path=/etc/fastd/vpn state=directory
  18. # generate new fastd keypair if no fastd_key file exists
  19. # new key will only be generated, if no secret,key file exists (public key doesn't matter)
  20. - name: generate fastd key (if not exists)
  21. shell: fastd --generate-key
  22. register: fastd_key_generated
  23. args:
  24. creates: /etc/fastd/vpn/secret.key
  25. notify:
  26. - restart fastd
  27. # write public & private key to seperate keyfiles, if new fastd key is generated
  28. - template: src=secret.key.j2 dest=/etc/fastd/vpn/secret.key owner=root group=root mode=0600
  29. when: fastd_key_generated|changed
  30. - template: src=public.key.j2 dest=/etc/fastd/vpn/public.key
  31. when: fastd_key_generated|changed
  32. - name: create dummy peer directory
  33. file: path=/etc/fastd/vpn/peers state=directory
  34. # create dummy peer file
  35. - name: create dummy peer
  36. template: src=dummy.j2 dest=/etc/fastd/vpn/peers/dummy
  37. # create fastd config
  38. - name: create config
  39. template: src=fastd.conf.j2 dest=/etc/fastd/vpn/fastd.conf
  40. notify:
  41. - restart fastd
  42. - name: create verify directory
  43. file: path=/var/gateway-ffms/fastd/ state=directory
  44. # todo: bessere location wählen
  45. - name: create verify script (blacklisting)
  46. template: src=verify.sh.j2 dest=/var/gateway-ffms/fastd/verify.sh
  47. - stat: path=/var/gateway-ffms/fastd/blacklist
  48. register: blacklist_file
  49. - name: create blacklist file (if not exists)
  50. file: path=/var/gateway-ffms/fastd/blacklist state=touch
  51. when: blacklist_file.stat.exists == False
  52. - name: status.pl nach /root kopieren
  53. copy: src=status.pl dest=/root/status.pl owner=root group=root mode=0755