From 49b91c1af70e5a5484ea8c5b1054906ae934c739 Mon Sep 17 00:00:00 2001 From: Wojciech Janota Date: Wed, 28 Dec 2022 16:33:24 +0100 Subject: [PATCH] WIP --- .xinitrc | 1 + i3-config | 25 ++++++++++++++++++++++ inventory/nodes.yml | 5 +++++ provision-new-node.yml | 47 ++++++++++++++++++++++++++++++++++++++++++ tty-override.conf | 4 ++++ valhalla-config.yml | 5 +++++ 6 files changed, 87 insertions(+) create mode 100644 .xinitrc create mode 100644 i3-config create mode 100644 inventory/nodes.yml create mode 100644 provision-new-node.yml create mode 100644 tty-override.conf create mode 100644 valhalla-config.yml diff --git a/.xinitrc b/.xinitrc new file mode 100644 index 0000000..705250c --- /dev/null +++ b/.xinitrc @@ -0,0 +1 @@ +exec i3 \ No newline at end of file diff --git a/i3-config b/i3-config new file mode 100644 index 0000000..d1eac1a --- /dev/null +++ b/i3-config @@ -0,0 +1,25 @@ +set $mod Mod4 +font pango:DejaVu Sans Mono 8 +# start a terminal +bindsym $mod+Return exec urxvt + +# kill focused window +# bindsym $mod+Shift+q kill + +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# switch to workspace +bindsym $mod+1 workspace 1 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace 1 + +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +exec --no-startup-id "python /home/admin/client-application/valhalla-client synchronize" + +exec --no-startup-id "urxvt -e python /home/admin/client-application/valhalla-client runner" \ No newline at end of file diff --git a/inventory/nodes.yml b/inventory/nodes.yml new file mode 100644 index 0000000..c19e67b --- /dev/null +++ b/inventory/nodes.yml @@ -0,0 +1,5 @@ +nodes: + hosts: + client_machine: + ansible_host: 192.168.1.125 + ansible_port: 22 \ No newline at end of file diff --git a/provision-new-node.yml b/provision-new-node.yml new file mode 100644 index 0000000..6554baa --- /dev/null +++ b/provision-new-node.yml @@ -0,0 +1,47 @@ +--- +- name: Prepare environment (as admin) + hosts: nodes + remote_user: admin + + tasks: + - name: Install needed pip packages + ansible.builtin.command: + cmd: pip install picotui getmac pyaml requests psutil urllib3 + - name: Copy .xinitrc + ansible.builtin.copy: + src: ./.xinitrc + dest: /home/admin/.xinitrc + - name: Clone repository with client application + ansible.builtin.git: + dest: /home/nixen/client-application + repo: https://git.nixenos.ovh/engineering-degree/client-application.git + - name: Copy proper config file for valhalla + ansible.builtin.copy: + dest: /home/admin/config.yml + src: valhalla-config.yml + force: true + - name: Prepare i3 config directory + ansible.builtin.file: + state: directory + path: /home/admin/.config/i3 + - name: Copy i3config + ansible.builtin.copy: + src: ./i3-config + dest: /home/admin/.config/i3/config + force: true + +- name: Enable autologin + hosts: nodes + remote_user: ansible + + tasks: + - name: Create needed systemd directory + ansible.builtin.file: + state: directory + path: /etc/systemd/system/getty@tty1.service.d + become: true + - name: Copy new tty service file + ansible.builtin.copy: + src: ./tty-override.conf + dest: /etc/systemd/system/getty@tty1.service.d/override.conf + become: true \ No newline at end of file diff --git a/tty-override.conf b/tty-override.conf new file mode 100644 index 0000000..1e47348 --- /dev/null +++ b/tty-override.conf @@ -0,0 +1,4 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM +Type=idle \ No newline at end of file diff --git a/valhalla-config.yml b/valhalla-config.yml new file mode 100644 index 0000000..469d645 --- /dev/null +++ b/valhalla-config.yml @@ -0,0 +1,5 @@ +server_port: 5000 +server_url: "http://192.168.1.25" +server_password: "sekret_password" +server_access_username: "user" +client_loglevel: "DEBUG" \ No newline at end of file