aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inventory1
-rw-r--r--jumbotron.yml11
-rw-r--r--roles/jumbotron/files/autologin3
-rw-r--r--roles/jumbotron/files/bash_profile5
-rw-r--r--roles/jumbotron/files/eth0.network6
-rw-r--r--roles/jumbotron/files/getty@tty1.service.d/autologin.conf3
-rw-r--r--roles/jumbotron/files/getty@tty1.service.d/noclear.conf2
-rw-r--r--roles/jumbotron/files/irssi.config286
-rw-r--r--roles/jumbotron/meta/main.yml6
-rw-r--r--roles/jumbotron/tasks/autologin.yml32
-rw-r--r--roles/jumbotron/tasks/console.yml35
-rw-r--r--roles/jumbotron/tasks/irssi.yml35
-rw-r--r--roles/jumbotron/tasks/jumbotron.yml37
-rw-r--r--roles/jumbotron/tasks/main.yml42
-rw-r--r--roles/jumbotron/vars/main.yml28
15 files changed, 532 insertions, 0 deletions
diff --git a/inventory b/inventory
index 227a8de..445f1ce 100644
--- a/inventory
+++ b/inventory
@@ -1 +1,2 @@
space.labitat.dk
+jumbotron.s
diff --git a/jumbotron.yml b/jumbotron.yml
new file mode 100644
index 0000000..666465c
--- /dev/null
+++ b/jumbotron.yml
@@ -0,0 +1,11 @@
+---
+- hosts: jumbotron.s
+ pre_tasks:
+ - name: Detect chroot
+ set_fact:
+ chroot: "{{ ansible_connection == 'chroot' or 'container' in ansible_env }}"
+ tags: always
+ roles:
+ - jumbotron
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/files/autologin b/roles/jumbotron/files/autologin
new file mode 100644
index 0000000..f03f733
--- /dev/null
+++ b/roles/jumbotron/files/autologin
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec irssi
diff --git a/roles/jumbotron/files/bash_profile b/roles/jumbotron/files/bash_profile
new file mode 100644
index 0000000..a473f85
--- /dev/null
+++ b/roles/jumbotron/files/bash_profile
@@ -0,0 +1,5 @@
+if [[ "$(tty)" = '/dev/tty1' ]]; then
+ exec "$HOME/.autologin"
+fi
+
+. "$HOME/.bashrc"
diff --git a/roles/jumbotron/files/eth0.network b/roles/jumbotron/files/eth0.network
new file mode 100644
index 0000000..3e351ea
--- /dev/null
+++ b/roles/jumbotron/files/eth0.network
@@ -0,0 +1,6 @@
+[Match]
+Name=eth0
+
+[Network]
+DHCP=yes
+IPv6AcceptRA=yes
diff --git a/roles/jumbotron/files/getty@tty1.service.d/autologin.conf b/roles/jumbotron/files/getty@tty1.service.d/autologin.conf
new file mode 100644
index 0000000..6b0f2f1
--- /dev/null
+++ b/roles/jumbotron/files/getty@tty1.service.d/autologin.conf
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=-/sbin/agetty --autologin jumbotron --noclear %I $TERM
diff --git a/roles/jumbotron/files/getty@tty1.service.d/noclear.conf b/roles/jumbotron/files/getty@tty1.service.d/noclear.conf
new file mode 100644
index 0000000..52671c7
--- /dev/null
+++ b/roles/jumbotron/files/getty@tty1.service.d/noclear.conf
@@ -0,0 +1,2 @@
+[Service]
+TTYVTDisallocate=no
diff --git a/roles/jumbotron/files/irssi.config b/roles/jumbotron/files/irssi.config
new file mode 100644
index 0000000..8530f7d
--- /dev/null
+++ b/roles/jumbotron/files/irssi.config
@@ -0,0 +1,286 @@
+chatnets = {
+ Labitat = { type = "IRC"; };
+};
+
+servers = (
+ {
+ chatnet = "labitat";
+ address = "labitat.dk";
+ port = "6697";
+ use_tls = "yes";
+ autoconnect = "yes";
+ }
+);
+
+channels = (
+ {
+ name = "#labitat";
+ chatnet = "Labitat";
+ autojoin = "yes";
+ autosendcmd = "window 2";
+ }
+);
+
+aliases = {
+ ATAG = "WINDOW SERVER";
+ ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
+ B = "BAN";
+ BACK = "AWAY";
+ BANS = "BAN";
+ BYE = "QUIT";
+ C = "CLEAR";
+ CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
+ CHAT = "DCC CHAT";
+ CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }";
+ DATE = "TIME";
+ DEHIGHLIGHT = "DEHILIGHT";
+ DESCRIBE = "ACTION";
+ DHL = "DEHILIGHT";
+ EXEMPTLIST = "MODE $C +e";
+ EXIT = "QUIT";
+ GOTO = "SCROLLBACK GOTO";
+ HIGHLIGHT = "HILIGHT";
+ HL = "HILIGHT";
+ HOST = "USERHOST";
+ INVITELIST = "MODE $C +I";
+ J = "JOIN";
+ K = "KICK";
+ KB = "KICKBAN";
+ KN = "KNOCKOUT";
+ LAST = "LASTLOG";
+ LEAVE = "PART";
+ M = "MSG";
+ MUB = "UNBAN *";
+ N = "NAMES";
+ NMSG = "^MSG";
+ P = "PART";
+ Q = "QUERY";
+ RESET = "SET -default";
+ RUN = "SCRIPT LOAD";
+ SAY = "MSG *";
+ SB = "SCROLLBACK";
+ SBAR = "STATUSBAR";
+ SIGNOFF = "QUIT";
+ SV = "MSG * Irssi $J ($V) - http://www.irssi.org";
+ T = "TOPIC";
+ UB = "UNBAN";
+ UMODE = "MODE $N";
+ UNSET = "SET -clear";
+ W = "WHO";
+ WC = "WINDOW CLOSE";
+ WG = "WINDOW GOTO";
+ WJOIN = "JOIN -window";
+ WI = "WHOIS";
+ WII = "WHOIS $0 $0";
+ WL = "WINDOW LIST";
+ WN = "WINDOW NEW HIDDEN";
+ WQUERY = "QUERY -window";
+ WW = "WHOWAS";
+ 1 = "WINDOW GOTO 1";
+ 2 = "WINDOW GOTO 2";
+ 3 = "WINDOW GOTO 3";
+ 4 = "WINDOW GOTO 4";
+ 5 = "WINDOW GOTO 5";
+ 6 = "WINDOW GOTO 6";
+ 7 = "WINDOW GOTO 7";
+ 8 = "WINDOW GOTO 8";
+ 9 = "WINDOW GOTO 9";
+ 10 = "WINDOW GOTO 10";
+ 11 = "WINDOW GOTO 11";
+ 12 = "WINDOW GOTO 12";
+ 13 = "WINDOW GOTO 13";
+ 14 = "WINDOW GOTO 14";
+ 15 = "WINDOW GOTO 15";
+ 16 = "WINDOW GOTO 16";
+ 17 = "WINDOW GOTO 17";
+ 18 = "WINDOW GOTO 18";
+ 19 = "WINDOW GOTO 19";
+ 20 = "WINDOW GOTO 20";
+ 21 = "WINDOW GOTO 21";
+ 22 = "WINDOW GOTO 22";
+ 23 = "WINDOW GOTO 23";
+ 24 = "WINDOW GOTO 24";
+ 25 = "WINDOW GOTO 25";
+ 26 = "WINDOW GOTO 26";
+ 27 = "WINDOW GOTO 27";
+ 28 = "WINDOW GOTO 28";
+ 29 = "WINDOW GOTO 29";
+ 30 = "WINDOW GOTO 30";
+ 31 = "WINDOW GOTO 31";
+ 32 = "WINDOW GOTO 32";
+ 33 = "WINDOW GOTO 33";
+ 34 = "WINDOW GOTO 34";
+ 35 = "WINDOW GOTO 35";
+ 36 = "WINDOW GOTO 36";
+ 37 = "WINDOW GOTO 37";
+ 38 = "WINDOW GOTO 38";
+ 39 = "WINDOW GOTO 39";
+ 40 = "WINDOW GOTO 40";
+ 41 = "WINDOW GOTO 41";
+ 42 = "WINDOW GOTO 42";
+ 43 = "WINDOW GOTO 43";
+ 44 = "WINDOW GOTO 44";
+ 45 = "WINDOW GOTO 45";
+ 46 = "WINDOW GOTO 46";
+ 47 = "WINDOW GOTO 47";
+ 48 = "WINDOW GOTO 48";
+ 49 = "WINDOW GOTO 49";
+ 50 = "WINDOW GOTO 50";
+ 51 = "WINDOW GOTO 51";
+ 52 = "WINDOW GOTO 52";
+ 53 = "WINDOW GOTO 53";
+ 54 = "WINDOW GOTO 54";
+ 55 = "WINDOW GOTO 55";
+ 56 = "WINDOW GOTO 56";
+ 57 = "WINDOW GOTO 57";
+ 58 = "WINDOW GOTO 58";
+ 59 = "WINDOW GOTO 59";
+ 60 = "WINDOW GOTO 60";
+ 61 = "WINDOW GOTO 61";
+ 62 = "WINDOW GOTO 62";
+ 63 = "WINDOW GOTO 63";
+ 64 = "WINDOW GOTO 64";
+ 65 = "WINDOW GOTO 65";
+ 66 = "WINDOW GOTO 66";
+ 67 = "WINDOW GOTO 67";
+ 68 = "WINDOW GOTO 68";
+ 69 = "WINDOW GOTO 69";
+ 70 = "WINDOW GOTO 70";
+ 71 = "WINDOW GOTO 71";
+ 72 = "WINDOW GOTO 72";
+ 73 = "WINDOW GOTO 73";
+ 74 = "WINDOW GOTO 74";
+ 75 = "WINDOW GOTO 75";
+ 76 = "WINDOW GOTO 76";
+ 77 = "WINDOW GOTO 77";
+ 78 = "WINDOW GOTO 78";
+ 79 = "WINDOW GOTO 79";
+ 80 = "WINDOW GOTO 80";
+ 81 = "WINDOW GOTO 81";
+ 82 = "WINDOW GOTO 82";
+ 83 = "WINDOW GOTO 83";
+ 84 = "WINDOW GOTO 84";
+ 85 = "WINDOW GOTO 85";
+ 86 = "WINDOW GOTO 86";
+ 87 = "WINDOW GOTO 87";
+ 88 = "WINDOW GOTO 88";
+ 89 = "WINDOW GOTO 89";
+ 90 = "WINDOW GOTO 90";
+ 91 = "WINDOW GOTO 91";
+ 92 = "WINDOW GOTO 92";
+ 93 = "WINDOW GOTO 93";
+ 94 = "WINDOW GOTO 94";
+ 95 = "WINDOW GOTO 95";
+ 96 = "WINDOW GOTO 96";
+ 97 = "WINDOW GOTO 97";
+ 98 = "WINDOW GOTO 98";
+ 99 = "WINDOW GOTO 99";
+};
+
+statusbar = {
+
+ items = {
+
+ barstart = "{sbstart}";
+ barend = "{sbend}";
+
+ topicbarstart = "{topicsbstart}";
+ topicbarend = "{topicsbend}";
+
+ time = "{sb $Z}";
+ user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";
+
+ window = "{sb $winref:$tag/$itemname{sbmode $M}}";
+ window_empty = "{sb $winref{sbservertag $tag}}";
+
+ prompt = "{prompt $[.15]itemname}";
+ prompt_empty = "{prompt $winname}";
+
+ topic = " $topic";
+ topic_empty = " Irssi v$J - http://www.irssi.org";
+
+ lag = "{sb Lag: $0-}";
+ act = "{sb Act: $0-}";
+ more = "-- more --";
+ };
+
+ default = {
+
+ window = {
+
+ disabled = "no";
+ type = "window";
+ placement = "bottom";
+ position = "1";
+ visible = "active";
+
+ items = {
+ barstart = { priority = "100"; };
+ time = { };
+ user = { };
+ window = { };
+ window_empty = { };
+ lag = { priority = "-1"; };
+ act = { priority = "10"; };
+ more = { priority = "-1"; alignment = "right"; };
+ barend = { priority = "100"; alignment = "right"; };
+ };
+ };
+
+ window_inact = {
+
+ type = "window";
+ placement = "bottom";
+ position = "1";
+ visible = "inactive";
+
+ items = {
+ barstart = { priority = "100"; };
+ window = { };
+ window_empty = { };
+ more = { priority = "-1"; alignment = "right"; };
+ barend = { priority = "100"; alignment = "right"; };
+ };
+ };
+
+ prompt = {
+
+ type = "root";
+ placement = "bottom";
+ position = "100";
+ visible = "always";
+
+ items = {
+ prompt = { priority = "-1"; };
+ prompt_empty = { priority = "-1"; };
+ input = { priority = "10"; };
+ };
+ };
+
+ topic = {
+
+ type = "root";
+ placement = "top";
+ position = "1";
+ visible = "always";
+
+ items = {
+ topicbarstart = { priority = "100"; };
+ topic = { };
+ topic_empty = { };
+ topicbarend = { priority = "100"; alignment = "right"; };
+ };
+ };
+ };
+};
+settings = {
+ core = {
+ real_name = "John Jumbotron";
+ user_name = "jumbotron";
+ nick = "Jumbotron";
+ recode_out_default_charset = "utf8";
+ recode_fallback = "ISO-8859-15";
+
+ };
+ "fe-text" = { actlist_sort = "refnum"; };
+};
diff --git a/roles/jumbotron/meta/main.yml b/roles/jumbotron/meta/main.yml
new file mode 100644
index 0000000..731a8f2
--- /dev/null
+++ b/roles/jumbotron/meta/main.yml
@@ -0,0 +1,6 @@
+---
+dependencies:
+- role: raspbian
+- role: users
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/tasks/autologin.yml b/roles/jumbotron/tasks/autologin.yml
new file mode 100644
index 0000000..f9052ba
--- /dev/null
+++ b/roles/jumbotron/tasks/autologin.yml
@@ -0,0 +1,32 @@
+---
+- name: Make sure getty@tty1.service.d exists
+ file:
+ path: '/etc/systemd/system/getty@tty1.service.d'
+ state: directory
+ owner: root
+ group: root
+ mode: 0755
+
+- name: Register existing getty@tty1 config
+ find:
+ paths: '/etc/systemd/system/getty@tty1.service.d/'
+ register: getty_tty1_existing
+
+- name: Autologin jumbotron on tty1
+ copy:
+ dest: '/etc/systemd/system/getty@tty1.service.d/'
+ src: '{{ item }}'
+ owner: root
+ group: root
+ mode: 0644
+ with_fileglob: 'getty@tty1.service.d/*'
+ register: getty_tty1_created
+
+- name: Delete unneeded tty1 configuration
+ file:
+ path: '{{ item }}'
+ state: absent
+ with_items: "{{ getty_tty1_existing.files|map(attribute='path')|list }}"
+ when: "item not in getty_tty1_created.results|map(attribute='dest')"
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/tasks/console.yml b/roles/jumbotron/tasks/console.yml
new file mode 100644
index 0000000..55ede76
--- /dev/null
+++ b/roles/jumbotron/tasks/console.yml
@@ -0,0 +1,35 @@
+---
+- name: Configure VGA output
+ lineinfile:
+ path: '/boot/config.txt'
+ regexp: "^{{ item.rsplit('=', 1)[0] }}="
+ line: '{{ item }}'
+ with_items:
+ - 'dtoverlay=vga666'
+ - 'enable_dpi_lcd=1'
+ - 'display_default_lcd=1'
+ - 'dpi_group=2'
+ - 'dpi_mode=35'
+ - 'dtparam=spi=off'
+ - 'dtparam=i2c_arm=off'
+
+- name: Configure console font
+ lineinfile:
+ path: '/etc/default/console-setup'
+ regexp: "^{{ item.split('=', 1)[0] }}="
+ line: '{{ item }}'
+ with_items:
+ - 'CHARMAP="UTF-8"'
+ - 'CODESET="Lat15"'
+ - 'FONTFACE="Terminus"'
+ - 'FONTSIZE="32x16"'
+
+- name: Configure console keyboard
+ lineinfile:
+ path: '/etc/default/keyboard'
+ regexp: "^{{ item.split('=', 1)[0] }}="
+ line: '{{ item }}'
+ with_items:
+ - 'XKBLAYOUT="dk"'
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/tasks/irssi.yml b/roles/jumbotron/tasks/irssi.yml
new file mode 100644
index 0000000..d3dd003
--- /dev/null
+++ b/roles/jumbotron/tasks/irssi.yml
@@ -0,0 +1,35 @@
+---
+- name: Install irssi
+ apt:
+ name: irssi
+ state: present
+ tags:
+ - packages
+
+- name: Make sure ~jumbotron/.irssi exists
+ file:
+ path: '~jumbotron/{{ item }}'
+ state: directory
+ owner: jumbotron
+ group: users
+ mode: 0755
+ with_items:
+ - .irssi
+ - .irssi/scripts
+ - .irssi/scripts/autorun
+
+- name: Configure irssi
+ copy:
+ dest: '~jumbotron/.irssi/config'
+ src: 'irssi.config'
+ owner: jumbotron
+ group: users
+ mode: 0644
+
+- name: Add bot-script
+ file:
+ path: '~jumbotron/.irssi/scripts/autorun/jumbowatch.pl'
+ src: '../../../jumbotron/jumbowatch.pl'
+ state: link
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/tasks/jumbotron.yml b/roles/jumbotron/tasks/jumbotron.yml
new file mode 100644
index 0000000..0b6f1a7
--- /dev/null
+++ b/roles/jumbotron/tasks/jumbotron.yml
@@ -0,0 +1,37 @@
+---
+- name: Create jumbotron user
+ user:
+ comment: 'John Jumbotron'
+ name: jumbotron
+ shell: '/bin/bash'
+ uid: 3000
+ group: users
+
+- name: Create jumbotron dotfiles
+ copy:
+ dest: '~jumbotron/.{{ item.name }}'
+ src: '{{ item.name }}'
+ owner: jumbotron
+ group: users
+ mode: '{{ item.mode }}'
+ with_items:
+ - { name: bash_profile, mode: 0o644 }
+ - { name: autologin, mode: 0o755 }
+
+- name: Check out jumbotron repo
+ git:
+ dest: '~jumbotron/jumbotron'
+ repo: 'https://github.com/labitat/jumbotron.git'
+ accept_hostkey: yes
+ clone: yes
+ update: yes
+ remote: origin
+
+- name: Make sure jumbotron owns git repo
+ file:
+ dest: '~jumbotron/jumbotron'
+ owner: jumbotron
+ group: users
+ recurse: yes
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/tasks/main.yml b/roles/jumbotron/tasks/main.yml
new file mode 100644
index 0000000..e7c45a8
--- /dev/null
+++ b/roles/jumbotron/tasks/main.yml
@@ -0,0 +1,42 @@
+---
+- name: Install network configuration
+ copy:
+ dest: '/etc/systemd/network/10-eth0.network'
+ src: eth0.network
+ owner: root
+ group: root
+ mode: 0644
+ tags:
+ - networkd-config
+
+- name: Disable unused services
+ systemd:
+ name: '{{ item }}'
+ enabled: no
+ with_items:
+ - hciuart.service
+ - remote-fs.target
+ - rsync.service
+ - bluetooth.service
+ tags:
+ - systemd
+
+- name: Remove broken service links
+ file:
+ path: '{{ item }}'
+ state: absent
+ with_items:
+ - /etc/systemd/system/bluetooth.target.wants
+ tags:
+ - systemd
+
+- import_tasks: console.yml
+ tags: console
+- import_tasks: jumbotron.yml
+ tags: jumbotron
+- import_tasks: autologin.yml
+ tags: autologin
+- import_tasks: irssi.yml
+ tags: irssi
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/jumbotron/vars/main.yml b/roles/jumbotron/vars/main.yml
new file mode 100644
index 0000000..f1a105d
--- /dev/null
+++ b/roles/jumbotron/vars/main.yml
@@ -0,0 +1,28 @@
+---
+hostname: 'jumbotron'
+
+resolved_conf:
+ 'Resolve.DNSSEC': 'yes'
+
+apt_sources:
+ raspbian:
+ components:
+ - main
+ - contrib
+ - no-free
+ - rpi
+
+apt_packages:
+ 'logrotate': absent
+ 'cron': absent
+
+ 'git': present # to check out jumbotron repo
+ 'wiringpi': present # for jumbotron_ping script
+ 'console-setup': present # for proper console font/keyboard
+ 'irssi': present
+
+ # jumbowatch.pl dependencies
+ 'libjson-perl': present
+ 'libwww-perl': present
+
+# vim: set ts=2 sw=2 et: