- name: Install dependencies ansible.builtin.apt: state: present pkg: - gpg - apt-transport-https - build-essential - authbind - name: Import nodesource signing key ansible.builtin.shell: cmd: curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg args: creates: /usr/share/keyrings/nodesource.gpg notify: Apt update - name: Install nodesource source list ansible.builtin.template: src: nodesource.list dest: /etc/apt/sources.list.d/nodesource.list owner: root group: root mode: 0644 notify: Apt update - name: Install nodejs apt preference ansible.builtin.template: src: nodejs-apt-pref dest: /etc/apt/preferences.d/nodejs owner: root group: root mode: 0644 notify: Apt update - ansible.builtin.meta: flush_handlers - name: Install nodejs ansible.builtin.apt: name: nodejs - name: Install yarn ansible.builtin.shell: cmd: npm install --global yarn - stat: path=/opt/thelounge register: src_path - name: Retreive thelounge source block: - name: Checkout source ansible.builtin.git: repo: 'https://github.com/revspace/thelounge.git' dest: /opt/thelounge version: 9d6dc83 force: true - name: Copy patch ansible.builtin.template: src: thelounge-bitlair.patch dest: /tmp/thelounge-bitlair.patch - name: Apply patch ansible.builtin.shell: chdir: /opt/thelounge cmd: git apply /tmp/thelounge-bitlair.patch when: not src_path.stat.exists - name: Build and install thelounge ansible.builtin.shell: chdir: /opt/thelounge cmd: yarn add sharp --ignore-engines && yarn install --include-optional sharp && NODE_ENV=production yarn build && ln -sf $(pwd)/index.js /usr/local/bin/thelounge - name: Ensure user thelounge is present user: name: thelounge createhome: no comment: The Lounge (IRC client) system: yes state: present become: yes - name: Give thelounge access to port 113 via authbind file: path: /etc/authbind/byport/113 owner: thelounge group: thelounge mode: 0500 state: touch - name: Ensure JS and JSON syntax checking packages are installed yarn: name: "{{ item }}" global: yes state: latest # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in with_items: - esprima - jsonlint become: yes changed_when: no # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in - name: Ensure thelounge configuration directory is present file: path: /etc/thelounge owner: thelounge group: thelounge state: directory become: yes - name: Ensure The Lounge is configured template: src: config.js.j2 dest: /etc/thelounge/config.js owner: thelounge group: thelounge validate: 'esvalidate %s' become: yes - name: Ensure user configuration directory is present file: path: /etc/thelounge/users owner: thelounge group: thelounge state: directory become: yes - name: Ensure preview storage directory is present file: path: /etc/thelounge/storage owner: thelounge group: thelounge mode: "0770" state: directory become: yes - name: Copy service file to systemd directory ansible.builtin.template: src: thelounge.service # Path to your service file in your Ansible project dest: /etc/systemd/system/thelounge.service owner: root group: root mode: '0644' - name: Reload systemd daemon to read new service file ansible.builtin.systemd: daemon_reload: yes - name: Enable and start the service ansible.builtin.systemd: name: thelounge state: started enabled: yes