Skip to content

Commit

Permalink
bring ansible-lint to level: production
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-nols committed Feb 11, 2024
1 parent d1d0860 commit 3af943e
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 34 deletions.
13 changes: 7 additions & 6 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
- name: daemon_reload
service:
- name: Daemon_reload

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

args[module]

one of the following is required: state, enabled
ansible.builtin.service:
name: "{{ ss14_name }}.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
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 3af943e

Please sign in to comment.