sshd setup

This commit is contained in:
2023-08-14 22:27:29 +10:00
parent e1fb6b94ee
commit cffbcaea8c
23 changed files with 256 additions and 146 deletions

View File

@ -1,18 +1,32 @@
---
- name: Install libvirt packages (Arch)
when: ansible_os_distribution == 'Archlinux'
- name: Format and mount the libvirt disk if it is not root
when:
- hypervisor.device is defined
- hypervisor.device not in (ansible_mounts | json_query('[?mount == `/var/lib/libvirt`].device'))
ansible.builtin.include_tasks:
file: libvirt_drive_mount.yaml
- name: Install libvirt packages (Archlinux)
when: ansible_distribution == 'Archlinux'
community.general.pacman:
name: "{{ libvirt_packages['Arch'] }}"
name: "{{ libvirt_packages['Archlinux'] }}"
state: present
update_cache: true
- name: Add user to libvirt group
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: libvirt
groups:
- libvirt
- libvirt-qemu
append: true
- name: Load br_netfilter kernel module so sysctl flags can be set
community.general.modprobe:
name: br_netfilter
state: present
- name: Set required sysctl flags for bridging
ansible.posix.sysctl:
name: "{{ item.name }}"
@ -20,7 +34,7 @@
state: present
sysctl_file: /etc/sysctl.d/bridge.conf
sysctl_set: true
value: "{{ item.value }}}}"
value: "{{ item.value }}"
loop:
- name: net.ipv4.ip_forward
value: 1
@ -77,11 +91,11 @@
community.libvirt.virt_pool:
command: facts
- name: Define the standard libvirt storage pools
- name: Define the standard libvirt storage pools # TODO add when condition against existing pools
community.libvirt.virt_pool:
name: "{{ item.name }}"
command: define
xml: "{{ lookup('template', 'dir_pool.xml.j2') }}"
xml: "{{ lookup('template', 'dir_libvirt_pool.xml.j2') }}"
loop:
- name: isos
path: /var/lib/libvirt/isos/