ansible-ops-management/tasks/mantis/mantis.yml

109 lines
2.9 KiB
YAML

---
# Configure mantis
- name: Configure SELinux booleans
ansible.posix.seboolean:
name: "{{ item }}"
persistent: true
state: true
with_items: "{{ mantis_selinux_booleans }}"
- name: Install necessary packages
ansible.builtin.dnf:
name: "{{ mantis_pkg }}"
state: present
tags:
- packages
- name: Download the bugtracker
ansible.builtin.get_url:
url: "http://downloads.sourceforge.net/mantisbt/mantisbt-{{ mantis_version }}.tar.gz"
dest: "/tmp/mantisbt-{{ mantis_version }}.tar.gz"
checksum: "{{ mantis_checksum }}"
- name: Extract mantis
ansible.builtin.unarchive:
src: "/tmp/mantisbt-{{ mantis_version }}.tar.gz"
dest: "/var/www"
owner: apache
group: apache
mode: '0644'
remote_src: true
- name: Generate crypto salt
ansible.builtin.shell: "set -o pipefail && cat /dev/urandom | head -c 64 | base64 --wrap=0"
changed_when: "1 != 1"
register: cryptosalt_string
- name: Configure mantis
ansible.builtin.template:
src: "var/www/mantis/config/config_inc.php.j2"
dest: "/var/www/mantisbt-{{ mantis_version }}/config/config_inc.php"
owner: apache
group: apache
mode: '0640'
- name: Configure custom strings
ansible.builtin.template:
src: "var/www/mantis/config/{{ item }}.j2"
dest: "/var/www/mantisbt-{{ mantis_version }}/config/{{ item }}"
owner: apache
group: apache
mode: '0644'
with_items:
- "custom_constants_inc.php"
- "custom_strings_inc.php"
- name: Deploy plugins from Mantis GitHub
ansible.builtin.git:
repo: "https://github.com/mantisbt-plugins/{{ item }}.git"
dest: "/var/www/mantisbt-{{ mantis_version }}/plugins/{{ item }}"
update: true
version: master
with_items:
- Snippets
- name: Deploy custom libravatar plugin
ansible.builtin.git:
repo: "https://github.com/nazunalika/mantisbt-libravatar.git"
dest: "/var/www/mantisbt-{{ mantis_version }}/plugins/Libravatar"
update: true
version: main
- name: Deploy custom mattermost plugin
ansible.builtin.git:
repo: "https://github.com/nazunalika/mantisbt-mattermost.git"
dest: "/var/www/mantisbt-{{ mantis_version }}/plugins/Mattermost"
update: true
version: main
- name: Configure httpd
ansible.builtin.template:
src: "etc/httpd/conf.d/mantis.conf.j2"
dest: "/etc/httpd/conf.d/mantis.conf"
owner: root
group: root
mode: '0644'
- name: Database import template
ansible.builtin.template:
src: "tmp/mantis_import.sql.j2"
dest: "/tmp/mantis_import.sql.j2"
owner: root
group: root
mode: '0600'
# We will need to generate this
# name: Import database if required
# community.general.postgresql_db:
# name: "{{ mantis_db_name }}"
# target: /tmp/mantis_import.sql
# owner: "{{ mantis_db_user }}"
# state: restore
# login_host: "{{ mantis_db_host }}"
# login_user: "{{ mantis_db_user }}"
# login_password: "{{ mantis_db_pass }}"
- name: Patch up some pages
ansible.builtin.import_tasks: mantispatch.yml
...