roles/node_stuff/tasks/main.yaml (view raw)
1- name: Install essential packages
2 package:
3 name: "{{ packages + node_packages }}"
4 state: latest
5
6- name: Git pull on Melody's repository
7 become: false
8 git:
9 repo: "https://github.com/NerdyTechy/{{ melody }}"
10 dest: "{{ repo_dir }}{{ melody }}"
11 update: yes
12 version: master
13
14- name: Create melody config.yml
15 become: false
16 template:
17 src: templates/melody.yml.j2
18 dest: "{{ repo_dir }}{{ melody }}/config.yml"
19
20- name: Install packages based on package.json.
21 community.general.npm:
22 path: "{{ repo_dir }}{{ melody }}"
23
24- name: Create node systemd service files
25 template:
26 src: templates/node.service.j2
27 dest: "/etc/systemd/system/{{ melody }}.service"
28
29- name: Enable and start node services
30 ansible.builtin.service:
31 name: "{{ melody }}"
32 enabled: yes
33 state: started