diff options
| author | Ahmed AbdelHalim <[email protected]> | 2025-08-11 00:32:04 +0200 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2025-08-11 00:32:04 +0200 |
| commit | e29ccfa18e51059897da5657f3b577ea28617f53 (patch) | |
| tree | e3f1656e50060064da5b3b062fef33263fd90072 /roles/ssh/tasks | |
| parent | 4c469b480da9767d6e7cacda9cfb332dec85a07c (diff) | |
Simplify playbook by requiring the required_for_boot tag on roles
Instead of optimizing for task execution for boot, it's simpler and
almost as equally safe (if not even more) to require the role for boot
instead of requiring each of it's needed tasks.
This will also prevent having internal bugs because a set fact wasn't
required for boot and didn't add the info
(similar to the fix in commit: 9f72c58)
Diffstat (limited to 'roles/ssh/tasks')
| -rw-r--r-- | roles/ssh/tasks/install-archlinux.yml | 1 | ||||
| -rw-r--r-- | roles/ssh/tasks/install-debian.yml | 1 | ||||
| -rw-r--r-- | roles/ssh/tasks/main.yml | 10 |
3 files changed, 0 insertions, 12 deletions
diff --git a/roles/ssh/tasks/install-archlinux.yml b/roles/ssh/tasks/install-archlinux.yml index 58b6fa9d..2086c6d1 100644 --- a/roles/ssh/tasks/install-archlinux.yml +++ b/roles/ssh/tasks/install-archlinux.yml @@ -5,4 +5,3 @@ name: "{{ ssh_package_name }}" state: present update_cache: true - tags: [required_for_boot] diff --git a/roles/ssh/tasks/install-debian.yml b/roles/ssh/tasks/install-debian.yml index 452bf003..316a0096 100644 --- a/roles/ssh/tasks/install-debian.yml +++ b/roles/ssh/tasks/install-debian.yml @@ -5,4 +5,3 @@ name: "{{ ssh_package_name }}" state: "present" update_cache: true - tags: [required_for_boot] diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml index f88b9be4..c09d00e1 100644 --- a/roles/ssh/tasks/main.yml +++ b/roles/ssh/tasks/main.yml @@ -1,11 +1,9 @@ --- - name: "Include OS-specific variables" ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml" - tags: [required_for_boot] - name: "Install OS-specific packages" ansible.builtin.include_tasks: "install-{{ ansible_os_family | lower }}.yml" - tags: [required_for_boot] - name: "Ensure ssh_service is enabled" become: true @@ -14,7 +12,6 @@ state: "started" enabled: true when: not ansible_is_chroot - tags: [required_for_boot] - name: "(chroot): Ensure ssh_service enabled" # noqa: command-instead-of-module intentional isnide chroot @@ -22,28 +19,24 @@ cmd: "systemctl enable {{ ssh_service_name }}" when: ansible_is_chroot changed_when: true - tags: [required_for_boot] - name: "Generate /etc/ssh/ RSA host key" become: true ansible.builtin.command: cmd: "ssh-keygen -q -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -C '' -N ''" creates: "/etc/ssh/ssh_host_rsa_key" - tags: [required_for_boot] - name: "Generate /etc/ssh/ ECDSA host key" become: true ansible.builtin.command: cmd: "ssh-keygen -q -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -C '' -N ''" creates: "/etc/ssh/ssh_host_ecdsa_key" - tags: [required_for_boot] - name: "Generate /etc/ssh/ Ed25519 host key" become: true ansible.builtin.command: cmd: "ssh-keygen -q -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -C '' -N ''" creates: "/etc/ssh/ssh_host_ed25519_key" - tags: [required_for_boot] - name: "Configure sshd_config" become: true @@ -68,7 +61,6 @@ notify: - "Reload systemd" - "Restart ssh" - tags: [required_for_boot] - name: "Configure ssh authentication policy" become: true @@ -87,7 +79,6 @@ X11Forwarding no notify: - "Restart ssh" - tags: [required_for_boot] - name: "Add arg.username to allowed users" become: true @@ -99,4 +90,3 @@ AllowUsers {{ username }} notify: - "Restart ssh" - tags: [required_for_boot] |
