mirror of
https://github.com/rocky-linux/infrastructure
synced 2024-11-22 05:01:27 +00:00
docs and change from role to init
This commit is contained in:
parent
d6ec1cc605
commit
e22874986a
@ -24,7 +24,9 @@ vars -> Global variables that are called with vars_files go here. This
|
|||||||
init-* -> Starting infrastructure playbooks that run solo or import other
|
init-* -> Starting infrastructure playbooks that run solo or import other
|
||||||
playbooks that start with import-
|
playbooks that start with import-
|
||||||
import -> Playbooks that should be imported from the top level playbooks
|
import -> Playbooks that should be imported from the top level playbooks
|
||||||
role-* -> These playbooks call roles specifically for infrastructure tasks
|
role-* -> These playbooks call roles specifically for infrastructure tasks.
|
||||||
|
Playbooks that do not call a role should be named init or adhoc based
|
||||||
|
on their usage.
|
||||||
adhoc -> These playbooks are one-off playbooks that can be used on the CLI or
|
adhoc -> These playbooks are one-off playbooks that can be used on the CLI or
|
||||||
in AWX
|
in AWX
|
||||||
```
|
```
|
||||||
|
55
ansible/init-rocky-install-kvm-hosts.yml
Normal file
55
ansible/init-rocky-install-kvm-hosts.yml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
# Creates a standalone KVM hosts
|
||||||
|
# Created: @SherifNagy
|
||||||
|
# Modified to current standards: @nazunalika
|
||||||
|
- name: Configure KVM host
|
||||||
|
hosts: kvmhosts
|
||||||
|
become: true
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Check if ansible cannot be run here
|
||||||
|
stat:
|
||||||
|
path: /etc/no-ansible
|
||||||
|
register: no_ansible
|
||||||
|
|
||||||
|
- name: Verify if we can run ansible
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "not no_ansible.stat.exists"
|
||||||
|
msg: "/etc/no-ansible exists - skipping run on this node"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Check for CPU Virtualization
|
||||||
|
shell: "lscpu | grep -i virtualization"
|
||||||
|
register: result
|
||||||
|
failed_when: "result.rc != 0"
|
||||||
|
|
||||||
|
# Install KVM packages
|
||||||
|
- name: Installing KVM Packages
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
with_items:
|
||||||
|
- qemu-kvm
|
||||||
|
- libvirt
|
||||||
|
- libvirt-python
|
||||||
|
- libguestfs-tools
|
||||||
|
- virt-install
|
||||||
|
|
||||||
|
- name: Enable and Start libvirtd
|
||||||
|
systemd:
|
||||||
|
name: libvirtd
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Verify KVM module is loaded
|
||||||
|
shell: "lsmod | grep -i kvm"
|
||||||
|
register: result
|
||||||
|
failed_when: "result.rc != 0"
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: Touching run file that ansible has ran here
|
||||||
|
file:
|
||||||
|
path: /var/log/ansible.run
|
||||||
|
state: touch
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
# Check virtualization is enabled
|
|
||||||
- name: Check for CPU Virtualization
|
|
||||||
shell: "lscpu | grep -i virtualization"
|
|
||||||
register: result
|
|
||||||
failed_when: "result.rc != 0"
|
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
# Install KVM packages
|
|
||||||
|
|
||||||
- name: Installing KVM Packages
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
state: present
|
|
||||||
with_items:
|
|
||||||
- qemu-kvm
|
|
||||||
- libvirt
|
|
||||||
- libvirt-python
|
|
||||||
- libguestfs-tools
|
|
||||||
- virt-install
|
|
||||||
|
|
||||||
- name: Enable and Start libvirtd
|
|
||||||
systemd:
|
|
||||||
name: libvirtd
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: Verify KVM module is loaded
|
|
||||||
shell: "lsmod | grep -i kvm"
|
|
||||||
register: result
|
|
||||||
failed_when: "result.rc != 0"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user