117 lines
3.6 KiB
YAML
117 lines
3.6 KiB
YAML
---
|
|
- name: Verify
|
|
hosts: all
|
|
become: true
|
|
vars:
|
|
gitea_runner_name: "molecule-test-runner"
|
|
pre_tasks:
|
|
- name: Load role defaults
|
|
ansible.builtin.include_vars:
|
|
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults"
|
|
tasks:
|
|
- name: Check runner user exists
|
|
ansible.builtin.user:
|
|
name: "{{ gitea_runner_service_user }}"
|
|
register: user_info
|
|
check_mode: true
|
|
|
|
- name: Assert runner user exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- user_info.state == "present"
|
|
fail_msg: "Runner system user was not created"
|
|
|
|
- name: Check runner binary exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_binary_path }}"
|
|
register: binary_stat
|
|
|
|
- name: Assert runner binary exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- binary_stat.stat.exists
|
|
fail_msg: "Gitea runner binary is missing"
|
|
|
|
- name: Check systemd user service exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_home }}/.config/systemd/user/gitea-runner.service"
|
|
register: service_stat
|
|
|
|
- name: Assert user service exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- service_stat.stat.exists
|
|
fail_msg: "Systemd user service is missing"
|
|
|
|
- name: Check instance data directory exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_data_dir }}"
|
|
register: data_dir_stat
|
|
|
|
- name: Assert instance data directory exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- data_dir_stat.stat.exists
|
|
fail_msg: "Instance data directory is missing"
|
|
|
|
- name: Check config file exists in config directory
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_config_dir }}/config.yaml"
|
|
register: config_stat
|
|
|
|
- name: Assert config file exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- config_stat.stat.exists
|
|
fail_msg: "Config file is missing"
|
|
|
|
- name: Check prune timer exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_home }}/.config/systemd/user/docker-prune.timer"
|
|
register: timer_stat
|
|
|
|
- name: Assert prune timer exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- timer_stat.stat.exists
|
|
fail_msg: "Docker prune timer is missing"
|
|
|
|
- name: Check healthcheck script exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_healthcheck_script_path }}"
|
|
register: healthcheck_script_stat
|
|
|
|
- name: Assert healthcheck script exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- healthcheck_script_stat.stat.exists
|
|
fail_msg: "Healthcheck script is missing"
|
|
|
|
- name: Assert healthcheck script is executable
|
|
ansible.builtin.assert:
|
|
that:
|
|
- healthcheck_script_stat.stat.mode == "0755"
|
|
fail_msg: "Healthcheck script is not executable"
|
|
|
|
- name: Check healthcheck service exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_home }}/.config/systemd/user/runner-healthcheck.service"
|
|
register: healthcheck_service_stat
|
|
|
|
- name: Assert healthcheck service exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- healthcheck_service_stat.stat.exists
|
|
fail_msg: "Healthcheck systemd service is missing"
|
|
|
|
- name: Check healthcheck timer exists
|
|
ansible.builtin.stat:
|
|
path: "{{ gitea_runner_home }}/.config/systemd/user/runner-healthcheck.timer"
|
|
register: healthcheck_timer_stat
|
|
|
|
- name: Assert healthcheck timer exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- healthcheck_timer_stat.stat.exists
|
|
fail_msg: "Healthcheck systemd timer is missing"
|