1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #1480 from tim-moody/minetest

add flat world and carbone-ng default
This commit is contained in:
Tim Moody 2019-02-10 12:40:52 -05:00 committed by GitHub
commit 05152c63c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 17 deletions

View file

@ -1,8 +1,16 @@
# These are set in github.com/iiab/iiab/blob/master/vars/default_vars.yml
# They may be overridden in local_vars
# minetest_install: False
# minetest_enabled: False
# minetest_port: 30000
# minetest_server_admin: Admin
# 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_default_runas_user: Debian-minetest
minetest_default_runas_group: games
# minetest_default_game: only carbone-ng and minetest are supported
minetest_default_game: carbone-ng
minetest_flat_world: False
# These should not be touched unless minetest packages change
minetest_config_file: /etc/minetest/minetest.conf
minetest_world_dir: /library/games/minetest/worlds/world

View file

@ -3,11 +3,21 @@
- 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
minetest_working_dir: /library/games/minetest
# only works if server run as root
minetest_runas_user: root
minetest_runas_group: root
when: is_rpi
# For other installs TBD
# For other installs
- name: Set some facts for other platforms
set_fact:
minetest_server_bin: /usr/lib/minetest/minetestserver
minetest_working_dir: /usr/share/games/minetest
minetest_runas_user: Debian-minetest
minetest_runas_group: games
when: not is_rpi
- name: Set some facts for all
set_fact:
minetest_game_dir: "{{ minetest_working_dir }}/games/{{ minetest_default_game }}"

View file

@ -1,3 +1,6 @@
# Calculate local variables
- include_tasks: calc_vars.yml
- name: Check for minetest world file ({{ minetest_world_dir }}/world.mt)
stat:
path: "{{ minetest_world_dir }}/world.mt"
@ -12,15 +15,36 @@
mode: 0755
with_items:
- /library/games
when: minetest_install
# rpi only
- include_tasks: rpi_minetest_install.yml
when: minetest_install and not minetest_world.stat.exists and is_rpi
when: 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_rpi
when: not minetest_world.stat.exists and not is_rpi
- git:
repo: https://github.com/Calinou/carbone-ng.git
dest: "{{ minetest_game_dir }}"
depth: 1
when: minetest_default_game == "carbone-ng"
- name: Give minetest user ownership of carbone-ng
file:
state: directory
path: "{{ minetest_game_dir }}"
recurse: yes
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
when: minetest_default_game == "carbone-ng"
# Install games
#- include: minetest_install_games.yml
# with_items:
# - name: carbone-ng
# url: https://github.com/Calinou/carbone-ng
# Install mods
- include: minetest_install_mods.yml
@ -39,7 +63,13 @@
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
when: minetest_default_game == "minetest"
- name: Remove mod from carbone-ng that prevents our Admin name
file:
state: absent
path: "{{ minetest_game_dir }}/mods/name_restrictions"
when: minetest_default_game == "carbone-ng"
# enable or disable
- name: Enable & Restart 'minetest-server' service
@ -48,7 +78,7 @@
name: minetest-server
enabled: yes
state: restarted
when: minetest_install and minetest_enabled
when: minetest_enabled
- name: Disable 'minetest-server' service
systemd:
@ -56,7 +86,7 @@
name: minetest-server
enabled: no
state: stopped
when: minetest_install and not minetest_enabled
when: not minetest_enabled
- name: Add 'minetest' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -1,5 +1,4 @@
# For non-rpi installs
# Still a work in progress
- name: Install Minetest package
package:
@ -16,13 +15,23 @@
- { regexp: '^name = ', line: 'name = Admin' }
- { regexp: '^creative_mode = ', line: 'creative_mode = true' }
- { regexp: '^port = ', line: 'port = {{ minetest_port }}' }
- { regexp: '^default_game = ', line: 'default_game = {{ minetest_default_game }}' }
- name: Set mapgen engine to flat if enabled
lineinfile:
path: /etc/minetest/minetest.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^mg_name = ', line: 'mg_name = flat' }
when: minetest_flat_world
- name: Create /library/games/minetest/worlds/world
file:
state: directory
path: "{{ item }}"
owner: "{{ minetest_default_runas_user }}"
group: "{{ minetest_default_runas_group }}"
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
with_items:
- "{{ minetest_world_dir }}"

View file

@ -11,6 +11,7 @@
dest: "{{ downloads_dir }}/{{ minetest_rpi_src }}"
timeout: "{{ download_timeout }}"
# we need to create these for rpi, but package creates them for other OSes
- name: Create dirs /etc/minetest and /library/games
file:
state: directory

View file

@ -9,7 +9,7 @@ server_name = Internet in a Box Minetest Server
server_announce = false
# Default game (default when creating a new world)
default_game = minetest
default_game = {{ minetest_default_game }}
# Maximum number of players connected simultaneously
max_users = 15
@ -30,3 +30,7 @@ default_privs = interact, shout, teleport, settime, privs
# For mods
spawn_friendly_mobs = true
spawn_hostile_mobs = false
{% if minetest_flat_world %}
mg_name = flat
{% endif %}