ansible-ops-management/tasks/mirrormanager.yml
2022-03-27 22:01:23 -07:00

68 lines
2.4 KiB
YAML

---
# Mirrormanager tasks
- name: Configure SELinux booleans
become: true
ansible.posix.seboolean:
name: "{{ item }}"
persistent: true
state: true
with_items:
- httpd_can_network_connect_db
- httpd_can_network_connect
- name: Create mirrormanager group
become: true
ansible.builtin.group:
name: "{{ (mirrormanager_user | default({})).group }}"
gid: "{{ (mirrormanager_user | default({})).gid | default(omit) }}"
system: "{{ (mirrormanager_user | default({})).system | default('yes') }}"
when: (mirrormanager_user | default({})).group is defined
- name: Create mirrormanager user
become: true
ansible.builtin.user:
name: "{{ (mirrormanager_user | default({})).name | default(_wiki_defaultusr) }}"
comment: "{{ (mirrormanager_user | default({})).comment | default(omit) }}"
uid: "{{ (mirrormanager_user | default({})).uid | default(omit) }}"
group: "{{ (mirrormanager_user | default({})).group | default(omit) }}"
groups: "{{ (mirrormanager_user | default({})).groups | default(omit) }}"
home: "{{ (mirrormanager_user | default({})).home | default(mirrormanager_dir) }}"
create_home: "{{ (mirrormanager_user | default({})).create_home | default('no') }}"
shell: "{{ (mirrormanager_user | default({})).shell | default(omit) }}"
system: "{{ (mirrormanager_user | default({})).system | default('no') }}"
- name: Create webroot directory
become: true
ansible.builtin.file:
path: "{{ mirrormanager_dir }}"
state: directory
group: "{{ mirrormanager_user.group }}"
owner: "{{ mirrormanager_user.name }}"
mode: "u=rwX,g=rX,o=rX" # 755 folders, 644 files
recurse: yes
seuser: system_u
serole: object_r
setype: httpd_sys_content_t
#- name: Checkout git repository at version
# become: true
# ansible.builtin.git:
# repo: "https://github.com/fedora-infra/mirrormanager2.git"
# dest: "{{ mirrormanager_dir }}/app"
# depth: 1
# version: "ee381257fcfef2eb38705d98f992d2ae8fb7bb8c"
# update: no
- name: Deploy MM2 config
become: true
ansible.builtin.template:
src: "opt/mirrormanager/mirrormanager2.cfg.j2"
dest: "{{ mirrormanager_dir }}/app/mirrormanager2.cfg"
group: "{{ mirrormanager_user.group }}"
owner: "{{ mirrormanager_user.name }}"
mode: 0700
seuser: system_u
serole: object_r
setype: httpd_sys_rw_content_t
tags:
- config