Download Saved game
This commit is contained in:
parent
93c34d8cbe
commit
278851f1dc
4 changed files with 31 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
inventory.yml
|
||||
saves/
|
15
download.yml
Normal file
15
download.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Setup Factorio
|
||||
hosts: all
|
||||
remote_user: root
|
||||
|
||||
tasks:
|
||||
- name: Stop factorio
|
||||
ansible.builtin.systemd:
|
||||
state: stopped
|
||||
name: factorio
|
||||
|
||||
- name: Store file /opt/factorio/saves/my-save.zip
|
||||
ansible.builtin.fetch:
|
||||
src: /opt/factorio/saves/my-save.zip
|
||||
dest: "./saves/"
|
|
@ -5,7 +5,7 @@ from os.path import exists
|
|||
|
||||
def login(username, password):
|
||||
print("> Login for user "+username)
|
||||
payload = {'username': username, 'password': password', 'api_version':'4'}
|
||||
payload = {'username': username, 'password': password, 'api_version':'4'}
|
||||
headers = {'content-type': 'application/json'}
|
||||
|
||||
r = requests.post("https://auth.factorio.com/api-login", data=payload)
|
||||
|
|
13
setup.yml
13
setup.yml
|
@ -46,6 +46,19 @@
|
|||
chdir: /opt/factorio/mods/
|
||||
loop: "{{ mods }}"
|
||||
|
||||
- name: Check if Map exists on server
|
||||
stat:
|
||||
path: "/opt/factorio/saves/my-save.zip"
|
||||
register: mapPreExists
|
||||
|
||||
|
||||
- name: Upload Saved file from locale disk to server
|
||||
ansible.builtin.copy:
|
||||
src: "./saves/{{ inventory_hostname }}/opt/factorio/saves/my-save.zip"
|
||||
dest: /opt/factorio/saves/my-save.zip
|
||||
failed_when: False
|
||||
when: mapPreExists.stat.exists == False
|
||||
|
||||
- name: Check if Map exists on server
|
||||
stat:
|
||||
path: "/opt/factorio/saves/my-save.zip"
|
||||
|
|
Loading…
Reference in a new issue