diff --git a/ansible/my_inventory/group_vars/vms/vars.yml b/ansible/my_inventory/group_vars/vms/vars.yml index e6e5dc0..e7975c7 100644 --- a/ansible/my_inventory/group_vars/vms/vars.yml +++ b/ansible/my_inventory/group_vars/vms/vars.yml @@ -5,3 +5,4 @@ podman_user_home: "/home/sho" rclone_gdrive_token: "{{ vault_rclone_gdrive_token }}" minecraft_ram_limit: "4G" +playit_secret_key: "{{ vault_playit_secret_key }}" diff --git a/ansible/my_inventory/group_vars/vms/vault.yml b/ansible/my_inventory/group_vars/vms/vault.yml index 13b9ee9..70fda52 100644 --- a/ansible/my_inventory/group_vars/vms/vault.yml +++ b/ansible/my_inventory/group_vars/vms/vault.yml @@ -1,30 +1,35 @@ $ANSIBLE_VAULT;1.1;AES256 -39363737363131613035623835336161323864666538303739363633393363623065303461376430 -3963383961353038326233316437373236636138376432340a346563393835396536396539373165 -30623639363336316164393563613766316434383930653034616561383163653563333163323932 -3132363766643831380a643139643334363230343135336561393132613165316632383136363533 -39353434613866386463323136643139323266343139386637623565303764643566663761363235 -32633661343035643330643430643962363136393030653564333530313866643065633938373137 -31666635303932333938363638393366356566613061613561363538306631653331646665326336 -35336465336136313264343666353764663765613736656466633533313739396334313039363536 -31643564326537666537663466383063623332383461393833366361663965336138653163333837 -64356138623236626234323034396132616336383864666563643130346262356532366434336533 -38353732336564353036363262343230366532386633366362333930653230326531323035346534 -62313863326637373933303831376139303236633233356163306439363133346366343137313436 -39323731376136613033313764613864616664353734666565623538623334666334653534666639 -66393766343263336165353564336232386163326565653033623261373738653863343438323535 -61383138366264383834623536346339396331646635643361633630363163353164363430353531 -36356638393966303935326333643633363735626333373632343765643566393766393163336230 -33303533666466306462643561353537643464313431353032613230643937373066363733666638 -61323736363966636439666265353433623435343434316538333435356338366366376136393866 -63356662326632613065353133323632373333613839313136363339646262326562653234666238 -39333739623133646536633130626165363839386366646638633164376263633534386262366531 -32653433393833386130343033313263643934313235646334353939326338376531346535393333 -33353339356433316231663135623537613039326331303937343464303363666631643435366162 -37643561373261366166303332313736643736396237316464383331653637663539626530373666 -64643334663337336434303163386533316335306133336533326338376365386537646231623032 -63383732636538636164666431653831323436373536383566396637616230326437383364653837 -66656461313132383631373430653930346235383162663932383966353164666262663162623732 -65323534663663336232623039643838373863616462643463356266356431333361666163633163 -35363832333562333531363534313332326162393437323732356338336533353134623362383762 -31636563363364653063643665353361613632393761636530306333313431326166 +63313239663566363338626362363936336461393864353261333064353365663764386431623837 +3264653135343439303961633334396430303138373161650a663137303630323735393431656338 +63303639343537326539396231613737656366633962623763623564623336353336653333343430 +6534396539396133320a353833323066613864393861366237346337663433316636643865653763 +39366233336635376639323038643839636139663439383464646439636664323530643534663837 +64363235336662303364396266613064333630393236396636393532336134363538383236313764 +63313733653634363737633566643932623261626661313138393639646464613363333030613433 +66656237643361653534623234333534353866366432653438313837666364653939666238663463 +63633564393266653633363635333264656264666365383464666132626131626532363162303464 +34393030666361663464643135616231373266643862636431306536316563666666646537326337 +39356134383231653334336635633936376335343333626163633434346337636338663162386233 +37373863646333383863653930323264646236353962313738393736343564383531303733663636 +61353430383362633232636437653566333862386137326263323230343735613934343961363861 +39303664316131363332666536383533376663656432613065373464383262326662383766646366 +33313461383163393133366561613964666434373533656638616137383733356664666335376566 +34613338636662656534643334633765353236386666396161323732343639626366346664633365 +32343563393138313764343633323161353033393332616531303162623034646434666631336263 +30303238326235343832346266303461653666386634313336636164636131303231636164373238 +36306463373432366565643765343038366565653535336435306436653435323766666438313432 +66643931666165383134393030353032646566346636386539333030636564373237393766643065 +33643830393731636665306464396164356530363234633431306262626338303030633632363839 +31383938393434346263376339376439616539353664316438623130663638393236396539346566 +39636163343662333930343732366536663765306336343834343239326234313962366663626361 +36653731376531326335643638333431383435373637313232363238626530643935643935346533 +34663339306461346332373062393066383864376663383030316339643961376435636534323562 +34663461343430626366333666326463663965323333306433343762313638316566386164616135 +36333266623537373363353430343431383766373830396365623664343934343736623730376432 +33346238643536633261613062316534336565303437623739323435336630316335663635323936 +35383734303937643061393331303930363065353237356335346332663761663139363432336663 +63383630623035373266393639373935386161626362316265623731616661393635623764633535 +64653832336335373631363266393030623265653264663837666162653932663031626134646331 +30663631326438366433373163313736333935346136666530313232666161343264663064373163 +33316562386166636438393663336665323030333232666166373365346439656665616563333538 +6537303532653533323062333661343364616465396366393533 diff --git a/ansible/playbooks/05_playit_setup.yml b/ansible/playbooks/05_playit_setup.yml new file mode 100644 index 0000000..409e368 --- /dev/null +++ b/ansible/playbooks/05_playit_setup.yml @@ -0,0 +1,26 @@ +--- +- name: Setup Playit.gg Server + hosts: minecraft.lab.local + gather_facts: true + + tasks: + - name: Create playit directory + ansible.builtin.file: + path: "/home/{{ admin_user }}/containers/playit" + state: directory + mode: "0755" + + - name: Deploy Playit Systemd Service + become: true + ansible.builtin.template: + src: "./templates/playit.service.j2" + dest: "/etc/systemd/system/playit.service" + mode: "0644" + + - name: Strart and enable Playit service + become: true + ansible.builtin.systemd_service: + name: playit.service + state: started + enabled: true + daemon_reload: true diff --git a/ansible/playbooks/templates/playit.service.j2 b/ansible/playbooks/templates/playit.service.j2 new file mode 100644 index 0000000..9342f46 --- /dev/null +++ b/ansible/playbooks/templates/playit.service.j2 @@ -0,0 +1,19 @@ +[Unit] +Description=Playit.gg Tunnel Agent Container +After=network-online.target minecraft.service +Wants=network-online.target minecraft.service + +[Service] +Type=simple +Restart=always +ExecStartPre=-/usr/bin/podman rm -f playit-agent +ExecStart=/usr/bin/podman run \ + --name playit-agent \ + --net=host \ + -e SECRET_KEY={{ vault_playit_secret_key }} \ + ghcr.io/playit-cloud/playit-agent:1.0 +ExecStop=/usr/bin/podman stop -t 10 playit-agent +ExecStopPost=-/usr/bin/podman rm -f playit-agent + +[Install] +WantedBy=multi-user.target diff --git a/ansible/site.yml b/ansible/site.yml index 4b3289f..960e950 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -14,3 +14,7 @@ - name: Services Deployment import_playbook: ./playbooks/04_services_deploy.yml tags: services + +- name: Playit.gg Server Setup + import_playbook: ./playbooks/05_playit_setup.yml + tags: playit