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.

86 lines
1.7 KiB

  1. ---
  2. - name: 'install requirements'
  3. apt:
  4. pkg:
  5. - 'git'
  6. - 'postgresql'
  7. - 'postgresql-contrib'
  8. - 'python3-psycopg2'
  9. - 'gnupg2'
  10. - 'ca-certificates'
  11. state: 'present'
  12. update_cache: true
  13. cache_valid_time: 3600
  14. - name: 'create git system user'
  15. user:
  16. name: 'git'
  17. state: 'present'
  18. home: '/home/git'
  19. shell: '/bin/bash'
  20. comment: 'Git Version Control'
  21. system: true
  22. - name: 'add www-data to git group'
  23. user:
  24. append: true
  25. name: 'www-data'
  26. groups: 'git'
  27. - name: 'create gitea var directories'
  28. file:
  29. state: 'directory'
  30. path: '{{ item }}'
  31. owner: 'git'
  32. group: 'git'
  33. mode: 0750
  34. loop:
  35. - '/var/lib/gitea'
  36. - '/var/lib/gitea/custom'
  37. - '/var/lib/gitea/data'
  38. - '/var/lib/gitea/data/lfs'
  39. - '/var/lib/gitea/log'
  40. - name: 'create gitea config directory'
  41. file:
  42. state: 'directory'
  43. path: '/etc/gitea'
  44. owner: 'root'
  45. group: 'git'
  46. mode: 0750
  47. - name: 'download gitea'
  48. get_url:
  49. url: 'https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64'
  50. dest: '/usr/local/bin/gitea'
  51. mode: '750'
  52. owner: 'root'
  53. group: 'git'
  54. notify:
  55. - 'restart gitea'
  56. - block:
  57. - name: 'create gitea DB'
  58. postgresql_db:
  59. name: 'gitea'
  60. - name: 'create gitea DB user'
  61. postgresql_user:
  62. name: 'git'
  63. db: 'gitea'
  64. priv: 'ALL'
  65. become: true
  66. become_method: 'su'
  67. become_user: 'postgres'
  68. tags: psql
  69. - name: 'create systemd unit'
  70. copy:
  71. src: 'gitea.service'
  72. dest: '/etc/systemd/system/gitea.service'
  73. - name: 'enable systemd unit'
  74. systemd:
  75. daemon_reload: true
  76. enabled: true
  77. name: 'gitea'
  78. ...