-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add_valheim_docker' of https://github.com/anarion80/ans…
…ible-nas into anarion80-add_valheim_docker
- Loading branch information
Showing
9 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,6 +421,10 @@ | |
tags: | ||
- utorrent | ||
|
||
- role: valheim | ||
tags: | ||
- valheim | ||
|
||
- role: virtual_desktop | ||
tags: | ||
- virtual_desktop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
valheim_enabled: false | ||
valheim_available_externally: false | ||
|
||
# directories | ||
valheim_data_directory: "{{ docker_home }}/valheim" | ||
|
||
# network | ||
valheim_port_a: "2456" | ||
valheim_port_b: "2457" | ||
valheim_port_c: "2458" | ||
valheim_hostname: "valheim" | ||
|
||
# docker | ||
valheim_container_name: "valheim" | ||
valheim_image_name: "mbround18/valheim" | ||
valheim_image_version: "latest" | ||
|
||
# uid/gid | ||
valheim_user_id: "1000" | ||
valheim_group_id: "1000" | ||
|
||
# specs | ||
valheim_memory: 1g | ||
|
||
# valheim | ||
valheim_name: "Created With Valheim Docker" | ||
valheim_world: "Dedicated" | ||
valheim_password: "Strong! Password @ Here" | ||
valheim_public: "1" | ||
valheim_auto_update: "1" | ||
valheim_auto_update_pause_with_players: "0" | ||
valheim_auto_update_schedule: "0 1 * * *" | ||
valheim_auto_backup: "1" | ||
valheim_auto_backup_nice_level: "19" | ||
valheim_auto_backup_schedule: "*/15 * * * *" | ||
valheim_auto_backup_remove_old: "1" | ||
valheim_auto_backup_days_to_live: "3" | ||
valheim_auto_backup_on_update: "1" | ||
valheim_auto_backup_on_shutdown: "1" | ||
valheim_auto_backup_pause_with_no_players: "0" | ||
valheim_webhook_url: "https://discord.com/api/webhooks/IM_A_SNOWFLAKE/AND_I_AM_A_SECRET" | ||
valheim_webhook_include_public_ip: "1" | ||
valheim_update_on_startup: "0" | ||
valheim_enable_crossplay: "0" | ||
valheim_type: "Vanilla" | ||
valheim_preset: "" | ||
valheim_modifiers: "" | ||
valheim_set_key: "" | ||
valheim_mods: "" | ||
valheim_additional_steamcmd_args: "" | ||
valheim_scheduled_restart: "0" | ||
valheim_scheduled_restart_schedule: "0 2 * * *" | ||
|
||
valheim_env: | ||
PUID: "{{ valheim_user_id }}" | ||
PGID: "{{ valheim_group_id }}" | ||
PORT: "{{ valheim_port_a }}" | ||
NAME: "{{ valheim_name }}" | ||
WORLD: "{{ valheim_world }}" | ||
PASSWORD: "{{ valheim_password }}" | ||
TZ: "{{ ansible_nas_timezone }}" | ||
PUBLIC: "{{ valheim_public }}" | ||
AUTO_UPDATE: "{{ valheim_auto_update }}" | ||
AUTO_UPDATE_PAUSE_WITH_PLAYERS: "{{ valheim_auto_update_pause_with_players }}" | ||
AUTO_UPDATE_SCHEDULE: "{{ valheim_auto_update_schedule }}" | ||
AUTO_BACKUP: "{{ valheim_auto_backup }}" | ||
AUTO_BACKUP_SCHEDULE: "{{ valheim_auto_backup_schedule }}" | ||
AUTO_BACKUP_NICE_LEVEL: "{{ valheim_auto_backup_nice_level }}" | ||
AUTO_BACKUP_REMOVE_OLD: "{{ valheim_auto_backup_remove_old }}" | ||
AUTO_BACKUP_DAYS_TO_LIVE: "{{ valheim_auto_backup_days_to_live }}" | ||
AUTO_BACKUP_ON_UPDATE: "{{ valheim_auto_backup_on_update }}" | ||
AUTO_BACKUP_ON_SHUTDOWN: "{{ valheim_auto_backup_on_shutdown }}" | ||
AUTO_BACKUP_PAUSE_WITH_NO_PLAYERS: "{{ valheim_auto_backup_pause_with_no_players }}" | ||
UPDATE_ON_STARTUP: "{{ valheim_update_on_startup }}" | ||
ENABLE_CROSSPLAY: "{{ valheim_enable_crossplay }}" | ||
TYPE: "{{ valheim_type }}" | ||
SCHEDULED_RESTART: "{{ valheim_scheduled_restart }}" | ||
SCHEDULED_RESTART_SCHEDULE: "{{ valheim_scheduled_restart_schedule }}" | ||
# WEBHOOK_URL: "{{ valheim_webhook_url }}" | ||
# WEBHOOK_INCLUDE_PUBLIC_IP: "{{ valheim_webhook_include_public_ip }}" | ||
# PRESET: "{{ valheim_preset }}" | ||
# MODIFIERS: "{{ valheim_modifiers }}" | ||
# SET_KEY: "{{ valheim_set_key }}" | ||
# MODS: "{{ valheim_mods }}" | ||
# ADDITIONAL_STEAMCMD_ARGS: "{{ valheim_additional_steamcmd_args }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
valheim_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
valheim_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get valheim container state | ||
community.docker.docker_container: | ||
name: "{{ valheim_container_name }}" | ||
register: result | ||
|
||
- name: Check if valheim containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove valheim | ||
community.docker.docker_container: | ||
name: "{{ valheim_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if Valheim is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
- name: Start Valheim | ||
block: | ||
- name: Create Valheim Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ valheim_user_id }}" | ||
group: "{{ valheim_group_id }}" | ||
with_items: | ||
- "{{ valheim_data_directory }}/saves" | ||
- "{{ valheim_data_directory }}/server" | ||
- "{{ valheim_data_directory }}/backups" | ||
|
||
- name: Valheim Docker Container | ||
community.docker.docker_container: | ||
name: "{{ valheim_container_name }}" | ||
image: "{{ valheim_image_name }}:{{ valheim_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ valheim_data_directory }}/saves:/home/steam/.config/unity3d/IronGate/Valheim" | ||
- "{{ valheim_data_directory }}/server:/home/steam/valheim" | ||
- "{{ valheim_data_directory }}/backups:/home/steam/backups" | ||
ports: | ||
- "{{ valheim_port_a }}:2456/udp" | ||
- "{{ valheim_port_b }}:2457/udp" | ||
- "{{ valheim_port_c }}:2458/udp" | ||
env: "{{ valheim_env }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ valheim_memory }}" | ||
capabilities: | ||
- SYS_NICE | ||
labels: | ||
traefik.enable: "{{ valheim_available_externally | string }}" | ||
traefik.http.routers.valheim.rule: "Host(`{{ valheim_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.valheim.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.valheim.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.valheim.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.valheim.loadbalancer.server.port: "2456" | ||
when: valheim_enabled is true | ||
|
||
- name: Stop Valheim | ||
block: | ||
- name: Stop Valheim | ||
community.docker.docker_container: | ||
name: "{{ valheim_container_name }}" | ||
state: absent | ||
|
||
when: valheim_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: "Valheim Server" | ||
--- | ||
|
||
Homepage: [https://github.com/mbround18/valheim-docker](https://github.com/mbround18/valheim-docker) | ||
|
||
Valheim Docker powered by Odin. The Valheim dedicated gameserver manager which is designed with resiliency in mind by providing automatic updates, world backup support, and a user friendly cli interface. | ||
|
||
## Usage | ||
|
||
Set `valheim_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Set `valheim_optional_env` to a list of environment variables you need for the server. You can use many `valheim_*` variables alredy defined as defaults. | ||
|
||
Valheim server will be available at [http://ansible_nas_host_or_ip:2456](http://ansible_nas_host_or_ip:2456) address. | ||
|
||
Refer to [Valheim-docker documentation](https://github.com/mbround18/valheim-docker) for further details on how to manage the Valheim servers. |