Phase9
This commit is contained in:
@@ -20,4 +20,4 @@ This directory will contain idempotent Ansible automation for game node provisio
|
||||
|
||||
## Status
|
||||
|
||||
Phase 0 placeholder. Node installation procedures are outlined in `docs/operations/installation.md` until playbooks land in Phase 9.
|
||||
Phase 9 playbooks provide a baseline for control plane and game node hosts. Extend with environment-specific inventories and secrets management.
|
||||
|
||||
48
deploy/ansible/control-plane.yml
Normal file
48
deploy/ansible/control-plane.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
- name: Provision control plane
|
||||
hosts: control_plane
|
||||
become: true
|
||||
vars:
|
||||
gamecloud_user: gamecloud
|
||||
gamecloud_home: /opt/hexahost-gamecloud
|
||||
tasks:
|
||||
- name: Install base packages
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker.io
|
||||
- docker-compose-plugin
|
||||
- postgresql-client
|
||||
- redis-tools
|
||||
- bind9-utils
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Create application user
|
||||
ansible.builtin.user:
|
||||
name: "{{ gamecloud_user }}"
|
||||
system: true
|
||||
create_home: false
|
||||
|
||||
- name: Create application directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ gamecloud_home }}"
|
||||
state: directory
|
||||
owner: "{{ gamecloud_user }}"
|
||||
group: "{{ gamecloud_user }}"
|
||||
mode: "0750"
|
||||
|
||||
- name: Deploy compose stack placeholder
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ gamecloud_home }}/README.txt"
|
||||
owner: "{{ gamecloud_user }}"
|
||||
group: "{{ gamecloud_user }}"
|
||||
mode: "0640"
|
||||
content: |
|
||||
Deploy the production compose stack from deploy/compose on this host.
|
||||
Required services: PostgreSQL, Redis, MinIO, API, Worker, Web, Edge Gateway.
|
||||
|
||||
- name: Remind operator about DNS
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
Configure DNS_PROVIDER=rfc2136 and RFC2136_* variables on the API/worker hosts.
|
||||
Join hostnames must point to the edge gateway public IP.
|
||||
62
deploy/ansible/game-node.yml
Normal file
62
deploy/ansible/game-node.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
- name: Provision game node
|
||||
hosts: game_nodes
|
||||
become: true
|
||||
vars:
|
||||
node_agent_user: hgc-node
|
||||
node_data_dir: /var/lib/hgc
|
||||
port_range_start: 25565
|
||||
port_range_end: 25664
|
||||
tasks:
|
||||
- name: Install Docker
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker.io
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Create node agent user
|
||||
ansible.builtin.user:
|
||||
name: "{{ node_agent_user }}"
|
||||
system: true
|
||||
create_home: false
|
||||
|
||||
- name: Create node data directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ node_data_dir }}"
|
||||
state: directory
|
||||
owner: "{{ node_agent_user }}"
|
||||
group: "{{ node_agent_user }}"
|
||||
mode: "0750"
|
||||
|
||||
- name: Open Minecraft host port range
|
||||
ansible.builtin.ufw:
|
||||
rule: allow
|
||||
port: "{{ port_range_start }}:{{ port_range_end }}"
|
||||
proto: tcp
|
||||
|
||||
- name: Install node-agent systemd unit
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/systemd/system/hgc-node-agent.service
|
||||
mode: "0644"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=HexaHost GameCloud Node Agent
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ node_agent_user }}
|
||||
ExecStart=/usr/local/bin/hgc-node-agent
|
||||
Restart=on-failure
|
||||
Environment=NODE_DATA_DIR={{ node_data_dir }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
notify: Reload systemd
|
||||
|
||||
handlers:
|
||||
- name: Reload systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
10
deploy/ansible/site.yml
Normal file
10
deploy/ansible/site.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: HexaHost GameCloud site bootstrap
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
|
||||
- import_playbook: control-plane.yml
|
||||
when: "'control_plane' in group_names"
|
||||
|
||||
- import_playbook: game-node.yml
|
||||
when: "'game_nodes' in group_names"
|
||||
Reference in New Issue
Block a user