nostr/relayer/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 20 Jul 2024 10:22:38 -0500
changeset 233 abc2c5c417a7
parent 217 e69a030975c4
child 237 c6c11084c802
permissions -rw-r--r--
Version updates.

---

- name: add relayer user
  become: yes
  user: name="{{relayer_user}}" shell="/bin/false" create_home="false" system="yes"

- name: install relayer systemd service
  become: yes
  copy:
    src: "relayer.service"
    dest: "/lib/systemd/system/relayer.service"
  notify: restart relayer service

- name: install relayer bin
  become: yes
  get_url:
    url: "{{relayer_bin_url}}"
    dest: "/usr/local/bin/relayer"
    owner: "root"
    group: "root"
    mode: "0755"
  notify: restart relayer service

- name: create relayer dirs
  become: yes
  file:
    path: "/etc/relayer"
    owner: "root"
    group: "root"
    mode: "0755"
    state: "directory"

- name: install relayer config
  become: yes
  template:
    src: "relayer.env.j2"
    dest: "/etc/relayer/relayer.env"
    owner: "root"
    group: "root"
    mode: "0600"
  notify: restart relayer service

- name: copy db schema file
  become: yes
  template:
    src: "setup_db.psql.j2"
    dest: "/tmp/setup_db_relayer.psql"
    owner: "postgres"
    group: "postgres"
    mode: "0600"

- name: install db schema psql
  become: yes
  become_user: "postgres"
  command: "psql -f /tmp/setup_db_relayer.psql"
  changed_when: false

- name: ensure service is started
  become: yes
  systemd: name="relayer.service" enabled="yes" state="started"