Christoph Schug
aa786b1b1d
fix: tell Ansible about the idempotency of this task
...
This shell command doesn't change state on the system, therefore
it is safe to set `changed_when` to `false`, and we can also
set `check_mode` to `false` here to allow execution when run in
check mode.
2024-03-03 17:57:02 +01:00
Christoph Schug
7ceb755f35
fix: set pipefail
flag in shell commands using pipes
...
Without `pipefail` Ansible cannot detect if there is an error executing
the command before the pipe as the return code of the shell only
reflects the return code of the last command. As not all shells support
`pipefail` (e.g., `ash`, `dash`) we also enfore the use of `bash` in
this case.
2024-03-03 17:49:31 +01:00
Christoph Schug
11ece4a070
fix: remove bogus task which does nothing
...
The command doesn't change anything on the system, and the registered
variable `disk_usage` is never being used, moreover it gets overwritten
by the next task.
2024-03-03 17:38:41 +01:00
Christoph Schug
bde2063ec9
fix: fix names which did not start with an uppercase letter
2024-03-03 16:54:47 +01:00
Christoph Schug
70a8bea0ed
fix: add and remove blank lines
...
Add blank lines where it helps with readability (e.g., between each
task) but also remove needless one.
2024-03-03 16:34:29 +01:00
Christoph Schug
746aa1d06a
fix: ensure the hosts
definition is always defined
...
Ensure that the `hosts` definition is always defined, defaulting to an
empty set. Due to the lack of an Ansible inventory file this is most
likely meant to be set as an Ansible extra variable [1].
We also rename the variable named `hosts` to `my_hosts` because `hosts`
is a reserved name in Ansible. Reserved names in Ansible are for example
all class variable names of plays, roles, blocks, and tasks [2], and
`hosts` for example is used by plays [3].
[1] https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#defining-variables-at-runtime
[2] https://github.com/ansible/ansible/blob/v2.16.4/lib/ansible/vars/reserved.py#L39
[3] https://github.com/ansible/ansible/blob/v2.16.4/lib/ansible/playbook/play.py#L58
2024-03-03 15:36:11 +01:00
Christoph Schug
49d4256a58
chore: consistently use Ansible FQCN in module calls
...
In order to adhere to Ansible best practices, always use Fully Qualified
Collection Names (FQCN) [1] when calling modules.
Other than that, this commit doesn't apply any further changes
except where needed as a module name has been updated.
The module `ansible.builtin.systemd` has been renamed to
`ansible.builtin.systemd_service` with `ansible.builtin.systemd` just
being an alias [2] for reasons of backward compatibility.
[1] https://docs.ansible.com/ansible/latest/tips_tricks/ansible_tips_tricks.html#use-fully-qualified-collection-names
[2] https://docs.ansible.com/ansible/latest/collections/ansible/builtin/systemd_service_module.html#synopsis
2024-02-24 11:56:25 +01:00
Christian Lempa
78b4a3a6dd
rename file
2024-02-23 11:25:26 +01:00