57 lines
1.8 KiB
YAML
57 lines
1.8 KiB
YAML
---
|
|
# Deploys gerrit
|
|
- name: Build gerrit container
|
|
hosts: '{{ host }}'
|
|
become: false
|
|
vars_files:
|
|
- vars/gerrit.yml
|
|
handlers:
|
|
- import_tasks: handlers/main.yml
|
|
|
|
pre_tasks:
|
|
- name: Check if ansible cannot be run here
|
|
ansible.builtin.stat:
|
|
path: /etc/no-ansible
|
|
register: no_ansible
|
|
|
|
- name: Verify if we can run ansible
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "not no_ansible.stat.exists"
|
|
success_msg: "We are able to run on this node"
|
|
fail_msg: "/etc/no-ansible exists - skipping run on this node"
|
|
|
|
- name: Verify if we are Rocky Linux 9 or higher
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_distribution_major_version|int >= 9
|
|
- ansible_distribution | lower == "rocky"
|
|
success_msg: "We are on a supported system"
|
|
fail_msg: "Only Rocky Linux versions 9 or higher are supported."
|
|
|
|
- name: Verify that reverse_proxy is proper
|
|
ansible.builtin.assert:
|
|
that:
|
|
- (reverse_proxy == 'httpd') or (reverse_proxy == 'nginx')
|
|
fail_msg: "Only httpd or nginx is supported"
|
|
success_msg: "reverse proxy is set"
|
|
|
|
- name: Import vault if available
|
|
ansible.builtin.include_vars:
|
|
file: "{{ vault_file }}"
|
|
vars:
|
|
vault_file: "{{ lookup('ansible.builtin.first_found', 'vars/vaults/gerrit.yml', errors='ignore') }}"
|
|
|
|
- name: Check that variables are set properly
|
|
ansible.builtin.assert:
|
|
that:
|
|
- gerrit_database_password != "gerrit"
|
|
success_msg: "Proper password is set."
|
|
fail_msg: "Please set a proper database password."
|
|
when: not gerrit_allow_insecure_passwords|bool
|
|
|
|
tasks:
|
|
- name: Build gerrit container
|
|
ansible.builtin.import_tasks: tasks/container.yml
|
|
...
|