aboutsummaryrefslogtreecommitdiffstats
path: root/roles/factorio/tasks
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-03-25 21:39:06 +0100
committerbinary <me@rgoncalves.se>2021-03-25 21:39:06 +0100
commit3ace280acec54508dcd1ab9964fa57a47fb752f5 (patch)
treeba905644bbd331f61b2219de8af32b3af51e281c /roles/factorio/tasks
parent376743ac96ee505fa967af675034fb796835b2e9 (diff)
downloadinfrastructure-3ace280acec54508dcd1ab9964fa57a47fb752f5.tar.gz
Fix alpine quirks automatically
Diffstat (limited to 'roles/factorio/tasks')
-rw-r--r--roles/factorio/tasks/main.yml24
1 files changed, 17 insertions, 7 deletions
diff --git a/roles/factorio/tasks/main.yml b/roles/factorio/tasks/main.yml
index 3c23569..548d7de 100644
--- a/roles/factorio/tasks/main.yml
+++ b/roles/factorio/tasks/main.yml
@@ -25,25 +25,33 @@
- name: download latest factorio server
get_url:
- url: https://factorio.com/get-download/latest/headless/linux64
+ url: "{{ factorio_url }}"
dest: "{{ factorio_dir }}/factorio.tar.gz"
owner: "{{ factorio_user }}"
group: "{{ factorio_group }}"
mode: 0600
register: archive
+- name: ensure GNU tar is present for busybox
+ package:
+ name: tar
+ state: present
+ when: ansible_distribution == "Alpine"
+
- name: untar factorio server
unarchive:
src: "{{ factorio_dir }}/factorio.tar.gz"
dest: "{{ factorio_dir }}"
+ owner: "{{ factorio_user }}"
+ group: "{{ factorio_group }}"
+ remote_src: true
extra_opts:
- --strip-components=1
- remote_src: true
when: archive.changed
-- name: deploy server settings
- copy:
- src: server-settings.json
+- name: generate server setting
+ template:
+ src: server-settings.json.j2
dest: "{{ factorio_dir }}/data/server-settings.json"
owner: "{{ factorio_user }}"
group: "{{ factorio_group }}"
@@ -54,16 +62,18 @@
register: world
- name: create default world
- shell: ./bin/x64/factorio --create "{{ factorio_world }}"
+ shell: "{{ factorio_dir }}/bin/x64/factorio --create {{ factorio_world }}"
args:
chdir: "{{ factorio_dir }}"
+ become: true
+ become_user: "{{ factorio_user }}"
when: world.stat.islnk is not defined
- name: enable and start rc script
include_role: name=rc
vars:
rc_cmd: "{{ factorio_dir }}/bin/x64/factorio"
- rc_args: --server-settings server-settings.json --start-server "{{ factorio_world }}"
+ rc_args: "--server-settings data/server-settings.json --start-server {{ factorio_world }}"
rc_user: "{{ factorio_user }}:{{ factorio_group }}"
rc_dir: "{{ factorio_dir }}"
rc_name: factorio
remember that computers suck.