ergo/tasks/main.yaml
changeset 170 a20a6d03747f
parent 137 645c1e109921
child 174 431c6d5e5dd4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ergo/tasks/main.yaml	Sat Jul 24 10:29:53 2021 -0500
@@ -0,0 +1,65 @@
+---
+
+- name: add ergo user
+  become: yes
+  user: name="ergo"
+
+- name: download ergo
+  become: yes
+  unarchive:
+    remote_src: yes
+    src: "{{ergo_url}}"
+    dest: "/tmp"
+    creates: "/tmp/{{ergo_tar_name}}/"
+
+- name: install ergo
+  become: yes
+  copy:
+    src: "/tmp/{{ergo_tar_name}}/ergo"
+    dest: "/usr/local/bin/"
+    remote_src: yes
+    owner: "root"
+    group: "root"
+    mode: "0755"
+  notify: restart ergo
+
+- name: create ergo dirs
+  become: yes
+  file:
+    path: "{{item}}/ergo"
+    owner: "ergo"
+    group: "ergo"
+    mode: "0755"
+    state: "directory"
+  loop:
+    - "/etc"
+    - "/var"
+
+- name: configure ergo
+  become: yes
+  template:
+    src: "config.yaml.j2"
+    dest: "/etc/ergo/config.yaml"
+    owner: "ergo"
+    group: "ergo"
+    mode: "0644"
+  notify: reload ergo
+
+- name: copy motd file
+  become: yes
+  copy:
+    src: "{{ergo_motd}}"
+    dest: "/etc/ergo/motd"
+  notify: reload ergo
+
+- name: install ergo service
+  become: yes
+  copy:
+    src: "ergo.service"
+    dest: "/lib/systemd/system/ergo.service"
+    mode: "0644"
+  notify: restart ergo
+
+- name: ensure ergo is started
+  become: yes
+  systemd: service="ergo.service" enabled="yes" state="started" daemon_reload="yes"