- name: Deploy stable servers
hosts: starkingdoms_prod_servers_stable
vars:
# Randomly generated per-deployment secrets
api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}"
jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}"
# Database info
db_name: starkingdoms-bleeding
# What version of the docker container should be deployed?
version: stable
ws_port: 3204
api_port: 3205
web_port: 3206
api_config_dir: /home/stk-deploy/config
db_data_dir: /home/stk-deploy/data
compose_dir: /home/stk-deploy
api_url: https://api.starkingdoms.io
game_url: https://starkingdoms.io
tasks:
- name: Ensure host connectivity
ansible.builtin.ping:
- name: Create configuration directory
ansible.builtin.file:
path: "{{ api_config_dir }}"
state: directory
mode: 0755
- name: Create data directory
ansible.builtin.file:
path: "{{ db_data_dir }}"
state: directory
mode: 0755
- name: Create API config file
ansible.builtin.template:
src: ../docker/config.jinja.toml
dest: "{{ api_config_dir }}/config.toml"
force: no
- name: Create docker-compose config file
ansible.builtin.template:
src: ../docker/docker-compose.jinja.yml
dest: "{{ compose_dir }}/docker-compose.yml"
force: no
- name: Start the server
ansible.builtin.shell:
cmd: docker-compose up -d
chdir: "{{ compose_dir }}"