-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_install_factorio.yml
84 lines (74 loc) · 2.32 KB
/
aws_install_factorio.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- hosts: aws
become: yes
tasks:
- name: Ping the AWS VM
ping:
- name: upgrade all packages
yum:
name: '*'
state: latest
- name: Add the user factorio with no home directory
user:
name: factorio
shell: /sbin/nologin
append: yes
comment: Factorio service user
state: present
become: yes
# https://docs.ansible.com/ansible/latest/modules/file_module.html
- name: Create the Factorio directory for the download
file:
path: /opt/factorio/
owner: factorio
group: root
state: directory
mode: '0755'
become: yes
# https://docs.ansible.com/ansible/latest/modules/get_url_module.html
- name: Download the Factorio binary file
get_url:
url: https://www.factorio.com/get-download/0.17.79/headless/linux64
dest: /opt/factorio/server_17_79.tar.xz
mode: '0440'
owner: factorio
become: yes
# https://docs.ansible.com/ansible/latest/modules/unarchive_module.html
- name: Unarchive the Factorio binary
unarchive:
src: /opt/factorio/server_17_79.tar.xz
dest: /opt/
owner: factorio
remote_src: yes # Important!!!
become: yes
- name: Create the save directory
file:
path: /opt/factorio/saves
owner: factorio
state: directory
- name: Copy the example server file
copy:
src: files/factorio/server-settings.json
# Upload the local file
dest: /opt/factorio/data/server-settings.json
owner: factorio
- name: Upload the save file
copy:
src: /mnt/c/Users/User/AppData/Roaming/Factorio/saves/Zaichik.zip
dest: /opt/factorio/saves/Zaichik.zip
owner: factorio
force: no
# Create a systemd file
- name: Upload the systemd file
copy:
src: files/factorio/factorio.service
dest: /etc/systemd/system/factorio.service
- name: Make sure Factorio service is enabled and running
systemd:
state: started
name: factorio
enabled: yes
daemon_reload: yes
# Further documentation
# How to Factorio headless: https://gist.github.com/othyn/e1287fd937c1e267cdbcef07227ed48c
# Factorio Init Script: https://github.com/Bisa/factorio-init