- add debugging
- fixed linting issue
This commit is contained in:
parent
6bdf47a74b
commit
86157eaa4e
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ansible.python.interpreterPath": "/bin/python3"
|
||||
}
|
105
broken-lint.yml
105
broken-lint.yml
@ -1,105 +0,0 @@
|
||||
---
|
||||
- name: Deploy Gitea
|
||||
hosts: gitea
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
|
||||
vars:
|
||||
__gitea_version : 1.20.3
|
||||
__gitea_arch : amd64
|
||||
__gitea_binary : "https://dl.gitea.io/gitea/{{ __gitea_version }}/\
|
||||
gitea-{{ __gitea_version }}-linux-{{ __gitea_arch }}"
|
||||
|
||||
__gitea_user:
|
||||
name : gitea
|
||||
gecos : Git with a cup of tea
|
||||
shell : /bin/bash
|
||||
home : /home/gitea
|
||||
|
||||
|
||||
tasks:
|
||||
- name: Install Git
|
||||
ansible.builtin.package:
|
||||
name : git
|
||||
state : present
|
||||
|
||||
|
||||
- name: Check if Gitea is present and is correct version
|
||||
command : /usr/local/bin/gitea --version
|
||||
ignore_errors : true
|
||||
changed_when : false
|
||||
register : r_check_gitea
|
||||
|
||||
|
||||
- name: Gitea presence and version verification
|
||||
debug :
|
||||
msg : "Gitea binary not found or version mismatch."
|
||||
when :
|
||||
- (r_check_gitea.rc == 1 or r_check_gitea.stdout is not search(__gitea_version))
|
||||
|
||||
|
||||
- name: "Fetch Gitea {{ __gitea_version }}"
|
||||
ansible.builtin.get_url :
|
||||
url : "{{ __gitea_binary }}"
|
||||
dest : /usr/local/bin/gitea
|
||||
mode : "0755"
|
||||
notify : Restart Gitea
|
||||
when :
|
||||
- (r_check_gitea.rc == 1 or r_check_gitea.stdout is not search(__gitea_version))
|
||||
|
||||
|
||||
- name: Create Gitea user
|
||||
ansible.builtin.user:
|
||||
name : "{{__gitea_user.name}}"
|
||||
comment : "{{ __gitea_user.gecos }}"
|
||||
shell : "{{ __gitea_user.shell }}"
|
||||
home : "{{ __gitea_user.home }}"
|
||||
create_home : true
|
||||
state : present
|
||||
|
||||
|
||||
- name: Create required directories
|
||||
ansible.builtin.file:
|
||||
path : "{{ item }}"
|
||||
state : directory
|
||||
recurse : true
|
||||
owner : "{{ __gitea_user.name }}"
|
||||
group : "{{ __gitea_user.name }}"
|
||||
mode : "0750"
|
||||
loop:
|
||||
- /var/lib/gitea/custom
|
||||
- /var/lib/gitea/data
|
||||
- /var/lib/gitea/log
|
||||
- /etc/gitea
|
||||
|
||||
|
||||
- name: Deploy unit file for Gitea
|
||||
ansible.builtin.template:
|
||||
src : templates/gitea.service.j2
|
||||
dest : /etc/systemd/system/gitea.service
|
||||
owner : root
|
||||
group : root
|
||||
mode : "0644"
|
||||
|
||||
|
||||
- name: Reload Systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
|
||||
- name: Start Gitea
|
||||
ansible.builtin.service:
|
||||
name : gitea
|
||||
state : started
|
||||
enabled : true
|
||||
|
||||
|
||||
handlers:
|
||||
- name: Restart Gitea
|
||||
ansible.builtin.service:
|
||||
name : gitea
|
||||
state : restarted
|
||||
|
||||
|
||||
...
|
@ -7,15 +7,16 @@
|
||||
|
||||
tasks:
|
||||
- name: Test Ansible Lint - Ignore Errors
|
||||
# ansible.builtin.command: ansible-lint --nocolor -f json broken-lint.yml
|
||||
ansible.builtin.command: ansible-lint --nocolor -f json
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
register: r_lint_output
|
||||
|
||||
|
||||
# - name: Debug r_lint_output
|
||||
# ansible.builtin.debug:
|
||||
# var: r_lint_output['stdout']
|
||||
- name: Debug r_lint_output
|
||||
ansible.builtin.debug:
|
||||
verbosity: 1
|
||||
var: r_lint_output['stdout']
|
||||
|
||||
|
||||
- name: Capture ansible-lint warnings and errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user