ansible/roles/sourcegame/tasks/main.yml

49 lines
1.4 KiB
YAML

#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Set up game
block:
- name: Clone configuration repository
git:
repo: "{{ source_configrepo }}"
dest: $HOME/sourcecfg/{{ source_instancename }}
notify: "restart {{ source_instancename }}"
- name: Symlink configs
file:
src: "$HOME/sourcecfg/{{ source_instancename }}/{{ item }}"
path: "/var/steam/.steam/SteamApps/common/{{ source_path }}/{{ source_game }}/cfg/{{ item }}"
state: link
force: yes
loop:
- autoexec.cfg
- mount.cfg
- server.cfg
notify: "restart {{ source_instancename }}"
become: yes
become_user: steamcmd
- name: Set up system
block:
- name: Template out service
template:
src: sourcegame.service
dest: "/etc/systemd/system/source-{{ source_instancename }}.service"
notify: "restart {{ source_instancename }}"
- name: Reload available daemons
systemd:
daemon_reload: yes
- name: Enable service
systemd:
name: "source-{{ source_instancename }}"
state: started
enabled: yes
- name: Assure CNAME record
route53:
state: present
zone: "{{ zone }}"
type: CNAME
record: "{{ source_instancename }}.src.{{ zone }}."
ttl: 300
value:
- "{{ inventory_hostname }}.{{ zone }}."
become: yes