ansible-gerrit-management/install-gerrit.yml

72 lines
2.1 KiB
YAML
Raw Normal View History

2023-07-25 08:49:15 +00:00
---
# Deploys gerrit
- name: Deploy gerrit
hosts: '{{ host }}'
become: true
vars_files:
- vars/gerrit.yml
2023-07-25 09:23:31 +00:00
- vars/internal.yml
2023-07-25 08:49:15 +00:00
handlers:
- import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
2023-07-25 09:08:20 +00:00
ansible.builtin.stat:
2023-07-25 08:49:15 +00:00
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."
2023-07-25 09:43:32 +00:00
- 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"
2023-07-25 09:08:20 +00:00
- 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') }}"
2023-07-25 08:49:15 +00:00
- 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
2023-07-25 09:23:31 +00:00
roles:
- role: rockylinux.ipagetcert
state: present
when: tls_use_internal_freeipa|bool
2023-07-25 08:49:15 +00:00
tasks:
- name: Deploy gerrit as needed
ansible.builtin.import_tasks: tasks/install.yml
post_tasks:
- name: Touching run file that ansible has ran here
ansible.builtin.file:
path: /var/log/ansible.run
state: touch
mode: '0644'
owner: root
group: root
...