ansible-ops-management/tasks/noggin.yml

90 lines
2.0 KiB
YAML
Raw Normal View History

2022-02-27 03:19:20 +00:00
---
- name: Ensure python is installed
2022-03-28 05:01:23 +00:00
ansible.builtin.dnf:
2022-02-27 03:19:20 +00:00
name:
2022-05-25 19:17:46 +00:00
- python39
- python39-pip
2022-02-27 03:19:20 +00:00
state: present
- name: Ensure noggin user exists
user:
name: noggin
comment: "Noggin FAS"
- name: Create noggin directory
2022-03-28 05:01:23 +00:00
ansible.builtin.file:
2022-02-27 03:19:20 +00:00
path: /opt/noggin
state: directory
mode: '0700'
owner: noggin
group: noggin
- name: Deploy noggin
git:
repo: https://github.com/fedora-infra/noggin.git
dest: /opt/noggin/noggin
update: true
version: main
become: true
become_user: noggin
- name: Noggin user must install poetry
pip:
name: poetry
2022-05-25 19:17:46 +00:00
executable: pip3.9
2022-02-27 03:19:20 +00:00
become: true
become_user: noggin
- name: Remove any pycache
2022-03-28 05:01:23 +00:00
ansible.builtin.file:
2022-02-27 03:19:20 +00:00
path: "/home/noggin/.cache/pypoetry"
state: absent
- name: Noggin installation
command: "/home/noggin/.local/bin/poetry install --no-dev --extras deploy"
become: true
become_user: noggin
changed_when: "1 != 1"
args:
chdir: "/opt/noggin/noggin"
- name: Get the noggin poetry virtualenv
shell:
cmd: "poetry env list | awk '{print $1}'"
chdir: "/opt/noggin/noggin"
become: true
become_user: noggin
changed_when: "1 != 1"
register: virtualenv_location
- name: Deploy start up script
2022-03-28 05:01:23 +00:00
ansible.builtin.template:
2022-02-27 03:19:20 +00:00
src: "opt/noggin/start_noggin.sh.j2"
dest: "/opt/noggin/start_noggin.sh"
mode: '0750'
user: noggin
group: noggin
- name: Deploy systemd unit
2022-03-28 05:01:23 +00:00
ansible.builtin.copy:
2022-02-27 03:19:20 +00:00
src: "etc/systemd/system/noggin.service"
dest: "/etc/systemd/system/noggin.service"
owner: root
group: root
mode: '0644'
- name: Deploy noggin configuration
2022-03-28 05:01:23 +00:00
ansible.builtin.template:
2022-02-27 03:19:20 +00:00
src: "opt/noggin/noggin.cfg.j2"
dest: "/opt/noggin/noggin.cfg"
owner: noggin
group: noggin
mode: '0600'
# The only way to run it properly, at least on EL8, is we need this line
- name: Add missing create_app call
2022-03-28 05:01:23 +00:00
ansible.builtin.lineinfile:
2022-02-27 03:19:20 +00:00
path: "/opt/noggin/noggin/noggin/app.py"
line: "app = create_app()"
...