mono-infrastructure/ansible/playbooks/tasks/noggin.yml

90 lines
1.9 KiB
YAML
Raw Permalink Normal View History

2021-04-02 02:35:17 +00:00
---
- name: Ensure python is installed
yum:
name:
- python3
- python3-pip
2021-04-02 07:56:50 +00:00
state: present
2021-04-02 02:35:17 +00:00
- name: Ensure noggin user exists
user:
name: noggin
comment: "Noggin FAS"
- name: Create noggin directory
file:
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
executable: pip3
become: true
become_user: noggin
- name: Remove any pycache
file:
path: "/home/noggin/.cache/pypoetry"
state: absent
- name: Noggin installation
2021-04-02 02:58:09 +00:00
command: "/home/noggin/.local/bin/poetry install --no-dev --extras deploy"
2021-04-02 02:35:17 +00:00
become: true
become_user: noggin
2021-04-02 03:00:37 +00:00
changed_when: "1 != 1"
2021-04-02 02:58:09 +00:00
args:
chdir: "/opt/noggin/noggin"
2021-04-02 02:35:17 +00:00
- name: Get the noggin poetry virtualenv
shell:
cmd: "poetry env list | awk '{print $1}'"
chdir: "/opt/noggin/noggin"
become: true
become_user: noggin
2021-04-02 02:58:09 +00:00
changed_when: "1 != 1"
2021-04-02 02:35:17 +00:00
register: virtualenv_location
- name: Deploy start up script
template:
src: "opt/noggin/start_noggin.sh.j2"
dest: "/opt/noggin/start_noggin.sh"
mode: '0750'
user: noggin
group: noggin
- name: Deploy systemd unit
copy:
src: "etc/systemd/system/noggin.service"
dest: "/etc/systemd/system/noggin.service"
owner: root
group: root
mode: '0644'
- name: Deploy noggin configuration
template:
src: "opt/noggin/noggin.cfg.j2"
dest: "/opt/noggin/noggin.cfg"
owner: noggin
group: noggin
mode: '0600'
2021-04-02 02:49:59 +00:00
# The only way to run it properly, at least on EL8, is we need this line
- name: Add missing create_app call
lineinfile:
path: "/opt/noggin/noggin/noggin/app.py"
line: "app = create_app()"
...