diff --git a/bitlair.yaml b/bitlair.yaml index b463ff7..19de646 100644 --- a/bitlair.yaml +++ b/bitlair.yaml @@ -71,7 +71,3 @@ - { role: "acme", tags: [ "acme" ] } - { role: "nginx", tags: [ "nginx" ] } - { role: "chat", tags: [ "chat" ] } - -- hosts: ldap - roles: - - { role: "common", tags: [ "common" ] } diff --git a/chat.yaml b/chat.yaml index fdf3a9a..a5b4c42 100644 --- a/chat.yaml +++ b/chat.yaml @@ -6,5 +6,4 @@ - { role: "nft", tags: [ "nft" ] } - { role: "nginx", tags: [ "nginx" ] } - { role: "acme", tags: [ "acme" ] } - - { role: "nodesource", tags: [ "nodesource" ] } - { role: "chat", tags: [ "chat" ] } diff --git a/inventory b/inventory index eca431d..86d1bea 100644 --- a/inventory +++ b/inventory @@ -50,9 +50,6 @@ homeassistant.bitlair.nl [chat] chat.bitlair.nl -[ldap] -ldap-new.bitlair.nl - [debian:children] bank fotos diff --git a/pad.yaml b/pad.yaml index 1d35c0d..380e790 100644 --- a/pad.yaml +++ b/pad.yaml @@ -9,5 +9,4 @@ - { role: "nft", tags: [ "nft" ] } - { role: "acme", tags: [ "acme" ] } - { role: "nginx", tags: [ "nginx" ] } - - { role: "nodesource", tags: [ "nodesource" ] } - { role: "etherpad", tags: [ "etherpad" ] } diff --git a/roles/bank/templates/git.cron b/roles/bank/templates/git.cron index b334260..b703657 100644 --- a/roles/bank/templates/git.cron +++ b/roles/bank/templates/git.cron @@ -1,4 +1,4 @@ SHELL=/bin/bash -#m h dom mon dow user command - */10 * * * * {{ bank_user }} (cd /home/{{ bank_user }}/data.git && git pull -r && git push && git gc --auto && cp revbank.products ../revbank.products) +#m h dom mon dow user command + 0 * * * * {{ bank_user }} (cd /home/{{ bank_user }}/data.git && git pull -r && git push && git gc --auto && cp revbank.products ../revbank.products) diff --git a/roles/chat/tasks/main.yaml b/roles/chat/tasks/main.yaml index cad172f..7b74982 100644 --- a/roles/chat/tasks/main.yaml +++ b/roles/chat/tasks/main.yaml @@ -4,8 +4,17 @@ ansible.builtin.apt: state: present pkg: + - gpg + - apt-transport-https - build-essential - - nodejs + +- 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: Ensure directories are present ansible.builtin.file: @@ -21,15 +30,26 @@ notify: - Restart thelounge +- name: Configure templates + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner | default( chat_user ) }}" + group: "{{ item.group | default( chat_group ) }}" + mode: "{{ item.mode | default('0640') }}" + with_items: + - { 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 ansible.builtin.apt: + name: nodejs - name: Install yarn ansible.builtin.shell: cmd: npm install --global yarn -- ansible.builtin.stat: - path: /opt/thelounge +- stat: path=/opt/thelounge register: src_path - name: Retreive thelounge source @@ -68,14 +88,14 @@ state: present - name: Ensure JS and JSON syntax checking packages are installed - community.general.yarn: + yarn: name: "{{ item }}" global: yes - # state: latest # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in + state: latest # FIXME: Remove when https://github.com/ansible/ansible/pull/39557 makes it in with_items: - esprima - jsonlint - # 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 ansible.builtin.template: diff --git a/roles/chat/templates/config.js.j2 b/roles/chat/templates/config.js.j2 index 69b1727..ba12695 100644 --- a/roles/chat/templates/config.js.j2 +++ b/roles/chat/templates/config.js.j2 @@ -3,8 +3,7 @@ module.exports = { public: false, port: 9000, - bind: "0.0.0.0", - host: "127.0.0.1", + bind: "127.0.0.1", reverseProxy: true, lockNetwork: true, maxHistory: 10000, diff --git a/roles/chat/templates/nodejs-apt-pref b/roles/chat/templates/nodejs-apt-pref new file mode 100644 index 0000000..6193912 --- /dev/null +++ b/roles/chat/templates/nodejs-apt-pref @@ -0,0 +1,5 @@ +# {{ ansible_managed }} + +Package: nodejs +Pin: origin deb.nodesource.com +Pin-Priority: 1000 diff --git a/roles/chat/templates/nodesource.list b/roles/chat/templates/nodesource.list new file mode 100644 index 0000000..6ac9322 --- /dev/null +++ b/roles/chat/templates/nodesource.list @@ -0,0 +1,3 @@ +# {{ ansible_managed }} + +deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main diff --git a/roles/etherpad/defaults/main.yaml b/roles/etherpad/defaults/main.yaml index 4a05b97..7e1952a 100644 --- a/roles/etherpad/defaults/main.yaml +++ b/roles/etherpad/defaults/main.yaml @@ -1,3 +1,4 @@ +nodejs_version: 22.x etherpad_db_user: etherpad etherpad_db_password: "{{ lookup('password', '/tmp/etherpad_db_password length=32') }}" etherpad_db_name: etherpad diff --git a/roles/etherpad/tasks/main.yaml b/roles/etherpad/tasks/main.yaml index e19835c..38dc4d3 100644 --- a/roles/etherpad/tasks/main.yaml +++ b/roles/etherpad/tasks/main.yaml @@ -3,10 +3,43 @@ - name: Install dependencies ansible.builtin.apt: state: present - pkg: - - nodejs + pkg: + - gpg - postgresql - python3-psycopg2 + - apt-transport-https + +- 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: Add database user become: true diff --git a/roles/nodesource/templates/nodejs-apt-pref b/roles/etherpad/templates/nodejs-apt-pref similarity index 100% rename from roles/nodesource/templates/nodejs-apt-pref rename to roles/etherpad/templates/nodejs-apt-pref diff --git a/roles/nodesource/templates/nodesource.list b/roles/etherpad/templates/nodesource.list similarity index 56% rename from roles/nodesource/templates/nodesource.list rename to roles/etherpad/templates/nodesource.list index 3600170..43defab 100644 --- a/roles/nodesource/templates/nodesource.list +++ b/roles/etherpad/templates/nodesource.list @@ -1,3 +1,3 @@ # {{ ansible_managed }} -deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodesource_version }} nodistro main +deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main diff --git a/roles/git-server/templates/cronjob b/roles/git-server/templates/cronjob index 659b668..9a71799 100644 --- a/roles/git-server/templates/cronjob +++ b/roles/git-server/templates/cronjob @@ -1,4 +1,4 @@ # {{ ansible_managed }} -#m h dom mon dow user command - 0 2 * * 1 root {{ git_server_working_dir }}/update.sh +#m h dom mon dow user command + 0 2 * * 1 {{ git_server_user }} {{ git_server_working_dir }}/update.sh diff --git a/roles/nodesource/defaults/main.yaml b/roles/nodesource/defaults/main.yaml deleted file mode 100644 index 6ab2293..0000000 --- a/roles/nodesource/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -nodesource_version: 22.x diff --git a/roles/nodesource/handlers/main.yaml b/roles/nodesource/handlers/main.yaml deleted file mode 100644 index e7a11ce..0000000 --- a/roles/nodesource/handlers/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- ansible.builtin.import_tasks: - file: ../../common/handlers/main.yaml diff --git a/roles/nodesource/tasks/main.yaml b/roles/nodesource/tasks/main.yaml deleted file mode 100644 index f35afde..0000000 --- a/roles/nodesource/tasks/main.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Install dependencies - ansible.builtin.apt: - state: present - pkg: - - apt-transport-https - - gpg - -- name: Import nodesource signing key - ansible.builtin.shell: - cmd: | - set -o pipefail - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg - executable: /bin/bash - args: - creates: /usr/share/keyrings/nodesource.gpg - notify: apt update - -- name: Install nodesource apt files - ansible.builtin.template: - src: nodesource.list - dest: /etc/apt/sources.list.d/nodesource.list - owner: root - group: root - mode: 0644 - notify: apt update - with_items: - - src: nodesource.list - dest: /etc/apt/sources.list.d/nodesource.list - - src: nodejs-apt-pref - dest: /etc/apt/preferences.d/nodejs - -- ansible.builtin.meta: flush_handlers diff --git a/roles/services/tasks/discord_bot.yaml b/roles/services/tasks/discord_bot.yaml index 19a659f..1889db4 100644 --- a/roles/services/tasks/discord_bot.yaml +++ b/roles/services/tasks/discord_bot.yaml @@ -21,7 +21,7 @@ - name: Clone source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/discord-bot.git + repo: https://github.com/bitlair/discord-bot.git version: main dest: /var/lib/discord-bot accept_hostkey: yes diff --git a/roles/services/tasks/mastodon_spacestate.yaml b/roles/services/tasks/mastodon_spacestate.yaml index 9babbbd..53f979e 100644 --- a/roles/services/tasks/mastodon_spacestate.yaml +++ b/roles/services/tasks/mastodon_spacestate.yaml @@ -7,7 +7,7 @@ - name: Clone source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/mastodon-spacestate.git + repo: https://github.com/bitlair/mastodon-spacestate.git version: main dest: /var/lib/mastodon-spacestate accept_hostkey: yes diff --git a/roles/services/tasks/spacestated.yaml b/roles/services/tasks/spacestated.yaml index e35851e..92a0ace 100644 --- a/roles/services/tasks/spacestated.yaml +++ b/roles/services/tasks/spacestated.yaml @@ -21,7 +21,7 @@ - name: Clone source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/spacestated.git + repo: https://github.com/bitlair/spacestated.git version: main dest: /var/lib/spacestated/spacestated accept_hostkey: yes diff --git a/roles/services/tasks/wifi_mqtt.yaml b/roles/services/tasks/wifi_mqtt.yaml index d69aa34..8bb8353 100644 --- a/roles/services/tasks/wifi_mqtt.yaml +++ b/roles/services/tasks/wifi_mqtt.yaml @@ -8,7 +8,7 @@ - name: Clone source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/wifi-mqtt.git + repo: https://github.com/bitlair/wifi-mqtt.git version: main dest: /var/lib/wifi-mqtt accept_hostkey: yes diff --git a/roles/www/tasks/calendar.yaml b/roles/www/tasks/calendar.yaml index 16c027e..f6513a8 100644 --- a/roles/www/tasks/calendar.yaml +++ b/roles/www/tasks/calendar.yaml @@ -5,7 +5,7 @@ - name: Clone source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/wiki-calendar-exporter.git + repo: https://github.com/bitlair/calendar-parser.git version: main dest: /usr/local/src/bitlair-calendar accept_hostkey: yes diff --git a/roles/www/tasks/spaceapi.yaml b/roles/www/tasks/spaceapi.yaml index e6b7954..7c8a494 100644 --- a/roles/www/tasks/spaceapi.yaml +++ b/roles/www/tasks/spaceapi.yaml @@ -1,7 +1,7 @@ --- - name: Clone spaceapi source ansible.builtin.git: - repo: https://git.bitlair.nl/bitlair/spaceapi.git + repo: https://github.com/bitlair/spaceapi.git version: main dest: /opt/spaceapi accept_hostkey: true