-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from roles-ansible/scheme
new naming Scheme
- Loading branch information
Showing
13 changed files
with
126 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
--- | ||
- name: "Restart gitea" | ||
become: true | ||
service: | ||
name: gitea | ||
state: restarted | ||
when: ansible_service_mgr == "systemd" | ||
|
||
- name: "Reload systemd" | ||
become: true | ||
systemd: | ||
daemon_reload: true | ||
when: ansible_service_mgr == "systemd" | ||
|
||
- name: "Restart fail2ban" | ||
service: | ||
- name: "systemctl restart fail2ban" | ||
become: true | ||
ansible.builtin.systemd: | ||
name: fail2ban | ||
state: restarted | ||
when: ansible_service_mgr == "systemd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: "Configure gitea" | ||
become: true | ||
ansible.builtin.template: | ||
src: gitea.ini.j2 | ||
dest: /etc/gitea/gitea.ini | ||
owner: "{{ gitea_user }}" | ||
group: "{{ gitea_group }}" | ||
mode: 0600 | ||
notify: "Restart gitea" | ||
|
||
- name: "Service gitea" | ||
become: true | ||
ansible.builtin.systemd: | ||
name: gitea | ||
state: started | ||
enabled: true | ||
when: ansible_service_mgr == "systemd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: "Create config and data directory" | ||
become: true | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ gitea_user }}" | ||
group: "{{ gitea_group }}" | ||
mode: 'u=rwX,g=rX,o=' | ||
with_items: | ||
- "/etc/gitea" | ||
- "{{ gitea_home }}" | ||
- "{{ gitea_home }}/data" | ||
- "{{ gitea_home }}/custom" | ||
- "{{ gitea_home }}/custom/https" | ||
- "{{ gitea_home }}/custom/mailer" | ||
- "{{ gitea_home }}/indexers" | ||
- "{{ gitea_home }}/log" | ||
- "{{ gitea_repository_root }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
--- | ||
- name: Install fail2ban filter | ||
template: | ||
become: true | ||
ansible.builtin.template: | ||
src: fail2ban/filter.conf.j2 | ||
dest: /etc/fail2ban/filter.d/gitea.conf | ||
owner: root | ||
group: root | ||
mode: 0444 | ||
notify: Restart fail2ban | ||
notify: systemctl restart fail2ban | ||
|
||
- name: Install fail2ban jail | ||
template: | ||
become: true | ||
ansible.builtin.template: | ||
src: fail2ban/jail.conf.j2 | ||
dest: /etc/fail2ban/jail.d/gitea.conf | ||
owner: root | ||
group: root | ||
mode: 0444 | ||
notify: Restart fail2ban | ||
notify: systemctl restart fail2ban |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
--- | ||
- name: generate gitea SECRET_KEY if not provided | ||
become: true | ||
shell: 'umask 077; /usr/local/bin/gitea generate secret SECRET_KEY > /etc/gitea/gitea_secret_key' | ||
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret SECRET_KEY > /etc/gitea/gitea_secret_key' | ||
args: | ||
creates: '/etc/gitea/gitea_secret_key' | ||
when: gitea_secret_key | length == 0 | ||
|
||
- name: read gitea SECRET_KEY from file | ||
become: true | ||
slurp: | ||
ansible.builtin.slurp: | ||
src: '/etc/gitea/gitea_secret_key' | ||
register: remote_secret_key | ||
when: gitea_secret_key | length == 0 | ||
|
||
- name: set fact gitea_secret_key | ||
set_fact: | ||
ansible.builtin.set_fact: | ||
gitea_secret_key: "{{ remote_secret_key['content'] | b64decode }}" | ||
when: gitea_secret_key | length == 0 | ||
|
||
- name: generate gitea INTERNAL_TOKEN if not provided | ||
become: true | ||
shell: 'umask 077; /usr/local/bin/gitea generate secret INTERNAL_TOKEN > /etc/gitea/gitea_internal_token' | ||
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret INTERNAL_TOKEN > /etc/gitea/gitea_internal_token' | ||
args: | ||
creates: '/etc/gitea/gitea_internal_token' | ||
when: gitea_internal_token | length == 0 | ||
|
||
- name: read gitea INTERNAL_TOKEN from file | ||
become: true | ||
slurp: | ||
ansible.builtin.slurp: | ||
src: '/etc/gitea/gitea_internal_token' | ||
register: remote_internal_token | ||
when: gitea_internal_token | length == 0 | ||
|
||
- name: set fact gitea_internal_token | ||
set_fact: | ||
ansible.builtin.set_fact: | ||
gitea_internal_token: "{{ remote_internal_token['content'] | b64decode }}" | ||
when: gitea_internal_token | length == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
--- | ||
- name: generate OAuth2 JWT_SECRET if not provided | ||
become: true | ||
shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_oauth_jwt_secret' | ||
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_oauth_jwt_secret' | ||
args: | ||
creates: '/etc/gitea/gitea_oauth_jwt_secret' | ||
when: gitea_oauth2_jwt_secret | length == 0 | ||
|
||
- name: read OAuth2 JWT_SECRET from file | ||
become: true | ||
slurp: | ||
ansible.builtin.slurp: | ||
src: '/etc/gitea/gitea_oauth_jwt_secret' | ||
register: oauth_jwt_secret | ||
when: gitea_oauth2_jwt_secret | length == 0 | ||
|
||
- name: set fact gitea_oauth2_jwt_secret | ||
set_fact: | ||
ansible.builtin.set_fact: | ||
gitea_oauth2_jwt_secret: "{{ oauth_jwt_secret['content'] | b64decode }}" | ||
when: gitea_oauth2_jwt_secret | length == 0 | ||
|
||
- name: generate LFS JWT_SECRET if not provided | ||
become: true | ||
shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_lfs_jwt_secret' | ||
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_lfs_jwt_secret' | ||
args: | ||
creates: '/etc/gitea/gitea_lfs_jwt_secret' | ||
when: gitea_lfs_jwt_secret | length == 0 | ||
|
||
- name: read LFS JWT_SECRET from file | ||
become: true | ||
slurp: | ||
ansible.builtin.slurp: | ||
src: '/etc/gitea/gitea_lfs_jwt_secret' | ||
register: lfs_jwt_secret | ||
when: gitea_lfs_jwt_secret | length == 0 | ||
|
||
- name: set fact gitea_lfs_jwt_secret | ||
set_fact: | ||
ansible.builtin.set_fact: | ||
gitea_lfs_jwt_secret: "{{ lfs_jwt_secret['content'] | b64decode }}" | ||
when: gitea_lfs_jwt_secret | length == 0 |
Oops, something went wrong.