From c8227ef3c4bc042937913b4afade2dd15ef7912b Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 11:41:24 -0500 Subject: [PATCH 01/26] minetest for rpi initial checkin --- roles/minetest/defaults/main.yml | 10 ++ roles/minetest/tasks/calc_vars.yml | 13 +++ roles/minetest/tasks/main.yml | 95 +++++++++++++++++++ roles/minetest/tasks/minetest_install.yml | 76 +++++++++++++++ .../minetest/tasks/minetest_install_mods.yml | 28 ++++++ roles/minetest/tasks/rpi_minetest_install.yml | 71 ++++++++++++++ .../templates/minetest-serve.service.j2 | 14 +++ roles/minetest/templates/minetest.conf.j2 | 32 +++++++ 8 files changed, 339 insertions(+) create mode 100644 roles/minetest/defaults/main.yml create mode 100644 roles/minetest/tasks/calc_vars.yml create mode 100644 roles/minetest/tasks/main.yml create mode 100644 roles/minetest/tasks/minetest_install.yml create mode 100644 roles/minetest/tasks/minetest_install_mods.yml create mode 100644 roles/minetest/tasks/rpi_minetest_install.yml create mode 100644 roles/minetest/templates/minetest-serve.service.j2 create mode 100644 roles/minetest/templates/minetest.conf.j2 diff --git a/roles/minetest/defaults/main.yml b/roles/minetest/defaults/main.yml new file mode 100644 index 000000000..141df1bdc --- /dev/null +++ b/roles/minetest/defaults/main.yml @@ -0,0 +1,10 @@ +minetest_runas_user: minetest +minetest_runas_group: minetest + +minetest_port: 30000 +minetest_config_file: /etc/minetest/minetest.conf +minetest_server_admin: Admin + +# Installation Variables +minetest_install: False +minetest_enabled: False diff --git a/roles/minetest/tasks/calc_vars.yml b/roles/minetest/tasks/calc_vars.yml new file mode 100644 index 000000000..5720f6143 --- /dev/null +++ b/roles/minetest/tasks/calc_vars.yml @@ -0,0 +1,13 @@ +# For rpi installs + +- name: Set some facts for rpi + set_fact: + minetest_server_bin: /library/games/minetest/bin/minetestserver + minetest_world_dir: /library/games/minetest/worlds/world + minetest_game_dir: /library/games/minetest/games/minetest_game +# only works if server run as root + minetest_runas_user: root + minetest_runas_group: root + when: is_rpi + +# For other installs TBD diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml new file mode 100644 index 000000000..8bd190481 --- /dev/null +++ b/roles/minetest/tasks/main.yml @@ -0,0 +1,95 @@ +# Give message and end play for unsupported platforms +# For now only support rpi + +- name: No install except Raspberry Pi for now + debug: + msg: "No install except Raspberry Pi for now." + when: not is_rpi + +- name: Terminate play + meta: end_play + when: not is_rpi + +- include_tasks: calc_vars.yml + +- name: Ensure group minetest exists + group: + name: "{{ minetest_runas_group }}" + state: present + when: minetest_runas_user != 'root' + +- name: Create minetest user + user: + name: "{{ minetest_runas_user }}" + groups: "{{ minetest_runas_group }}" + state: present + createhome: no + shell: /bin/false + when: minetest_runas_user != 'root' + +- name: Check for minetest world file + stat: + path: "{{ minetest_world_dir }}/world.mt" + register: minetest_world + +# rpi only +- include_tasks: rpi_minetest_install.yml + when: minetest_install and not minetest_world.stat.exists and is_rpi + +# not rpi +- include_tasks: minetest_install.yml + when: minetest_install and not minetest_world.stat.exists and not is_rp + +# Install mods +- include: minetest_install_mods.yml + with_items: + - name: moreblocks + url: https://github.com/minetest-mods/moreblocks/archive/master.zip + - name: moreores + url: https://github.com/Calinou/moreores/archive/master.zip + - name: basic_materials + url: https://gitlab.com/VanessaE/basic_materials/-/archive/master/basic_materials-master.zip + - name: mesecons + url: https://github.com/minetest-mods/mesecons/archive/master.zip + - name: digilines + url: https://github.com/minetest-mods/digilines/archive/master.zip + - name: pipeworks + url: https://github.com/minetest-mods/pipeworks/archive/master.zip + - name: Minetest-WorldEdit + url: https://github.com/Uberi/Minetest-WorldEdit/archive/master.zip + when: minetest_install + +# enable or disable +- name: Enable & Restart 'minetest-serve' service + service: + name: minetest-serve + enabled: yes + state: restarted + when: minetest_install and minetest_enabled + +- name: Disable 'minetest-serve' service + service: + name: minetest-serve + enabled: no + state: stopped + when: minetest_install and not minetest_enabled + +- name: Add 'minetest' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" + section: minetest + option: "{{ item.option }}" + value: "{{ item.value }}" + with_items: + - option: name + value: Minetest Server + - option: description + value: '"Well known game Minetest."' + - option: minetest_world_dir + value: "{{ minetest_world_dir }}" + - option: minetest_port + value: "{{ minetest_port }}" + - option: minetest_enabled + value: "{{ minetest_enabled }}" + - option: minetest_world_dir + value: "{{ minetest_world_dir }}" \ No newline at end of file diff --git a/roles/minetest/tasks/minetest_install.yml b/roles/minetest/tasks/minetest_install.yml new file mode 100644 index 000000000..e9de426ba --- /dev/null +++ b/roles/minetest/tasks/minetest_install.yml @@ -0,0 +1,76 @@ +# For non-rpi installs +# Still a work in progress + +- name: Set some facts + set_fact: + minetest_server_bin: /usr/lib/minetest/minetestserver +# minetest_world_dir: /var/games/minetest-server/.minetest/worlds/world/ should be in library + minetest_mods_dir: /usr/share/games/minetest_game/mods/ + +- name: Ensure group minetest exists + group: + name: "{{ minetest_runas_group }}" + state: present + +- name: Create minetest user + user: + name: "{{ minetest_runas_user }}" + groups: "{{ minetest_runas_group }}" + state: present + createhome: no + +- name: Create minetest world directory + file: path={{ item }} + mode=0755 + owner={{ minetest_runas_user }} + group={{ minetest_runas_group }} + state=directory + with_items: + - "{{ minetest_world_dir }}" + +- name: Install minetest package + debug: + msg: "No install except Raspberry Pi for now." + when: not is_rpi + +- name: Download minetest if not package + get_url: + url: "{{ rpi_src_url }}" + dest: "{{ downloads_dir }}/{{ rpi_src }}" + timeout: "{{ download_timeout }}" + when: is_rpi + +- name: Install minetest if not package + debug: + msg: "placeholder." + when: is_rpi + +- name: Create /etc/minetest + file: path={{ item }} + mode=0755 + owner=root + group=root + state=directory + with_items: + - /etc/minetest + +# - name: move files to world dir + +- name: Change binary name if not rpi + set_fact: + minetest_server_bin: /usr/bin/minetest-server + when: not is_rpi + +- name: Create minetest-server service and minetest.conf file + template: + backup: no + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + group: root + mode: "{{ item.mode }}" + with_items: + - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf', mode: '0644'} + - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service', mode: '0644'} + +# - name: Start minetest diff --git a/roles/minetest/tasks/minetest_install_mods.yml b/roles/minetest/tasks/minetest_install_mods.yml new file mode 100644 index 000000000..83b925244 --- /dev/null +++ b/roles/minetest/tasks/minetest_install_mods.yml @@ -0,0 +1,28 @@ +- name: Check if mod already installed + stat: + path: "{{ minetest_game_dir }}/mods/{{ item.name }}" + register: minetest_mod + +- name: Download one minetest mod + get_url: + url: "{{item.url}}" + dest: "{{ downloads_dir }}/{{ item.name }}.zip" + mode: 0440 + when: not minetest_mod.stat.exists + +- name: Extract mod into mods of current game + unarchive: + src: "{{ downloads_dir }}/{{ item.name }}.zip" + dest: "{{ minetest_game_dir }}/mods" + owner: "{{ minetest_runas_user }}" + group: "{{ minetest_runas_group }}" + when: not minetest_mod.stat.exists + +- name: Check if mod name has 'master' in it + stat: + path: "{{ minetest_game_dir }}/mods/{{ item.name }}-master" + register: minetest_mod_master + +- name: Rename mod to canonical name if has '-master' in name + command: mv "{{ minetest_game_dir }}/mods/{{ item.name }}-master" "{{ minetest_game_dir }}/mods/{{ item.name }}" + when: minetest_mod_master.stat.exists diff --git a/roles/minetest/tasks/rpi_minetest_install.yml b/roles/minetest/tasks/rpi_minetest_install.yml new file mode 100644 index 000000000..1f466fc09 --- /dev/null +++ b/roles/minetest/tasks/rpi_minetest_install.yml @@ -0,0 +1,71 @@ +# For rpi installs + +- name: Set some facts + set_fact: + rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz + rpi_src: minetest-0.4.17.1.tar.gz + +- name: Install packages for minetest + package: + name: "{{ item }}" + state: present + with_items: + - libhiredis-dev + +#- name: Minetest already installed - terminate play +# meta: end_play +# when: minetest_world.stat.exists + +- name: Download minetest for rpi + get_url: + url: "{{ rpi_src_url }}" + dest: "{{ downloads_dir }}/{{ rpi_src }}" + timeout: "{{ download_timeout }}" + +- name: Create /etc/minetest and /library/games directories + file: + path: "{{ item }}" + mode: 0755 + owner: root + group: root + state: directory + with_items: + - /etc/minetest + - /library/games + +- name: Create /var/log/minetest directory + file: + path: "{{ item }}" + mode: 0755 + owner: "{{ minetest_runas_user }}" + group: "{{ minetest_runas_group }}" + state: directory + with_items: + - /var/log/minetest + +- name: Extract minetest into /library/games + unarchive: + src: "{{ downloads_dir }}/{{ rpi_src }}" + dest: /library/games + owner: "{{ minetest_runas_user }}" + group: "{{ minetest_runas_group }}" + +- name: Create symbolic link + file: + src: /library/games/0.4.17.1 + dest: /library/games/minetest + owner: "{{ minetest_runas_user }}" + group: "{{ minetest_runas_group }}" + state: link + +- name: Create minetest-server service and minetest.conf file + template: + backup: no + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + group: root + mode: "{{ item.mode }}" + with_items: + - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf', mode: '0644'} + - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service', mode: '0644'} diff --git a/roles/minetest/templates/minetest-serve.service.j2 b/roles/minetest/templates/minetest-serve.service.j2 new file mode 100644 index 000000000..6a65e047e --- /dev/null +++ b/roles/minetest/templates/minetest-serve.service.j2 @@ -0,0 +1,14 @@ +[Unit] +Description=Minetest Server +After=network.target + +[Service] +Type=simple +User={{ minetest_runas_user }} +Group={{ minetest_runas_group }} +WorkingDirectory=/library/games/minetest +ExecStart={{ minetest_server_bin }} --port {{ minetest_port }} --config {{ minetest_config_file }} --logfile /var/log/minetest/minetest.log --world {{ minetest_world_dir }} +Restart=on-abort + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/roles/minetest/templates/minetest.conf.j2 b/roles/minetest/templates/minetest.conf.j2 new file mode 100644 index 000000000..13cdffa5c --- /dev/null +++ b/roles/minetest/templates/minetest.conf.j2 @@ -0,0 +1,32 @@ +# Admin name +name = {{ minetest_server_admin }} + +# Name of server +server_name = Internet in a Box Minetest Server + +# Automaticaly report to masterserver +# set to true for public servers +server_announce = false + +# Default game (default when creating a new world) +default_game = minetest + +# Maximum number of players connected simultaneously +max_users = 15 + +# Whether to enable players killing each other +enable_pvp = false + +# Set to true to enable creative mode (unlimited inventory) +creative_mode = true + +# Enable players getting damage and dying +enable_damage = true + +# Available privileges: interact, shout, teleport, settime, privs, ... +# See /privs in game for a full list on your server and mod configuration. +default_privs = interact, shout, teleport, settime, privs + +# For mods +spawn_friendly_mobs = true +spawn_hostile_mobs = false \ No newline at end of file From 35ab675f2d3d4da259ae605941e9b235750a3049 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 12:00:01 -0500 Subject: [PATCH 02/26] minetest add port and include in 9 addons --- roles/9-local-addons/tasks/main.yml | 6 ++++++ roles/network/templates/gateway/iiab-gen-iptables | 2 ++ 2 files changed, 8 insertions(+) diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 674245bc6..fa65a7f2f 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -15,6 +15,12 @@ when: calibreweb_install tags: calibre-web +- name: MINETEST + include_role: + name: minetest + when: minetest_install + tags: minetest + - name: Recording STAGE 9 HAS COMPLETED ==================== lineinfile: dest: "{{ iiab_env_file }}" diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 37e10452c..a9c215803 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -65,6 +65,7 @@ transmission_peer_port={{ transmission_peer_port }} sugarizer_port={{ sugarizer_port }} nodered_port={{ nodered_port }} mosquitto_port={{ mosquitto_port }} +minetest_port={{ minetest_port }} block_DNS={{ block_DNS }} echo "LAN is $lan and WAN is $wan" @@ -104,6 +105,7 @@ if [ "$services_externally_visible" == "True" ]; then $IPTABLES -A INPUT -p tcp --dport $mosquitto_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT + $IPTABLES -A INPUT -p udp --dport $minetest_port -m state --state NEW -i $wan -j ACCEPT fi if [ "$iiab_gateway_enabled" == "True" ]; then From 984d474bd85985101f573964773d750c3fb314b9 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 12:12:28 -0500 Subject: [PATCH 03/26] put port in default_vars.yml so available to iiab-gen-iptables --- vars/default_vars.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 25d5f0fc3..89516f089 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -436,6 +436,11 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web +# Minetest +minetest_install: False +minetest_enabled: False + +minetest_port: 30000 # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: # - http://download.iiab.io/content/OSM/vector-tiles/ From fb71c9222cd49d949b4c55d7bdbd1cf8b16ab287 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 12:24:30 -0500 Subject: [PATCH 04/26] copy paste --- roles/minetest/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 8bd190481..10863b140 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -38,7 +38,7 @@ # not rpi - include_tasks: minetest_install.yml - when: minetest_install and not minetest_world.stat.exists and not is_rp + when: minetest_install and not minetest_world.stat.exists and not is_rpi # Install mods - include: minetest_install_mods.yml From c1aba7eb5730f57a45d761d2c05defb8d20165cb Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 13:21:15 -0500 Subject: [PATCH 05/26] add readme --- roles/minetest/README.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/minetest/README.rst diff --git a/roles/minetest/README.rst b/roles/minetest/README.rst new file mode 100644 index 000000000..88600c952 --- /dev/null +++ b/roles/minetest/README.rst @@ -0,0 +1,18 @@ +=============== +Minetest README +=============== + +For the first release the minetest server can only be installed in a Raspberry Pi. + +You will need a minetest client app for your device in order to connect to the server. + +The port is nominally the standard 30000 but can be changed using the variable minetest_port and +the admin user is the usual Admin. Note that no password is required. + +Please note that the initial configuration is for creative mode and there are a number of mods installed. + +Locations on the Raspberry Pi +----------------------------- + +- The config file is /etc/minetest/minetest.conf +- The rest of the files are a normal layout based in /library/games/minetest From 4a6453e6f74944aa25ffae10e5038213ede23504 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 6 Feb 2019 13:24:33 -0500 Subject: [PATCH 06/26] reference to mods --- roles/minetest/README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/minetest/README.rst b/roles/minetest/README.rst index 88600c952..556830359 100644 --- a/roles/minetest/README.rst +++ b/roles/minetest/README.rst @@ -10,6 +10,7 @@ The port is nominally the standard 30000 but can be changed using the variable m the admin user is the usual Admin. Note that no password is required. Please note that the initial configuration is for creative mode and there are a number of mods installed. +(see the list in tasks/main.yml) Locations on the Raspberry Pi ----------------------------- From d6316b7c4d2e9de7426dc9bd1135cb0bc8367584 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:13:08 -0500 Subject: [PATCH 07/26] Update default_vars.yml --- vars/default_vars.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 0865ca5d5..9ccf8078c 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -436,12 +436,12 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web -# Minetest +# Minetest is an open source clone of the Minecraft building blocks game minetest_install: False minetest_enabled: False - minetest_port: 30000 + # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: # - http://download.iiab.io/content/OSM/vector-tiles/ # - http://oer2go.org/viewmod/en-worldmap-10 From 43644a459c1ce79e874a1e6a05c6b58fdb1a2b6f Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:13:17 -0500 Subject: [PATCH 08/26] Update local_vars_big.yml --- vars/local_vars_big.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index bbdeda7f3..548a25ff8 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web +# Minetest is an open source clone of the Minecraft building blocks game +minetest_install: True +minetest_enabled: True + # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: # - http://download.iiab.io/content/OSM/vector-tiles/ From 3042709d6db7d52126c0f7eabb201a27ce7de564 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:13:24 -0500 Subject: [PATCH 09/26] Update local_vars_medium.yml --- vars/local_vars_medium.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index 02bda6c19..888d8bc77 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web +# Minetest is an open source clone of the Minecraft building blocks game +minetest_install: False +minetest_enabled: False + # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: # - http://download.iiab.io/content/OSM/vector-tiles/ From 64d30a326d102f12b26f3bbb30e5830c9214a533 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:13:29 -0500 Subject: [PATCH 10/26] Update local_vars_min.yml --- vars/local_vars_min.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 908c2eb87..f358754f2 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web +# Minetest is an open source clone of the Minecraft building blocks game +minetest_install: False +minetest_enabled: False + # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: # - http://download.iiab.io/content/OSM/vector-tiles/ From 8e783fe92f846e2b70b7f3e2be01f5c93a688e1a Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:14:38 -0500 Subject: [PATCH 11/26] Update minetest.conf.j2 --- roles/minetest/templates/minetest.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/templates/minetest.conf.j2 b/roles/minetest/templates/minetest.conf.j2 index 13cdffa5c..e99777f14 100644 --- a/roles/minetest/templates/minetest.conf.j2 +++ b/roles/minetest/templates/minetest.conf.j2 @@ -29,4 +29,4 @@ default_privs = interact, shout, teleport, settime, privs # For mods spawn_friendly_mobs = true -spawn_hostile_mobs = false \ No newline at end of file +spawn_hostile_mobs = false From 69173d08fc39ba42d70bf84696561a452e7a3986 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:15:52 -0500 Subject: [PATCH 12/26] Update minetest-serve.service.j2 --- roles/minetest/templates/minetest-serve.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/templates/minetest-serve.service.j2 b/roles/minetest/templates/minetest-serve.service.j2 index 6a65e047e..f7eb56b39 100644 --- a/roles/minetest/templates/minetest-serve.service.j2 +++ b/roles/minetest/templates/minetest-serve.service.j2 @@ -11,4 +11,4 @@ ExecStart={{ minetest_server_bin }} --port {{ minetest_port }} --config {{ minet Restart=on-abort [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target From 73f047c94eb11cd97bd96575ee6c7b21b6ec5d65 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:21:42 -0500 Subject: [PATCH 13/26] Update main.yml --- roles/minetest/tasks/main.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 10863b140..6d428fc7d 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -3,7 +3,7 @@ - name: No install except Raspberry Pi for now debug: - msg: "No install except Raspberry Pi for now." + msg: "No install except Raspberry Pi for now." when: not is_rpi - name: Terminate play @@ -43,20 +43,20 @@ # Install mods - include: minetest_install_mods.yml with_items: - - name: moreblocks - url: https://github.com/minetest-mods/moreblocks/archive/master.zip - - name: moreores - url: https://github.com/Calinou/moreores/archive/master.zip - - name: basic_materials - url: https://gitlab.com/VanessaE/basic_materials/-/archive/master/basic_materials-master.zip - - name: mesecons - url: https://github.com/minetest-mods/mesecons/archive/master.zip - - name: digilines - url: https://github.com/minetest-mods/digilines/archive/master.zip - - name: pipeworks - url: https://github.com/minetest-mods/pipeworks/archive/master.zip - - name: Minetest-WorldEdit - url: https://github.com/Uberi/Minetest-WorldEdit/archive/master.zip + - name: moreblocks + url: https://github.com/minetest-mods/moreblocks/archive/master.zip + - name: moreores + url: https://github.com/Calinou/moreores/archive/master.zip + - name: basic_materials + url: https://gitlab.com/VanessaE/basic_materials/-/archive/master/basic_materials-master.zip + - name: mesecons + url: https://github.com/minetest-mods/mesecons/archive/master.zip + - name: digilines + url: https://github.com/minetest-mods/digilines/archive/master.zip + - name: pipeworks + url: https://github.com/minetest-mods/pipeworks/archive/master.zip + - name: Minetest-WorldEdit + url: https://github.com/Uberi/Minetest-WorldEdit/archive/master.zip when: minetest_install # enable or disable @@ -84,7 +84,7 @@ - option: name value: Minetest Server - option: description - value: '"Well known game Minetest."' + value: '"Minetest is an open source clone of the Minecraft building blocks game."' - option: minetest_world_dir value: "{{ minetest_world_dir }}" - option: minetest_port @@ -92,4 +92,4 @@ - option: minetest_enabled value: "{{ minetest_enabled }}" - option: minetest_world_dir - value: "{{ minetest_world_dir }}" \ No newline at end of file + value: "{{ minetest_world_dir }}" From 7ac8f0b23fa91fd7d00c5a5992ca68bd33a25856 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:27:25 -0500 Subject: [PATCH 14/26] Update main.yml --- roles/minetest/defaults/main.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/minetest/defaults/main.yml b/roles/minetest/defaults/main.yml index 141df1bdc..4bacad82a 100644 --- a/roles/minetest/defaults/main.yml +++ b/roles/minetest/defaults/main.yml @@ -1,10 +1,12 @@ +# minetest_install: False +# minetest_enabled: False +# minetest_port: 30000 + +# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml +# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing! + minetest_runas_user: minetest minetest_runas_group: minetest -minetest_port: 30000 minetest_config_file: /etc/minetest/minetest.conf minetest_server_admin: Admin - -# Installation Variables -minetest_install: False -minetest_enabled: False From c29951d251117294e61b5e285331af4881d8e2f1 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:44:02 -0500 Subject: [PATCH 15/26] Update main.yml --- roles/minetest/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 6d428fc7d..b19c110fd 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -6,7 +6,7 @@ msg: "No install except Raspberry Pi for now." when: not is_rpi -- name: Terminate play +- name: Terminate play if not Raspberry Pi meta: end_play when: not is_rpi From e275ae1e6b1460f9a0468757a4a871d1b37aa8b4 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 19:54:25 -0500 Subject: [PATCH 16/26] Update rpi_minetest_install.yml --- roles/minetest/tasks/rpi_minetest_install.yml | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/roles/minetest/tasks/rpi_minetest_install.yml b/roles/minetest/tasks/rpi_minetest_install.yml index 1f466fc09..e1197cd4a 100644 --- a/roles/minetest/tasks/rpi_minetest_install.yml +++ b/roles/minetest/tasks/rpi_minetest_install.yml @@ -5,12 +5,10 @@ rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz rpi_src: minetest-0.4.17.1.tar.gz -- name: Install packages for minetest +- name: Install 'libhiredis-dev' package for minetest package: - name: "{{ item }}" - state: present - with_items: - - libhiredis-dev + name: libhiredis-dev + state: present #- name: Minetest already installed - terminate play # meta: end_play @@ -24,24 +22,22 @@ - name: Create /etc/minetest and /library/games directories file: - path: "{{ item }}" - mode: 0755 - owner: root - group: root - state: directory + state: directory + path: "{{ item }}" + owner: root + group: root + mode: 0755 with_items: - /etc/minetest - /library/games - name: Create /var/log/minetest directory file: - path: "{{ item }}" - mode: 0755 - owner: "{{ minetest_runas_user }}" - group: "{{ minetest_runas_group }}" - state: directory - with_items: - - /var/log/minetest + state: directory + path: /var/log/minetest + owner: "{{ minetest_runas_user }}" + group: "{{ minetest_runas_group }}" + mode: 0755 - name: Extract minetest into /library/games unarchive: @@ -50,22 +46,22 @@ owner: "{{ minetest_runas_user }}" group: "{{ minetest_runas_group }}" -- name: Create symbolic link +- name: Create symbolic link /library/games/minetest file: + state: link src: /library/games/0.4.17.1 dest: /library/games/minetest owner: "{{ minetest_runas_user }}" group: "{{ minetest_runas_group }}" - state: link -- name: Create minetest-server service and minetest.conf file +- name: Create /etc/minetest/minetest.conf and minetest-serve.service template: backup: no src: "{{ item.src }}" dest: "{{ item.dest }}" owner: root group: root - mode: "{{ item.mode }}" + mode: 0644 with_items: - - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf', mode: '0644'} - - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service', mode: '0644'} + - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' } + - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' } From 79a50043ec6f113e0b63b0fa41a90ded97eaf236 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 20:01:52 -0500 Subject: [PATCH 17/26] Update main.yml --- roles/minetest/tasks/main.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index b19c110fd..1546cf78e 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -12,13 +12,13 @@ - include_tasks: calc_vars.yml -- name: Ensure group minetest exists +- name: Ensure Linux group '{{ minetest_runas_group }}' exists group: name: "{{ minetest_runas_group }}" state: present when: minetest_runas_user != 'root' -- name: Create minetest user +- name: Ensure Linux user '{{ minetest_runas_user }}' exists user: name: "{{ minetest_runas_user }}" groups: "{{ minetest_runas_group }}" @@ -27,7 +27,7 @@ shell: /bin/false when: minetest_runas_user != 'root' -- name: Check for minetest world file +- name: Check for minetest world file ({{ minetest_world_dir }}/world.mt) stat: path: "{{ minetest_world_dir }}/world.mt" register: minetest_world @@ -61,14 +61,16 @@ # enable or disable - name: Enable & Restart 'minetest-serve' service - service: + systemd: + daemon_reload: yes name: minetest-serve enabled: yes state: restarted when: minetest_install and minetest_enabled - name: Disable 'minetest-serve' service - service: + systemd: + daemon_reload: yes name: minetest-serve enabled: no state: stopped From 111d69af065d0eadf995f2182c173feb20719321 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 20:20:59 -0500 Subject: [PATCH 18/26] Update README.rst --- roles/minetest/README.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/roles/minetest/README.rst b/roles/minetest/README.rst index 556830359..962bf85f5 100644 --- a/roles/minetest/README.rst +++ b/roles/minetest/README.rst @@ -4,16 +4,15 @@ Minetest README For the first release the minetest server can only be installed in a Raspberry Pi. -You will need a minetest client app for your device in order to connect to the server. +To connect to the server, you will first need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/ -The port is nominally the standard 30000 but can be changed using the variable minetest_port and -the admin user is the usual Admin. Note that no password is required. +The port is nominally the standard 30000 but can be changed using the variable ``minetest_port`` and +the admin user is the usual ``Admin``. Note that no password is required. -Please note that the initial configuration is for creative mode and there are a number of mods installed. -(see the list in tasks/main.yml) +Please note that the initial configuration is for creative mode and there are a number of mods installed. (see the list in `tasks/main.yml `_) Locations on the Raspberry Pi ----------------------------- -- The config file is /etc/minetest/minetest.conf -- The rest of the files are a normal layout based in /library/games/minetest +- The config file is ``/etc/minetest/minetest.conf`` +- The rest of the files are a normal layout based in ``/library/games/minetest`` From 007356a8d95a5864e77b052bb5003e320bdadc48 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 20:51:11 -0500 Subject: [PATCH 19/26] Update rpi_minetest_install.yml --- roles/minetest/tasks/rpi_minetest_install.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/minetest/tasks/rpi_minetest_install.yml b/roles/minetest/tasks/rpi_minetest_install.yml index e1197cd4a..c15cd99f8 100644 --- a/roles/minetest/tasks/rpi_minetest_install.yml +++ b/roles/minetest/tasks/rpi_minetest_install.yml @@ -5,7 +5,7 @@ rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz rpi_src: minetest-0.4.17.1.tar.gz -- name: Install 'libhiredis-dev' package for minetest +- name: Install 'libhiredis-dev' package for Minetest package: name: libhiredis-dev state: present @@ -14,13 +14,13 @@ # meta: end_play # when: minetest_world.stat.exists -- name: Download minetest for rpi +- name: Download Minetest {{ rpi_src_url }} for RPi get_url: url: "{{ rpi_src_url }}" dest: "{{ downloads_dir }}/{{ rpi_src }}" timeout: "{{ download_timeout }}" -- name: Create /etc/minetest and /library/games directories +- name: Create dirs /etc/minetest and /library/games file: state: directory path: "{{ item }}" @@ -31,7 +31,7 @@ - /etc/minetest - /library/games -- name: Create /var/log/minetest directory +- name: Create dir /var/log/minetest file: state: directory path: /var/log/minetest @@ -39,7 +39,7 @@ group: "{{ minetest_runas_group }}" mode: 0755 -- name: Extract minetest into /library/games +- name: Extract {{ downloads_dir }}/{{ rpi_src }} into /library/games unarchive: src: "{{ downloads_dir }}/{{ rpi_src }}" dest: /library/games From 8b1f5b77e48b7ed1157f7a3f49acb5bc2a1b7a41 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 21:12:28 -0500 Subject: [PATCH 20/26] meta: end_play in tasks/main.yml blocks iiab-install when not RPi --- vars/local_vars_big.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 548a25ff8..93c6f3249 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -290,8 +290,8 @@ calibreweb_url: /books calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web # Minetest is an open source clone of the Minecraft building blocks game -minetest_install: True -minetest_enabled: True +minetest_install: False +minetest_enabled: False # CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018: From 9972c66cb1098ad0235af8892263a0f8b52e9f99 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 21:22:28 -0500 Subject: [PATCH 21/26] Update calc_vars.yml --- roles/minetest/tasks/calc_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/tasks/calc_vars.yml b/roles/minetest/tasks/calc_vars.yml index 5720f6143..5f91fbf59 100644 --- a/roles/minetest/tasks/calc_vars.yml +++ b/roles/minetest/tasks/calc_vars.yml @@ -1,6 +1,6 @@ # For rpi installs -- name: Set some facts for rpi +- name: Set some facts for RPi set_fact: minetest_server_bin: /library/games/minetest/bin/minetestserver minetest_world_dir: /library/games/minetest/worlds/world From 45a97d7041be15cd5200cfd3319aa8d60d61bf0c Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 21:53:10 -0500 Subject: [PATCH 22/26] Update minetest_install.yml --- roles/minetest/tasks/minetest_install.yml | 86 ++++++++++++----------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/roles/minetest/tasks/minetest_install.yml b/roles/minetest/tasks/minetest_install.yml index e9de426ba..89e727001 100644 --- a/roles/minetest/tasks/minetest_install.yml +++ b/roles/minetest/tasks/minetest_install.yml @@ -1,65 +1,71 @@ # For non-rpi installs # Still a work in progress +# COMPARE tasks/calc_vars.yml - name: Set some facts set_fact: minetest_server_bin: /usr/lib/minetest/minetestserver # minetest_world_dir: /var/games/minetest-server/.minetest/worlds/world/ should be in library minetest_mods_dir: /usr/share/games/minetest_game/mods/ -- name: Ensure group minetest exists - group: - name: "{{ minetest_runas_group }}" - state: present +# Taken care of near top of tasks/main.yml +# +#- name: Ensure Linux group '{{ minetest_runas_group }}' exists +# group: +# name: "{{ minetest_runas_group }}" +# state: present +# when: minetest_runas_user != 'root' +# +#- name: Ensure Linux user '{{ minetest_runas_user }}' exists +# user: +# name: "{{ minetest_runas_user }}" +# groups: "{{ minetest_runas_group }}" +# state: present +# createhome: no +# shell: /bin/false +# when: minetest_runas_user != 'root' -- name: Create minetest user - user: - name: "{{ minetest_runas_user }}" - groups: "{{ minetest_runas_group }}" - state: present - createhome: no +# SEE "Check for minetest world file" in tasks/main.yml +# +#- name: Create dir minetest_world_dir ({{ minetest_world_dir }}) +# file: +# state: directory +# path: "{{ minetest_world_dir }}" +# owner: "{{ minetest_runas_user }}" +# group: "{{ minetest_runas_group }}" +# mode: 0755 -- name: Create minetest world directory - file: path={{ item }} - mode=0755 - owner={{ minetest_runas_user }} - group={{ minetest_runas_group }} - state=directory - with_items: - - "{{ minetest_world_dir }}" +#- name: Warn if not Raspberry Pi +# debug: +# msg: "No install except Raspberry Pi for now." +# when: not is_rpi -- name: Install minetest package - debug: - msg: "No install except Raspberry Pi for now." - when: not is_rpi - -- name: Download minetest if not package +- name: Download Minetest if not package get_url: url: "{{ rpi_src_url }}" dest: "{{ downloads_dir }}/{{ rpi_src }}" timeout: "{{ download_timeout }}" - when: is_rpi + #when: is_rpi -- name: Install minetest if not package +- name: Install Minetest if not package debug: - msg: "placeholder." - when: is_rpi + msg: "placeholder." + #when: is_rpi - name: Create /etc/minetest - file: path={{ item }} - mode=0755 - owner=root - group=root - state=directory - with_items: - - /etc/minetest + file: + state: directory + path: /etc/minetest + owner: root + group: root + mode: 0755 # - name: move files to world dir -- name: Change binary name if not rpi +- name: 'Change minetest_server_bin: /usr/bin/minetest-server if not RPi' set_fact: minetest_server_bin: /usr/bin/minetest-server - when: not is_rpi + #when: not is_rpi - name: Create minetest-server service and minetest.conf file template: @@ -68,9 +74,9 @@ dest: "{{ item.dest }}" owner: root group: root - mode: "{{ item.mode }}" + mode: 0644 with_items: - - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf', mode: '0644'} - - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service', mode: '0644'} + - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' } + - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' } # - name: Start minetest From 88f4dcbaf15171bf7adbb6493103fcf516a1f9c2 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 21:55:04 -0500 Subject: [PATCH 23/26] Update rpi_minetest_install.yml --- roles/minetest/tasks/rpi_minetest_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/minetest/tasks/rpi_minetest_install.yml b/roles/minetest/tasks/rpi_minetest_install.yml index c15cd99f8..77e31cedf 100644 --- a/roles/minetest/tasks/rpi_minetest_install.yml +++ b/roles/minetest/tasks/rpi_minetest_install.yml @@ -63,5 +63,5 @@ group: root mode: 0644 with_items: - - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' } - - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' } + - { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' } + - { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' } From 250ba596ca7ef701c29c989ccb7790485d5749e7 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 22:01:04 -0500 Subject: [PATCH 24/26] Update main.yml --- roles/minetest/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 1546cf78e..7c432f494 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -6,6 +6,7 @@ msg: "No install except Raspberry Pi for now." when: not is_rpi +# CAUTION: this stanza cause iiab-install to exit on Ubuntu/Debian/etc -- without completing roles/network - name: Terminate play if not Raspberry Pi meta: end_play when: not is_rpi From 9ace90f930b984e79b404e794876053d4de9e8fc Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 22:01:56 -0500 Subject: [PATCH 25/26] Update main.yml --- roles/minetest/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 7c432f494..07feb26a6 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -6,7 +6,7 @@ msg: "No install except Raspberry Pi for now." when: not is_rpi -# CAUTION: this stanza cause iiab-install to exit on Ubuntu/Debian/etc -- without completing roles/network +# CAUTION: this stanza causes iiab-install to exit on Ubuntu/Debian/etc -- without completing roles/network - name: Terminate play if not Raspberry Pi meta: end_play when: not is_rpi From 0f69db3ed53d1cbabd0ce654d3e30df6d014ef4d Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 7 Feb 2019 22:25:27 -0500 Subject: [PATCH 26/26] Update README.rst --- roles/minetest/README.rst | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/roles/minetest/README.rst b/roles/minetest/README.rst index 962bf85f5..384390d46 100644 --- a/roles/minetest/README.rst +++ b/roles/minetest/README.rst @@ -2,17 +2,23 @@ Minetest README =============== -For the first release the minetest server can only be installed in a Raspberry Pi. +For the first release, the Minetest server can only be installed on a Raspberry Pi. -To connect to the server, you will first need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/ +Please note that the initial configuration is for creative mode, and a number of mods are installed (see the list in `tasks/main.yml `_). -The port is nominally the standard 30000 but can be changed using the variable ``minetest_port`` and -the admin user is the usual ``Admin``. Note that no password is required. +Connecting to the Server +------------------------ -Please note that the initial configuration is for creative mode and there are a number of mods installed. (see the list in `tasks/main.yml `_) +To connect to the server, you will also need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/ -Locations on the Raspberry Pi ------------------------------ +The port is nominally the standard 30000. This can be changed in `/etc/iiab/local_vars.yml `_ using variable: ``minetest_port`` -- The config file is ``/etc/minetest/minetest.conf`` -- The rest of the files are a normal layout based in ``/library/games/minetest`` +The admin user is the usual: ``Admin`` + +No password is required. + +File Locations on Raspberry Pi +------------------------------ + +- The config file is: ``/etc/minetest/minetest.conf`` +- The rest of the files are a normal layout based in: ``/library/games/minetest``