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 node repositories
7 become: false
8 git:
9 repo: "{{ git_url }}{{ item }}"
10 dest: "{{ repo_dir }}{{ item }}"
11 update: yes
12 version: sp
13 loop: "{{ node_repos }}"
14
15- name: Create simple-discord-music-bot config.js
16 become: false
17 template:
18 src: templates/config.json.j2
19 dest: "{{ repo_dir }}{{ simple_discord_music_bot }}/config.json"
20
21- name: Install packages based on package.json.
22 community.general.npm:
23 path: "{{ repo_dir }}{{ item }}"
24 loop: "{{ node_repos }}"
25
26- name: Create node systemd service files
27 template:
28 src: templates/node.service.j2
29 dest: "/etc/systemd/system/{{ item }}.service"
30 loop: "{{ node_repos }}"
31
32- name: Enable and start node services
33 ansible.builtin.service:
34 name: "{{ item }}"
35 enabled: yes
36 state: started
37 loop: "{{ node_repos }}"