This commit is contained in:
2023-12-08 12:44:32 +01:00
commit 14409872b6
24 changed files with 1071 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
---
- name: Converge
hosts: all
become: true
roles:
- ansible-role-gitea
vars:
gitea_http_domain: localhost
gitea_root_url: http://localhost

View File

@@ -0,0 +1,43 @@
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest
pre_build_image: true
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
provisioner:
name: ansible
playbooks:
prepare: prepare.yml
converge: converge.yml
scenario:
test_sequence:
- lint
- destroy
- syntax
- create
- prepare
- converge
- verify
- destroy
verifier:
name: testinfra
lint:
name: flake8

View File

@@ -0,0 +1,27 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: install dependencies for gitea (RedHat based systems)
yum:
name: "{{ redhat_packages }}"
state: present
update_cache: true
when: ansible_os_family == "RedHat"
- name: install dependencies for gitea (Debian based systems)
apt:
name: "{{ debian_packages }}"
state: present
update_cache: true
when: ansible_os_family == "Debian"
vars:
debian_packages:
- git
- curl
- xz-utils
redhat_packages:
- git
- curl
- xz

View File

@@ -0,0 +1,25 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_gitea_binary(host):
gitea_bin = host.file('/usr/local/bin/gitea')
assert gitea_bin.exists
assert gitea_bin.user == 'root'
assert gitea_bin.group == 'root'
def test_gitea_config_file(host):
gitea_config = host.file('/etc/gitea/gitea.ini')
assert gitea_config.exists
assert gitea_config.mode == 0o600
def test_gitea_service_running(host):
gitea = host.service('gitea')
assert gitea.is_running
def test_gitea_reachable(host):
gitea_http = host.run('curl http://localhost:3000')
assert gitea_http.rc == 0