ansible-role-linux/tasks/main.yml
2023-07-15 08:43:00 -07:00

35 lines
1.0 KiB
YAML

---
- import_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'
- import_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- import_tasks: setup-Arch.yml
when: ansible_os_family == 'Archlinux'
- name: Load a variable file based on the OS type, or a default if not found.
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "Debian.yml"
- name: Ensure sysadmin utility packages are installed.
ansible.builtin.package:
state: present
name: "{{ sysadmin_packages }}"
- name: Generate ed25519 SSH host key
ansible.builtin.command:
cmd: ssh-keygen -A
creates: /etc/ssh/ssh_host_ed25519_key
- name: Prefer ed25519 HostKeys in sshd_config
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regex: 'HostKey /etc/ssh/ssh_host_ed25519_key'
line: 'HostKey /etc/ssh/ssh_host_ed25519_key'
state: present
notify: restart ssh