docs and change from role to init

This commit is contained in:
nazunalika 2020-12-10 11:19:24 -07:00
parent d6ec1cc605
commit e22874986a
4 changed files with 58 additions and 32 deletions

View File

@ -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
``` ```

View 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

View File

@ -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"

View File

@ -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"