Set up hypervisor host for virtualization
This commit is contained in:
parent
d51bc2c510
commit
93bbd9dff8
11
ansible/ansible.cfg
Normal file
11
ansible/ansible.cfg
Normal file
@ -0,0 +1,11 @@
|
||||
[defaults]
|
||||
inventory = ./my_inventory/hosts
|
||||
roles_path = roles
|
||||
retry_files_enabled = false
|
||||
callbacks_enabled = timer, profile_tasks
|
||||
host_key_checking = False
|
||||
vault_password_file = .vault_pass
|
||||
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes
|
||||
22
ansible/group_vars/all.yml
Normal file
22
ansible/group_vars/all.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
domain_name: "lab.local"
|
||||
realm_name: "LAB.LOCAL"
|
||||
timezone: "Asia/Seoul"
|
||||
|
||||
lan_subnet: "172.30.1.0/24"
|
||||
host_ip: "172.30.1.200"
|
||||
gateway_ip: "172.30.1.254"
|
||||
|
||||
freeipa_ip: "172.30.1.85"
|
||||
portfolio_ip: "172.30.1.93"
|
||||
minecraft_ip: "172.30.1.91"
|
||||
navidrome_ip: "172.30.1.92"
|
||||
|
||||
dns_servers:
|
||||
- "172.30.1.85"
|
||||
- "1.1.1.1"
|
||||
|
||||
admin_user: "sho"
|
||||
|
||||
ipa_admin_password: "ChangeMeIPAAdmin123!"
|
||||
ipa_directory_manager_password: "ChangeMeIPAAdmin123!"
|
||||
2
ansible/my_inventory/hosts
Normal file
2
ansible/my_inventory/hosts
Normal file
@ -0,0 +1,2 @@
|
||||
[hypervisor]
|
||||
hypervisor.lab.local ansible_host=172.30.1.200 ansible_user=sho
|
||||
26
ansible/playbooks/01_host_prep.yml
Normal file
26
ansible/playbooks/01_host_prep.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
- name: Prepare Hypervisor Host
|
||||
hosts: hypervisor
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Enable EPEL repository
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
name: epel-release
|
||||
state: present
|
||||
|
||||
- name: Install utility tools
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- htop
|
||||
- tmux
|
||||
- git
|
||||
- curl
|
||||
state: present
|
||||
|
||||
- name: Configure system timezone
|
||||
become: true
|
||||
ansible.builtin.command: timedatectl set-timezone {{ timezone }}
|
||||
changed_when: false
|
||||
33
ansible/playbooks/02_kvm_setup.yml
Normal file
33
ansible/playbooks/02_kvm_setup.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
- name: Setup KVM Hypervisor and Cockpit
|
||||
hosts: hypervisor
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Install virtualization packages and Cockpit
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- qemu-kvm
|
||||
- libvirt
|
||||
- virt-install
|
||||
- cockpit
|
||||
- cockpit-machines
|
||||
state: present
|
||||
|
||||
- name: Add user to libvirt group
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: "{{ admin_user }}"
|
||||
groups: libvirt
|
||||
append: true
|
||||
|
||||
- name: Ensure virtualization and cockpit services are active
|
||||
become: true
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
loop:
|
||||
- libvirtd
|
||||
- cockpit.socket
|
||||
Loading…
Reference in New Issue
Block a user