2024/automation/ansible/roles/common/tasks/main.yml

37 lines
966 B
YAML

---
- name: Add ssh keys for root
ansible.posix.authorized_key:
user: root
key: "{{ lookup('ansible.builtin.url', item) }}"
state: present # Note: we don't remove other/existing keys
with_items:
- "{{ global_root_ssh_key_urls | default([]) }}"
- "{{ root_ssh_keys | default([]) }}"
- name: Set hostname
ansible.builtin.hostname:
name: "{{ hostname }}"
when: hostname is defined
- name: Install sudo as it's needed for 'become'
ansible.builtin.package:
name: sudo
state: present
- name: Install standard packages
ansible.builtin.package:
name: "{{ item }}"
state: present
with_items:
- "{{ global_packages[ansible_os_family] | default([]) }}"
- "{{ local_packages | default([]) }}"
- name: Configure udev rules
ansible.builtin.include_tasks: udev.yml
when: udev_rules is defined
- name: Configure network interfaces
ansible.builtin.include_tasks: interfaces.yml
when: interfaces is defined