Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. - name: Create temporary gitea directory
  2. file: state=directory path=/root/gitea
  3. - name: Download gitea {{ gitea_version }} release
  4. get_url:
  5. url="{{ gitea_release }}"
  6. dest=/root/gitea/gitea-{{ gitea_version }}
  7. - name: Make gitea release download executable
  8. file: path=/root/gitea/gitea-{{ gitea_version }} mode=0775
  9. - name: Create /usr/local/bin
  10. file: state=directory path=/usr/local/bin
  11. - name: Stop old gitea instance
  12. service: name=gitea state=stopped
  13. ignore_errors: True
  14. - name: Copy gitea binary to /usr/local/bin
  15. shell: cp gitea/gitea-{{ gitea_version }} /usr/local/bin/gitea chdir=/root
  16. - name: Add git user
  17. user:
  18. name: git
  19. home: /home/git
  20. create_home: yes
  21. shell: /bin/bash
  22. password_lock: yes
  23. state: present
  24. system: yes
  25. - name: Create gitea data directories
  26. file:
  27. state: directory
  28. path: "/data/{{ item }}"
  29. owner: git
  30. group: git
  31. mode: 0750
  32. with_items:
  33. - gitea
  34. - gitea/custom
  35. - gitea/custom/templates
  36. - gitea/custom/templates/custom
  37. - gitea/data
  38. - gitea/log
  39. - gitea/repos
  40. - name: Create gitea config directory
  41. file:
  42. state: directory
  43. path: "/etc/gitea"
  44. owner: git
  45. group: git
  46. mode: 0750
  47. - name: Add gitea config file
  48. template:
  49. src=etc_gitea_app_ini.j2
  50. dest=/etc/gitea/app.ini
  51. owner=git
  52. group=root
  53. mode=0644
  54. - name: Add gitea postgres user
  55. postgresql_user:
  56. login_host=localhost
  57. login_user={{ db_admin_username }}
  58. login_password="{{ db_admin_password }}"
  59. name={{ gitea_db_username }}
  60. password="{{ gitea_db_password }}"
  61. encrypted=yes
  62. state=present
  63. - name: Create gitea database
  64. postgresql_db:
  65. login_host=localhost
  66. login_user={{ db_admin_username }}
  67. login_password="{{ db_admin_password }}"
  68. name={{ gitea_db_database }}
  69. state=present
  70. owner={{ gitea_db_username }}
  71. # Unfortunately, create-user is not idempotent, so this task will fail
  72. # https://github.com/go-gitea/gitea/issues/6307
  73. - name: Create gitea admin user account
  74. become: true
  75. become_user: git
  76. shell: /usr/local/bin/gitea admin user create --admin --config /etc/gitea/app.ini --username {{ gitea_admin_username }} --password {{ gitea_admin_password }} --email {{ admin_email }}
  77. args:
  78. chdir: /data/gitea
  79. ignore_errors: True
  80. - name: Add fail2ban script for gitea
  81. copy:
  82. src=etc_fail2ban_filter.d_gitea.conf
  83. dest=/etc/fail2ban/filter.d/gitea.conf
  84. owner=root
  85. group=root
  86. - name: Add systemd service to start gitea automatically
  87. copy:
  88. src=etc_systemd_system_gitea.service
  89. dest=/etc/systemd/system/gitea.service
  90. owner=root
  91. group=root
  92. - name: Add homepage template to gitea
  93. copy:
  94. src=data_gitea_custom_templates_home.tmpl
  95. dest=/data/gitea/custom/templates/home.tmpl
  96. owner=git
  97. group=root
  98. mode=0644
  99. - name: Add extra links to gitea
  100. template:
  101. src=data_gitea_custom_templates_custom_extra_links.j2
  102. dest=/data/gitea/custom/templates/custom/extra_links.tmpl
  103. owner=git
  104. group=root
  105. mode=0644
  106. - name: Add robots.txt to gitea
  107. copy:
  108. src=data_gitea_custom_robots.txt
  109. dest=/data/gitea/custom/robots.txt
  110. owner=git
  111. group=root
  112. mode=0644
  113. - name: Add custom footer to gitea
  114. copy:
  115. src=data_gitea_custom_templates_custom_footer.tmpl
  116. dest=/data/gitea/custom/templates/custom/footer.tmpl
  117. owner=git
  118. group=root
  119. mode=0644
  120. - name: Register new gitea service
  121. systemd: name=gitea daemon_reload=yes enabled=yes
  122. - name: Start new gitea instance
  123. service: name=gitea state=started
  124. - name: Create the Apache gitea sites config files
  125. template:
  126. src=etc_apache2_sites-available_gitea.j2
  127. dest=/etc/apache2/sites-available/gitea_{{ item.name }}.conf
  128. owner=root
  129. group=root
  130. with_items: "{{ virtual_domains }}"
  131. - name: Enable Apache sites (creates new sites-enabled symlinks)
  132. command: a2ensite gitea_{{ item }}.conf creates=/etc/apache2/sites-enabled/gitea_{{ item }}.conf
  133. notify: restart apache
  134. with_items: "{{ virtual_domains | json_query('[*].name') }}"