diff --git a/playbook.yml b/playbook.yml index 7590f43..5f68400 100644 --- a/playbook.yml +++ b/playbook.yml @@ -20,7 +20,7 @@ roles: - competitor-services-nginx - code-submitter - - discord-gated-entry + - discord-bot - name: Kit services hosts: kitsvcs diff --git a/roles/discord-bot/README.md b/roles/discord-bot/README.md new file mode 100644 index 0000000..6092d0f --- /dev/null +++ b/roles/discord-bot/README.md @@ -0,0 +1,5 @@ +# SR Discord Bot + +A Bot for gating entry to a Discord server. + +This is a deployment of . diff --git a/roles/discord-bot/handlers/main.yml b/roles/discord-bot/handlers/main.yml new file mode 100644 index 0000000..ffc5994 --- /dev/null +++ b/roles/discord-bot/handlers/main.yml @@ -0,0 +1,4 @@ +- name: Restart discord-bot + service: + name: discord-bot + state: restarted diff --git a/roles/discord-gated-entry/tasks/main.yml b/roles/discord-bot/tasks/main.yml similarity index 60% rename from roles/discord-gated-entry/tasks/main.yml rename to roles/discord-bot/tasks/main.yml index 8039a41..2ebf401 100644 --- a/roles/discord-gated-entry/tasks/main.yml +++ b/roles/discord-bot/tasks/main.yml @@ -20,13 +20,13 @@ - name: Download git: - repo: https://github.com/srobo/discord-gated-entry + repo: https://github.com/srobo/discord-bot dest: "{{ install_dir }}" force: true - version: 476a9c942f580e2950048c2b95e15429cb0ae33d + version: b12c95980701d6c090f7b0da16499475011b0026 notify: - Restart discord-gated-entry - register: discord_gated_entry_repo + Restart discord-bot + register: discord_bot_repo become_user: discord - name: Bootstrap environment file @@ -37,27 +37,27 @@ mode: "0600" owner: discord notify: - Restart discord-gated-entry + Restart discord-bot - name: Install virtual environment pip: virtualenv: "{{ venv_dir }}" - requirements: "{{ install_dir }}/requirements.txt" + name: file://{{ install_dir }} notify: - Restart discord-gated-entry + Restart discord-bot become_user: discord - when: discord_gated_entry_repo.changed # noqa: no-handler - Use a handler to ensure execution order + when: discord_bot_repo.changed # noqa: no-handler - Use a handler to ensure execution order - name: Install systemd service template: - src: discord-gated-entry.service - dest: /etc/systemd/system/discord-gated-entry.service + src: discord-bot.service + dest: /etc/systemd/system/discord-bot.service mode: "0644" notify: - Restart discord-gated-entry + Restart discord-bot - name: Enable service service: - name: discord-gated-entry + name: discord-bot state: started enabled: true diff --git a/roles/discord-gated-entry/templates/discord-gated-entry.service b/roles/discord-bot/templates/discord-bot.service similarity index 50% rename from roles/discord-gated-entry/templates/discord-gated-entry.service rename to roles/discord-bot/templates/discord-bot.service index 2c36f8f..8e6e74b 100644 --- a/roles/discord-gated-entry/templates/discord-gated-entry.service +++ b/roles/discord-bot/templates/discord-bot.service @@ -1,5 +1,5 @@ [Unit] -Description=Discord bot for gated entry +Description=Discord bot After=network.target [Service] @@ -8,9 +8,9 @@ User=discord Type=simple WorkingDirectory={{ install_dir }} -RuntimeDirectory=discord-gated-entry +RuntimeDirectory=discord-bot -ExecStart=/srv/discord-gated-entry/venv/bin/python main.py +ExecStart={{ venv_dir }}/bin/python -m sr.discord_bot [Install] WantedBy=multi-user.target diff --git a/roles/discord-bot/vars/main.yml b/roles/discord-bot/vars/main.yml new file mode 100644 index 0000000..249c8c0 --- /dev/null +++ b/roles/discord-bot/vars/main.yml @@ -0,0 +1,2 @@ +install_dir: /srv/discord-bot +venv_dir: "{{ install_dir }}/venv" diff --git a/roles/discord-gated-entry/README.md b/roles/discord-gated-entry/README.md deleted file mode 100644 index 2dbe732..0000000 --- a/roles/discord-gated-entry/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Discord Gated Entry - -A Bot for gating entry to a Discord server. - -This is a deployment of . diff --git a/roles/discord-gated-entry/handlers/main.yml b/roles/discord-gated-entry/handlers/main.yml deleted file mode 100644 index f9407ff..0000000 --- a/roles/discord-gated-entry/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: Restart discord-gated-entry - service: - name: discord-gated-entry - state: restarted diff --git a/roles/discord-gated-entry/vars/main.yml b/roles/discord-gated-entry/vars/main.yml deleted file mode 100644 index ec030e1..0000000 --- a/roles/discord-gated-entry/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -install_dir: /srv/discord-gated-entry -venv_dir: "{{ install_dir }}/venv"