update node stuff
Marco Andronaco andronacomarco@gmail.com
Sun, 19 Feb 2023 22:34:44 +0100
5 files changed,
79 insertions(+),
18 deletions(-)
M
group_vars/node/vars.yml
→
group_vars/node/vars.yml
@@ -19,3 +19,31 @@ 63643435373033316132396536393039646165326434396334663230373132303062333538386136
31643862663633313532346637313533663833613566326339363663346534393034653534653463 37353064373464653931363738666264313035306463373963663739343339363330306364376363 34653665666665356130 + +melody_bot_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 64343964313564373432633432393539363035626333343032363435383264303633316265336639 + 3237666336386234356263356632626365663062646138360a613331633239326637306433306539 + 30653231393538353837333339623539623763393164376239313039636239653633373032363031 + 3134613063323062370a356262643234383862616466303264313864326362356138663237393861 + 66323362353361393163373636373962393562333230336333323463386339653932663438353664 + 34636338356162363237623834373864346464376665643261626562653538353836383838366265 + 33373530373665393066333531373562376566303965323639353232633736323163306434646633 + 39626238303762313738 +melody_client_id: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 64613530643236643162636661666132646530373662336630636433626333376364346664336637 + 3636623234383134316536626532343830653930356163620a333362336139613865653030353832 + 66343538623133636361656530363037393463666462363835343736386130303465643237646132 + 3466393038336161640a393435663361346138633437313734316431386234666164373039383939 + 35386337383935653166666238306639356231393633633430356531326134643563 +melody_genius_access_token: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 65613031663533623635663536323035653934326234626366353565633237386639343932303138 + 3635303261373038623131626262633934616365643138310a373932663363373362393731316537 + 31333766633133643266623237393864333734656435383534343032343364613734666262336561 + 6261626338646135320a626334633663343830623862343637633365346565343765373364363832 + 30356562613464383230623634643638343161373333343930366132303662333935663862316263 + 62306337623132393266613137343439376363663963643261346266396338373430373861333839 + 64303330333733633237663266656430386262396537616333383339343737303233306335633935 + 37303764666635393565
M
roles/node_stuff/defaults/main.yaml
→
roles/node_stuff/defaults/main.yaml
@@ -2,9 +2,10 @@ ---
user: "user" repo_dir: "/home/{{ user }}/Scaricati/" -simple_discord_music_bot: simple-discord-music-bot +simple_discord_music_bot: "BiRabittoh/simple-discord-music-bot" +melody: "Melody" node_repos: -- "{{ simple_discord_music_bot }}" +- "NerdyTechy/{{ melody }}" -git_url: "https://github.com/BiRabittoh/" +git_url: "https://github.com/"
M
roles/node_stuff/tasks/main.yaml
→
roles/node_stuff/tasks/main.yaml
@@ -3,35 +3,31 @@ package:
name: "{{ packages + node_packages }}" state: latest -- name: Git pull on node repositories +- name: Git pull on Melody's repository become: false git: - repo: "{{ git_url }}{{ item }}" - dest: "{{ repo_dir }}{{ item }}" + repo: "https://github.com/NerdyTechy/{{ melody }}" + dest: "{{ repo_dir }}{{ melody }}" update: yes version: master - loop: "{{ node_repos }}" -- name: Create simple-discord-music-bot config.js +- name: Create melody config.yml become: false template: - src: templates/config.json.j2 - dest: "{{ repo_dir }}{{ simple_discord_music_bot }}/config.json" + src: templates/melody.yml.j2 + dest: "{{ repo_dir }}{{ melody }}/config.yml" - name: Install packages based on package.json. community.general.npm: - path: "{{ repo_dir }}{{ item }}" - loop: "{{ node_repos }}" + path: "{{ repo_dir }}{{ melody }}" - name: Create node systemd service files template: src: templates/node.service.j2 - dest: "/etc/systemd/system/{{ item }}.service" - loop: "{{ node_repos }}" + dest: "/etc/systemd/system/{{ melody }}.service" - name: Enable and start node services ansible.builtin.service: - name: "{{ item }}" + name: "{{ melody }}" enabled: yes state: started - loop: "{{ node_repos }}"
A
roles/node_stuff/templates/melody.yml.j2
@@ -0,0 +1,36 @@
+# Your Discord bot token (Found at https://discord.com/developers/applications) +botToken: "{{ melody_bot_token }}" + +# Your Discord bot client ID +clientId: "{{ melody_client_id }}" + +# Your Genius API client access token (Found at https://genius.com/developers) +geniusApiKey: "{{ melody_genius_access_token }}" + +# The colour to use for embeds sent by the bot +embedColour: "#2F3136" + +# Whether analytics should be sent when starting the bot +# See https://github.com/NerdyTechy/Melody/wiki/Analytics +enableAnalytics: false + +# Settings to control the bot's player and controller +player: + # Leave VC when a song ends + leaveUponSongEnd: true + # Leave VC when a song is stopped + leaveUponSongStop: true + # Leave VC after X ms of inactivity + leaveOnEmptyDelay: 300000 # 5 minutes + # Deafen bot while playing + deafenBot: false + +# The emojis to be used in buttons for certain embeds +# See https://github.com/NerdyTechy/Melody/wiki/Using-Custom-Emojis +emojis: + stop: "⏹" + skip: "⏭" + queue: "📜" + pause: "⏯" + lyrics: "📜" + back: "⏮"
M
roles/node_stuff/templates/node.service.j2
→
roles/node_stuff/templates/node.service.j2
@@ -8,12 +8,12 @@ Restart=on-failure
StartLimitBurst=2 # Restart, but not more than once every x seconds: 30=30s, 600=10m StartLimitInterval=30 -WorkingDirectory={{ repo_dir }}{{ item }} +WorkingDirectory={{ repo_dir }}{{ melody }} ExecStart=/usr/bin/npm start User={{ user }} StandardOutput=syslog StandardError=syslog -SyslogIdentifier= {{ item }} +SyslogIdentifier= {{ melody }} [Install] WantedBy=multi-user.target