main.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ---
  2. - name: Create directory
  3. become: true
  4. file:
  5. path: /var/www/myip/
  6. owner: www-data
  7. group: www-data
  8. mode: 0755
  9. state: directory
  10. - name: Download source code
  11. become: true
  12. get_url:
  13. url: https://codeberg.org/mark22k/myip.dn42/archive/main.tar.gz
  14. dest: /var/www/myip/source_code.tar.gz
  15. mode: 0600
  16. - name: Unpack source code
  17. become: true
  18. unarchive:
  19. src: /var/www/myip/source_code.tar.gz
  20. dest: /var/www/myip/
  21. remote_src: yes
  22. - name: Replace node id
  23. become: true
  24. replace:
  25. path: /var/www/myip/myip.dn42/public/config.php
  26. regexp: '\[ASN\]'
  27. replace: "{{ myip.asn }}"
  28. - name: Replace node name
  29. become: true
  30. replace:
  31. path: /var/www/myip/myip.dn42/public/config.php
  32. regexp: '\[NODE\]'
  33. replace: "{{ myip.node }}"
  34. - name: Replace location (short)
  35. become: true
  36. replace:
  37. path: /var/www/myip/myip.dn42/public/config.php
  38. regexp: '\[LOCATION\]'
  39. replace: "{{ myip.location }}"
  40. - name: Replace location (long)
  41. become: true
  42. replace:
  43. path: /var/www/myip/myip.dn42/public/config.php
  44. regexp: '\[LOCATION_FULL\]'
  45. replace: "{{ myip.location_full }}"
  46. - name: Set permissions
  47. become: true
  48. file:
  49. path: /var/www/myip/
  50. owner: www-data
  51. group: www-data
  52. state: directory
  53. recurse: true