Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

9 changed files with 80 additions and 76 deletions

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICLZGbt/we3JQ482/NYcdOKGoKDOj1MgmYFP2GDmjLw/ kyan@flandre

View file

@ -65,9 +65,3 @@
- { role: "acme", tags: ["acme"] } - { role: "acme", tags: ["acme"] }
- { role: "nginx", tags: ["nginx"] } - { role: "nginx", tags: ["nginx"] }
- { role: "www", tags: ["www"] } - { role: "www", tags: ["www"] }
- hosts: chat
roles:
- { role: "acme", tags: [ "acme" ] }
- { role: "nginx", tags: [ "nginx" ] }
- { role: "chat", tags: [ "chat" ] }

View file

@ -1,5 +1,3 @@
---
- hosts: chat - hosts: chat
roles: roles:
- { role: "common", tags: [ "common" ] } - { role: "common", tags: [ "common" ] }

View file

@ -1,11 +1,9 @@
--- ---
root_access: root_access:
- blackdragon - blackdragon
- ak - ak
- foobar - foobar
- polyfloyd - polyfloyd
nodejs_version: 22.x nodejs_version: 22.x
thelounge_version: "4.4.3" thelounge_version: "4.4.3"
thelounge_ldap_url: ldaps://ldap.bitlair.nl thelounge_ldap_url: ldaps://ldap.bitlair.nl

View file

@ -1,5 +0,0 @@
---
chat_user: thelounge
chat_group: thelounge
chat_configdir: "/etc/thelounge"

View file

@ -1,11 +0,0 @@
---
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: yes
- name: Restart thelounge
ansible.builtin.systemd:
name: thelounge
state: restarted
enabled: true

View file

@ -1,5 +1,3 @@
---
- name: Install dependencies - name: Install dependencies
ansible.builtin.apt: ansible.builtin.apt:
state: present state: present
@ -16,30 +14,25 @@
creates: /usr/share/keyrings/nodesource.gpg creates: /usr/share/keyrings/nodesource.gpg
notify: Apt update notify: Apt update
- name: Ensure directories are present - name: Install nodesource source list
ansible.builtin.file:
path: "{{ item.path }}"
owner: "{{ chat_user }}"
group: "{{ chat_group }}"
state: "{{ item.state | default('directory') }}"
mode: "{{ item.mode | default('0770') }}"
with_items:
- { path: "{{ chat_configdir }}" }
- { path: "/var/local/thelounge/users" }
- { path: "/var/local/thelounge/storage" }
notify:
- Restart thelounge
- name: Configure templates
ansible.builtin.template: ansible.builtin.template:
src: "{{ item.src }}" src: nodesource.list
dest: "{{ item.dest }}" dest: /etc/apt/sources.list.d/nodesource.list
owner: "{{ item.owner | default( chat_user ) }}" owner: root
group: "{{ item.group | default( chat_group ) }}" group: root
mode: "{{ item.mode | default('0640') }}" mode: 0644
with_items: notify: Apt update
- { src: "nodesource.list", dest: "/etc/apt/sources.list.d/nodesource.list", owner: root, group: root }
- { src: "nodejs-apt-pref", dest: "/etc/apt/preferences.d/nodejs", owner: root, group: root } - 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 - name: Install nodejs
ansible.builtin.apt: ansible.builtin.apt:
@ -76,16 +69,15 @@
ansible.builtin.shell: ansible.builtin.shell:
chdir: /opt/thelounge 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 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
notify:
- Restart thelounge
- name: Ensure user thelounge is present - name: Ensure user thelounge is present
ansible.builtin.user: user:
name: thelounge name: thelounge
createhome: no createhome: no
comment: The Lounge (IRC client) comment: The Lounge (IRC client)
system: yes system: yes
state: present state: present
become: yes
- name: Ensure JS and JSON syntax checking packages are installed - name: Ensure JS and JSON syntax checking packages are installed
yarn: yarn:
@ -95,18 +87,57 @@
with_items: with_items:
- esprima - esprima
- jsonlint - jsonlint
become: yes
changed_when: no # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in changed_when: no # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in
- name: Configure templates - name: Ensure thelounge configuration directory is present
ansible.builtin.template: file:
src: "{{ item.src }}" path: /etc/thelounge
dest: "{{ item.dest }}" owner: thelounge
owner: "{{ item.owner | default( chat_user ) }}" group: thelounge
group: "{{ item.group | default( chat_group ) }}" state: directory
mode: "{{ item.mode | default('0640') }}" become: yes
validate: "{{ item.validate | default([]) }}"
with_items:
- { src: "config.js.j2", dest: "/etc/thelounge/config.js", validate: 'esvalidate %s' }
- { src: "thelounge.service", dest: "/etc/systemd/system/thelounge.service", owner: root, group: root, notify: "Reload systemd" }
notify: "{{ item.notify | default('Restart thelounge') }}"
- 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: /var/local/thelounge/users
owner: thelounge
group: thelounge
state: directory
become: yes
- name: Ensure preview storage directory is present
file:
path: /var/local/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

View file

@ -3,7 +3,7 @@
module.exports = { module.exports = {
public: false, public: false,
port: 9000, port: 9000,
bind: "127.0.0.1", bind: "0.0.0.0",
reverseProxy: true, reverseProxy: true,
lockNetwork: true, lockNetwork: true,
maxHistory: 10000, maxHistory: 10000,
@ -49,8 +49,8 @@ module.exports = {
url: "{{ thelounge_ldap_url }}", url: "{{ thelounge_ldap_url }}",
primaryKey: "uid", primaryKey: "uid",
searchDN: { searchDN: {
rootDN: "{{ lookup('passwordstore', 'chat/thelounge/ldap_rootDN subkey=binddn') }}", rootDN: "{{ thelounge_ldap_rootDN }}",
rootPassword: "{{ lookup('passwordstore', 'chat/thelounge/ldap_rootDN') }}", rootPassword: "{{ thelounge_ldap_rootPassword }}",
filter: "{{ thelounge_ldap_filter }}", filter: "{{ thelounge_ldap_filter }}",
base: "{{ thelounge_ldap_base }}", base: "{{ thelounge_ldap_base }}",
}, },

View file

@ -4,8 +4,8 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
User={{ chat_user }} User=thelounge
Group={{ chat_group }} Group=thelounge
Type=simple Type=simple
Environment=THELOUNGE_HOME=/var/local/thelounge Environment=THELOUNGE_HOME=/var/local/thelounge
ExecStart=/usr/local/bin/thelounge start ExecStart=/usr/local/bin/thelounge start