ansible/roles/sourcegame/tasks/main.yml
Salt 863623e3b0 Factor extended hostnames into existing roles
Ow, really feeling that maintainability hit
2020-07-28 06:44:33 -05:00

50 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
overwrite: yes
zone: "{{ zone }}"
type: CNAME
record: "{{ source_instancename }}.src.{{ zone }}."
ttl: 300
value:
- "{{ inventory_hostname_short }}.{{ zone }}."
become: yes