Compare commits

...

21 Commits

Author SHA1 Message Date
c32769d831 Add banner 2025-01-21 20:16:05 +01:00
7cfa4aee8d Add ssh key survey 2025-01-21 20:00:18 +01:00
a7e7f49d84 Add missing variable 2025-01-21 19:58:07 +01:00
cfcccbf512 CIS Adjustments 2025-01-21 19:55:36 +01:00
75c4ba6b4c Fix variable distribution 2025-01-21 17:43:18 +01:00
b62066d675 Make Network Assignment more reliable 2025-01-21 16:59:56 +01:00
53a2c27984 Add nms default 2025-01-17 00:50:26 +01:00
bb82ff120b Remove nms from ip since already addition already done internaly 2025-01-17 00:45:42 +01:00
221d77b94d Do not reboot localhost! 2025-01-17 00:38:35 +01:00
d71ea511f9 Don't fail proxmox install if rhel_iso is not defined 2025-01-17 00:07:58 +01:00
b3299781dc use 24 netmask as default if not set 2025-01-17 00:03:38 +01:00
5e7a06b7db Add extra utils 2025-01-14 21:14:40 +01:00
d77f65ce05 Set correct IP NetworkMask if defined 2025-01-14 16:08:10 +01:00
39fc15d7d8 Fix typo 2025-01-14 15:03:06 +01:00
b076968404 Dont fail if vmware_ssh is not defined 2025-01-14 14:58:58 +01:00
4f03ccbfcf Add dig via bind-utils for rhel 2024-12-03 16:42:47 +01:00
5746be4561 RHEL add python package 2024-12-03 13:31:31 +01:00
39cc49a05b Do not hardcode macaddress which makes vm cloning harder 2024-12-02 18:08:48 +01:00
2d63ca9c5a Use RHEL nameing for yum repo file 2024-11-12 14:14:09 +01:00
9f56328890 Fix DNS issue 2024-11-11 17:44:52 +01:00
dc763bdc42 Adjust never libvirt loaders 2024-11-11 17:26:37 +01:00
14 changed files with 118 additions and 79 deletions

View File

@@ -77,6 +77,7 @@ Inventory variables are defined for individual hosts or VMs in the inventory fil
| `root_password` | Root password for the VM or system, used for initial setup or secure access. | `SecurePass123` | | `root_password` | Root password for the VM or system, used for initial setup or secure access. | `SecurePass123` |
| `user_name` | Username for a user account within the VM, often used with cloud-init. | `adminuser` | | `user_name` | Username for a user account within the VM, often used with cloud-init. | `adminuser` |
| `user_password` | Password for the user account within the VM. | `UserPass123` | | `user_password` | Password for the user account within the VM. | `UserPass123` |
| `user_public_key` | SSH Key for the user account within the VM. | `ssh-ed25519 AAAAC` |
| `vm_ballo` (optional) | Ballooning memory size for the VM, used to adjust memory allocation dynamically. | `2048` | | `vm_ballo` (optional) | Ballooning memory size for the VM, used to adjust memory allocation dynamically. | `2048` |
| `vm_cpus` | Number of CPU cores assigned to the virtual machine. | `4` | | `vm_cpus` | Number of CPU cores assigned to the virtual machine. | `4` |
| `vm_dns` | DNS server IP address(es) for the virtual machine's network configuration. | `1.0.0.1`, `1.1.1.1` | | `vm_dns` | DNS server IP address(es) for the virtual machine's network configuration. | `1.0.0.1`, `1.1.1.1` |
@@ -84,7 +85,7 @@ Inventory variables are defined for individual hosts or VMs in the inventory fil
| `vm_id` | Unique identifier for the virtual machine. | `101` | | `vm_id` | Unique identifier for the virtual machine. | `101` |
| `vm_ip` | IP address assigned to the virtual machine. | `192.168.0.10` | | `vm_ip` | IP address assigned to the virtual machine. | `192.168.0.10` |
| `vm_nm` (optional) | IP address netmask assigned to the virtual machine. | `255.255.255.0` | | `vm_nm` (optional) | IP address netmask assigned to the virtual machine. | `255.255.255.0` |
| `vm_nms` (optional) | IP address netmask assigned to the virtual machine. | `24` | | `vm_nms` (optional) | IP address netmask assigned to the virtual machine. | `24` |
| `vm_memory` | Amount of memory (in MB) allocated to the virtual machine. | `2048` | | `vm_memory` | Amount of memory (in MB) allocated to the virtual machine. | `2048` |
| `vm_nif` | Network interface type or identifier for the VM's network connection. | `vmbr0` | | `vm_nif` | Network interface type or identifier for the VM's network connection. | `vmbr0` |
| `vm_path (optional)` | Path or folder where the VM configuration or related files will be stored. | `/var/lib/libvirt/images/` | | `vm_path (optional)` | Path or folder where the VM configuration or related files will be stored. | `/var/lib/libvirt/images/` |

View File

@@ -1,29 +0,0 @@
[promox-kvm]
192.168.122.10
192.168.122.11
[promox-kvm:vars]
vm_gw=192.168.122.1
vm_dns=1.1.1.1
[192.168.122.10]
hostname=proxy
vm_id=300
os=archlinux
filesystem=btrfs
vm_memory=2048
vm_ballo=1024
vm_cpus=2
vm_size=5
vm_nif=vmbr1
[192.168.122.11]
hostname=database
vm_id=101
os=archlinux
filesystem=btrfs
vm_memory=6144
vm_ballo=3072
vm_cpus=4
vm_size=40
vm_nif=vmbr1

View File

@@ -3,6 +3,7 @@ all:
hypervisor: 'proxmox' hypervisor: 'proxmox'
install_drive: '/dev/sda' install_drive: '/dev/sda'
cis: true cis: true
boot_iso: "local-btrfs:iso/archlinux-x86_64.iso"
children: children:
promox-kvm: promox-kvm:
hosts: hosts:

View File

@@ -9,6 +9,11 @@
prompt: | prompt: |
What is your username? What is your username?
private: false private: false
- name: user_public_key
prompt: |
What is your ssh key?
private: false
- name: user_password - name: user_password
prompt: | prompt: |
@@ -81,7 +86,7 @@
tasks: tasks:
- name: Set final SSH Credentials - name: Set final SSH Credentials
when: hypervisor == 'vmware' and vmware_ssh | bool when: hypervisor != 'vmware' or (hypervisor == 'vmware' and vmware_ssh | bool)
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_user: "{{ user_name }}" ansible_user: "{{ user_name }}"
ansible_password: "{{ user_password }}" ansible_password: "{{ user_password }}"
@@ -91,3 +96,4 @@
- name: Check if VM is back and running - name: Check if VM is back and running
ansible.builtin.wait_for_connection: ansible.builtin.wait_for_connection:
timeout: 300 timeout: 300

View File

@@ -31,7 +31,7 @@
with_items: with_items:
- debootstrap --include={{ role_packages[os].base | join(',') }} {{ 'oracular' if os == 'ubuntu' else 'noble' }} - debootstrap --include={{ role_packages[os].base | join(',') }} {{ 'oracular' if os == 'ubuntu' else 'noble' }}
/mnt http://archive.ubuntu.com/ubuntu/ /mnt http://archive.ubuntu.com/ubuntu/
- ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf - ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
- arch-chroot /mnt sed -i '1s|$| universe|' /etc/apt/sources.list - arch-chroot /mnt sed -i '1s|$| universe|' /etc/apt/sources.list
- arch-chroot /mnt apt update -y - arch-chroot /mnt apt update -y
- arch-chroot /mnt apt install -y {{ role_packages[os].extra | join(' ') }} - arch-chroot /mnt apt install -y {{ role_packages[os].extra | join(' ') }}
@@ -43,7 +43,7 @@
register: result register: result
with_items: with_items:
- dnf --releasever=9 --best --repo=alma-baseos --installroot=/mnt --setopt=install_weak_deps=False groupinstall -y base core - dnf --releasever=9 --best --repo=alma-baseos --installroot=/mnt --setopt=install_weak_deps=False groupinstall -y base core
- ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf - ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
- arch-chroot /mnt dnf --releasever=9 --setopt=install_weak_deps=False install -y {{ role_packages.almalinux | join(' ') }} - arch-chroot /mnt dnf --releasever=9 --setopt=install_weak_deps=False install -y {{ role_packages.almalinux | join(' ') }}
- name: Bootstrap Fedora 41 - name: Bootstrap Fedora 41
@@ -54,7 +54,7 @@
with_items: with_items:
- dnf --releasever=41 --best --repo=fedora --repo=fedora-updates - dnf --releasever=41 --best --repo=fedora --repo=fedora-updates
--installroot=/mnt --setopt=install_weak_deps=False groupinstall -y critical-path-base core --installroot=/mnt --setopt=install_weak_deps=False groupinstall -y critical-path-base core
- ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf - ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
- arch-chroot /mnt dnf --releasever=41 --setopt=install_weak_deps=False install -y {{ role_packages.fedora | join(' ') }} - arch-chroot /mnt dnf --releasever=41 --setopt=install_weak_deps=False install -y {{ role_packages.fedora | join(' ') }}
- arch-chroot /mnt dnf reinstall -y kernel-core - arch-chroot /mnt dnf reinstall -y kernel-core
@@ -67,7 +67,7 @@
- dnf --releasever=9 --best --repo=rocky-baseos --installroot=/mnt - dnf --releasever=9 --best --repo=rocky-baseos --installroot=/mnt
--setopt=install_weak_deps=False --setopt=optional_metadata_types=filelists --setopt=install_weak_deps=False --setopt=optional_metadata_types=filelists
groupinstall -y base core groupinstall -y base core
- ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf - ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
- arch-chroot /mnt dnf --releasever=9 --setopt=install_weak_deps=False install -y {{ role_packages.rocky | join(' ') }} - arch-chroot /mnt dnf --releasever=9 --setopt=install_weak_deps=False install -y {{ role_packages.rocky | join(' ') }}
- name: Bootstrap RHEL System - name: Bootstrap RHEL System
@@ -84,7 +84,7 @@
- name: Prepare chroot environment - name: Prepare chroot environment
ansible.builtin.shell: | ansible.builtin.shell: |
ln -sf /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf ln -sf /run/NetworkManager/resolv.conf /mnt/etc/resolv.conf
mkdir -p /mnt/usr/local/install/redhat/dvd mkdir -p /mnt/usr/local/install/redhat/dvd
mount --bind /usr/local/install/redhat/dvd /mnt/usr/local/install/redhat/dvd mount --bind /usr/local/install/redhat/dvd /mnt/usr/local/install/redhat/dvd
arch-chroot /mnt rpm --rebuilddb arch-chroot /mnt rpm --rebuilddb
@@ -94,7 +94,7 @@
- name: Copy RHEL repo file into chroot environment - name: Copy RHEL repo file into chroot environment
ansible.builtin.copy: ansible.builtin.copy:
src: /etc/yum.repos.d/{{ os | lower }}.repo src: /etc/yum.repos.d/{{ os | lower }}.repo
dest: /mnt/etc/yum.repos.d/{{ os | lower }}.repo dest: /mnt/etc/yum.repos.d/redhat.repo
mode: '0644' mode: '0644'
remote_src: true remote_src: true

View File

@@ -16,7 +16,6 @@ almalinux:
- open-vm-tools - open-vm-tools
- ppp - ppp
- shim - shim
- telnet
- tmux - tmux
- vim - vim
- wget - wget
@@ -188,7 +187,6 @@ fedora:
- ppp - ppp
- ripgrep - ripgrep
- shim - shim
- telnet
- tmux - tmux
- vim-default-editor - vim-default-editor
- wget - wget
@@ -197,8 +195,11 @@ fedora:
- zstd - zstd
rhel8: rhel8:
- bind-utils
- dhcp-client - dhcp-client
- efibootmgr - efibootmgr
- glibc-langpack-de
- glibc-langpack-en
- grub2 - grub2
- grub2-efi-x64 - grub2-efi-x64
- lrzsz - lrzsz
@@ -206,15 +207,18 @@ rhel8:
- mtr - mtr
- nfs-utils - nfs-utils
- open-vm-tools - open-vm-tools
- python
- shim - shim
- telnet
- tmux - tmux
- vim - vim
- zstd - zstd
rhel9: rhel9:
- bind-utils
- dhcp-client - dhcp-client
- efibootmgr - efibootmgr
- glibc-langpack-de
- glibc-langpack-en
- grub2 - grub2
- grub2-efi - grub2-efi
- lrzsz - lrzsz
@@ -222,8 +226,8 @@ rhel9:
- mtr - mtr
- nfs-utils - nfs-utils
- open-vm-tools - open-vm-tools
- python
- shim - shim
- telnet
- tmux - tmux
- vim - vim
- zram-generator - zram-generator
@@ -307,6 +311,7 @@ ubuntu:
- tldr - tldr
- tmux - tmux
- traceroute - traceroute
- util-linux-extra
- vim - vim
- wget - wget
- yq - yq
@@ -365,6 +370,7 @@ ubuntu-lts:
- tldr - tldr
- tmux - tmux
- traceroute - traceroute
- util-linux-extra
- vim - vim
- wget - wget
- yq - yq

View File

@@ -7,18 +7,19 @@
mode: '0644' mode: '0644'
content: | content: |
CIS LVL 3 Restrictions CIS LVL 3 Restrictions
install freevxfs /bin/true install freevxfs /bin/false
install jffs2 /bin/true install jffs2 /bin/false
install hfs /bin/true install hfs /bin/false
install hfsplus /bin/true install hfsplus /bin/false
install squashfs /bin/true install cramfs /bin/false
install udf /bin/true install squashfs /bin/false
install usb-storage /bin/true install udf /bin/false
install usb-storage /bin/false
install dccp /bin/true install dccp /bin/false
install sctp /bin/true install sctp /bin/false
install rds /bin/true install rds /bin/false
install tipc /bin/true install tipc /bin/false
- name: Create USB Rules - name: Create USB Rules
ansible.builtin.copy: ansible.builtin.copy:
@@ -43,11 +44,20 @@
mode: '0644' mode: '0644'
content: | content: |
## CIS Sysctl configurations ## CIS Sysctl configurations
kernel.yama.ptrace_scope=1
kernel.randomize_va_space=2
# Network
net.ipv4.ip_forward=0
net.ipv4.tcp_syncookies=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.default.log_martians = 1 net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0
@@ -59,6 +69,7 @@
net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
# - name: Adjust login.defs # - name: Adjust login.defs
# replace: # replace:
# path: /mnt/etc/login.defs # path: /mnt/etc/login.defs
@@ -69,6 +80,31 @@
# - { regexp: '^PASS_MIN_DAYS.*', replace: 'PASS_MIN_DAYS 7' } # - { regexp: '^PASS_MIN_DAYS.*', replace: 'PASS_MIN_DAYS 7' }
# - { regexp: '^UMASK.*', replace: 'UMASK 027' } # - { regexp: '^UMASK.*', replace: 'UMASK 027' }
- name: Ensure the Default UMASK is Set Correctly
ansible.builtin.lineinfile:
path: "/mnt/etc/profile"
regexp: "^(\\s*)umask\\s+\\d+"
line: "umask 027"
- name: Prevent Login to Accounts With Empty Password
ansible.builtin.replace:
dest: "{{ item }}"
regexp: "nullok"
loop:
- /mnt/etc/pam.d/system-auth
- /mnt/etc/pam.d/password-auth
- name: Configure System Cryptography Policy
when: os in ["almalinux", "fedora", "rhel8", "rhel9", "rocky"]
ansible.builtin.command:
arch-chroot /mnt /usr/bin/update-crypto-policies --set DEFAULT:NO-SHA1
- name: Mask Systemd Services
ansible.builtin.command: >
arch-chroot /mnt systemctl mask nftables bluetooth rpcbind
changed_when: result.rc == 0
register: result
- name: Ensure files exist - name: Ensure files exist
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
@@ -80,6 +116,15 @@
- /mnt/etc/hosts.allow - /mnt/etc/hosts.allow
- /mnt/etc/hosts.deny - /mnt/etc/hosts.deny
- name: Ensure files do not exist
ansible.builtin.file:
path: "{{ item }}"
state: touch
mode: "0600"
loop:
- /mnt/etc/at.deny
- /mnt/etc/cron.deny
- name: Add Security related lines into config files - name: Add Security related lines into config files
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "{{ item.path }}" path: "{{ item.path }}"
@@ -155,7 +200,7 @@
- { option: X11Forwarding, value: "no" } - { option: X11Forwarding, value: "no" }
- { option: PermitUserEnvironment, value: "no" } - { option: PermitUserEnvironment, value: "no" }
- { option: ClientAliveInterval, value: "300" } - { option: ClientAliveInterval, value: "300" }
- { option: ClientAliveCountMax, value: "0" } - { option: ClientAliveCountMax, value: "1" }
- { option: PermitTunnel, value: "no" } - { option: PermitTunnel, value: "no" }
- { option: Banner, value: /etc/issue.net } - { option: Banner, value: /etc/issue.net }
@@ -169,9 +214,9 @@
### Ciphers and keying ### ### Ciphers and keying ###
RekeyLimit 512M 6h RekeyLimit 512M 6h
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 MACs -hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-sha1-96,umac-64@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com
########################### ###########################
AllowStreamLocalForwarding no AllowStreamLocalForwarding no

View File

@@ -22,10 +22,14 @@
- ide0 - ide0
- ide2 - ide2
- name: Reboot system - name: Start the VM
ansible.builtin.command: reboot community.general.proxmox_kvm:
failed_when: false api_host: "{{ hypervisor_url }}"
changed_when: false api_user: "{{ hypervisor_username }}"
api_password: "{{ hypervisor_password }}"
node: "{{ hypervisor_node }}"
vmid: "{{ vm_id }}"
state: restarted
- name: Clean vCenter VM - name: Clean vCenter VM
when: hypervisor == "vmware" when: hypervisor == "vmware"

View File

@@ -39,7 +39,7 @@
- "# TempFS" - "# TempFS"
- tmpfs /tmp tmpfs defaults,nosuid,nodev,noexec 0 0 - tmpfs /tmp tmpfs defaults,nosuid,nodev,noexec 0 0
- tmpfs /var/tmp tmpfs defaults,nosuid,nodev,noexec 0 0 - tmpfs /var/tmp tmpfs defaults,nosuid,nodev,noexec 0 0
- tmpfs /dev/shm tmpfs defaults,noexec 0 0 - tmpfs /dev/shm tmpfs defaults,nosuid,nodev,noexec 0 0
- name: Set local timezone - name: Set local timezone
ansible.builtin.command: "{{ item }}" ansible.builtin.command: "{{ item }}"
@@ -213,19 +213,28 @@
fs-type = swap fs-type = swap
mode: '0644' mode: '0644'
- name: Copy FirstRun Script
when: os | lower != "archlinux"
ansible.builtin.template:
src: firstrun.sh.j2
dest: /mnt/root/firstrun.sh
mode: "0755"
- name: Copy Custom Shell config - name: Copy Custom Shell config
ansible.builtin.template: ansible.builtin.template:
src: custom.sh.j2 src: custom.sh.j2
dest: /mnt/etc/profile.d/custom.sh dest: /mnt/etc/profile.d/custom.sh
mode: '0644' mode: '0644'
- name: Create login banner
ansible.builtin.copy:
dest: "{{ item }}"
content: |
**************************************************************
* WARNING: Unauthorized access to this system is prohibited. *
* All activities are monitored and logged. *
* Disconnect immediately if you are not an authorized user. *
**************************************************************
owner: root
group: root
mode: '0644'
loop:
- /etc/issue
- /etc/issue.net
- name: Setup Network - name: Setup Network
block: block:
- name: Generate UUID for Network Profile - name: Generate UUID for Network Profile

View File

@@ -2,13 +2,12 @@
id=LAN id=LAN
uuid={{ net_uuid.stdout }} uuid={{ net_uuid.stdout }}
type=ethernet type=ethernet
interface-name={{ net_inf.stdout }}
[ethernet] [ethernet]
mac-address={{ net_mac.stdout }} mac-address={{ net_mac.stdout }}
[ipv4] [ipv4]
address={{ vm_ip }},{{ vm_gw }} address={{ vm_ip }}/{{ vm_nms | default (24) }},{{ vm_gw }}
dns={{ vm_dns }} dns={{ vm_dns }}
method=manual method=manual

View File

@@ -20,7 +20,7 @@
msg: This host is not booted from the Arch install media! msg: This host is not booted from the Arch install media!
when: not archiso_stat.stat.exists when: not archiso_stat.stat.exists
- name: Setect Interface - name: Register Network Interface
when: hypervisor == "vmware" when: hypervisor == "vmware"
ansible.builtin.shell: "set -o pipefail && ip l | awk -F': ' '!/lo/{print $2; exit}'" ansible.builtin.shell: "set -o pipefail && ip l | awk -F': ' '!/lo/{print $2; exit}'"
changed_when: interface_name.rc == 0 changed_when: interface_name.rc == 0
@@ -44,7 +44,7 @@
register: result register: result
- name: Configure SSH for root login - name: Configure SSH for root login
when: hypervisor == "vmware" and vmware_ssh | bool when: hypervisor == "vmware" and (vmware_ssh is defined and vmware_ssh | bool)
block: block:
- name: Allow empty passwords temporarily - name: Allow empty passwords temporarily
ansible.builtin.replace: ansible.builtin.replace:

View File

@@ -29,12 +29,12 @@
storage: "{{ hypervisor_storage }}" storage: "{{ hypervisor_storage }}"
ide: ide:
ide0: "{{ boot_iso }},media=cdrom" ide0: "{{ boot_iso }},media=cdrom"
ide1: "{{ rhel_iso | default(omit) }},media=cdrom" ide1: "{{ rhel_iso + ',media=cdrom' if rhel_iso is defined else omit }}"
ide2: "{{ hypervisor_storage }}:cloudinit" ide2: "{{ hypervisor_storage }}:cloudinit"
net: net:
net0: virtio,bridge={{ vm_nif }}{% if vlan_name is defined and vlan_name %},tag={{ vlan_name }}{% endif %} net0: virtio,bridge={{ vm_nif }}{% if vlan_name is defined and vlan_name %},tag={{ vlan_name }}{% endif %}
ipconfig: ipconfig:
ipconfig0: ip={{ vm_ip }},gw={{ vm_gw }} ipconfig0: ip={{ vm_ip }}/{{ vm_nms | default(24) }},gw={{ vm_gw }}
nameservers: "{{ vm_dns }}" nameservers: "{{ vm_dns }}"
onboot: true onboot: true
state: present state: present

View File

@@ -8,8 +8,8 @@
<bootmenu enable='no'/> <bootmenu enable='no'/>
<boot dev='hd'/> <boot dev='hd'/>
<boot dev='cdrom'/> <boot dev='cdrom'/>
<loader readonly="yes" type="pflash">/usr/share/edk2/x64/OVMF_CODE.secboot.fd</loader> <loader readonly="yes" type="pflash">/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd</loader>
<nvram template="/usr/share/edk2/x64/OVMF_VARS.fd"/> <nvram template="/usr/share/edk2/x64/OVMF_VARS.4m.fd"/>
</os> </os>
<features> <features>
<acpi/> <acpi/>

View File

@@ -1,14 +1,11 @@
vm_ip: "{{ inventory_hostname }}/{{ vm_nms }}" vm_ip: "{{ inventory_hostname }}"
install_type: "virtual" install_type: "virtual"
cis: false
hypervisor_url: "192.168.0.2" hypervisor_url: "192.168.0.2"
hypervisor_username: "root@pam" hypervisor_username: "root@pam"
hypervisor_password: "SomePassword" hypervisor_password: "SomePassword"
hypervisor_node: "NodeName" hypervisor_node: "NodeName"
hypervisor_storage: "local-btrfs" hypervisor_storage: "local-btrfs"
boot_iso: "local-btrfs:iso/archlinux-x86_64.iso"
rhel_iso: "local-btrfs:rhel-9.4-x86_64-dvd.iso"
# For VMware-Tools # For VMware-Tools
ansible_vmware_host: "{{ hypervisor_url }}" ansible_vmware_host: "{{ hypervisor_url }}"