Skip to content

Commit

Permalink
Merge pull request #3 from sleepy-nols/devel
Browse files Browse the repository at this point in the history
ansible-lint level: production
  • Loading branch information
sleepy-nols authored Feb 11, 2024
2 parents f0a3b60 + 2f1e5e8 commit d32ff79
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 39 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# .github/workflows/ansible-lint.yml
name: ansible-lint
on:
push:
branches:
- devel
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ansible-spacestation14
Ansible role to install and configure [Spacestation 14](https://spacestation14.io/) on Debian.
Ansible role to install and configure a [Spacestation 14](https://spacestation14.io/) server on Debian.

![ansible-lint](https://github.com/sleepy-nols/ansible-spacestation14/actions/workflows/ansible-lint.yml/badge.svg)
![push-galaxy](https://github.com/sleepy-nols/ansible-spacestation14/actions/workflows/ansible-galaxy-push-role.yml/badge.svg)
Expand Down
12 changes: 6 additions & 6 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: daemon_reload
service:
- name: Daemon_reload
ansible.builtin.service:
daemon_reload: true

- name: restart_ss14
service:
- name: Restart_ss14
ansible.builtin.service:
name: "{{ ss14_name }}.service"
state: restarted

- name: start_ss14
service:
- name: Start_ss14
ansible.builtin.service:
name: "{{ ss14_name }}.service"
state: started
enabled: true
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: Spacestation14
role_name: spacestation14
author: nols
description: Deploy and configure a Spacestation14 server on Debian
license: GPLv3
Expand Down
8 changes: 4 additions & 4 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Make ss14 config
template:
ansible.builtin.template:
src: templates/server_config.toml
dest: "{{ deploy_helper.shared_path }}/server"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: 744
mode: "0744"
notify:
- start_ss14
- restart_ss14
- Start_ss14
- Restart_ss14
18 changes: 12 additions & 6 deletions tasks/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
---
- name: Make temp apt key dir
file:
ansible.builtin.file:
state: directory
path: /tmp/apt_key
path: "/tmp/apt_key"
owner: root
group: root
mode: "0700"

- name: Apt key
get_url:
ansible.builtin.get_url:
url: "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb"
dest: "/tmp/apt_key/packages-microsoft-prod.deb"
owner: root
group: root
mode: "0700"
changed_when: false

- name: Run apt key
command: "dpkg -i packages-microsoft-prod.deb"
ansible.builtin.command: "dpkg -i packages-microsoft-prod.deb"
args:
chdir: "/tmp/apt_key"
changed_when: false

- name: Install dotnet runtime
apt:
ansible.builtin.apt:
pkg: "dotnet-runtime-8.0"
update_cache: true
notify: restart_ss14
notify: Restart_ss14
23 changes: 16 additions & 7 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,51 @@
path: "{{ ss14_root_dir }}"

- name: Make new release path
file:
ansible.builtin.file:
state: directory
path: "{{ deploy_helper.new_release_path }}"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: "0744"
changed_when: false

- name: Set shared path perms
file:
ansible.builtin.file:
state: directory
path: "{{ deploy_helper.shared_path }}"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: 0744
mode: "0744"

- name: Download ss14 server
get_url:
ansible.builtin.get_url:
url: "{{ ss14_download_url }}"
dest: "{{ deploy_helper.new_release_path }}/ss14_server.zip"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: "0744"

- name: Add an unfinished file, to allow cleanup on successful finalize
ansible.builtin.file:
path: '{{ deploy_helper.new_release_path }}/{{ deploy_helper.unfinished_filename }}'
state: touch
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: "0744"

- name: Unpack server
ansible.builtin.unarchive:
src: "{{ deploy_helper.new_release_path }}/ss14_server.zip"
dest: "{{ deploy_helper.new_release_path }}"
remote_src: yes
remote_src: true

- name: Set current release path perms
file:
ansible.builtin.file:
state: directory
path: "{{ deploy_helper.new_release_path }}"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: 0744
mode: "0744"
recurse: true

- name: Add symlinks from the new release to the shared folder
Expand Down
12 changes: 6 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
- name: Prepare host
include_tasks: prepare_host.yml
ansible.builtin.include_tasks: prepare_host.yml

- name: Check if dotnet is installed
apt:
ansible.builtin.apt:
pkg: "dotnet-runtime-8.0"
register: dotnet_installed
failed_when: false

- name: Install dotnet runtime
include_tasks: dotnet.yml
ansible.builtin.include_tasks: dotnet.yml
when: ( not ( ss14_skip_install_dotnet | bool )) and ( dotnet_installed.failed | bool )

- name: Install Spacestation 14
include_tasks: install.yml
ansible.builtin.include_tasks: install.yml

- name: Configure ss14
include_tasks: configure.yml
ansible.builtin.include_tasks: configure.yml

- name: Make systemd unit
include_tasks: systemd.yml
ansible.builtin.include_tasks: systemd.yml
2 changes: 1 addition & 1 deletion tasks/prepare_host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
path: "{{ ss14_log_path }}"
owner: "{{ ss14_unix_user }}"
group: "{{ ss14_unix_group }}"
mode: 0700
mode: "0700"
8 changes: 4 additions & 4 deletions tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Template systemd unit
template:
ansible.builtin.template:
src: "templates/ss14.service"
dest: "/etc/systemd/system/{{ ss14_name }}.service"
owner: root
group: root
mode: 700
mode: "0700"
notify:
- daemon_reload
- restart_ss14
- Daemon_reload
- Restart_ss14

0 comments on commit d32ff79

Please sign in to comment.