diff options
| author | spmfox <spmfox@foxwd.com> | 2023-05-30 19:06:55 -0400 |
|---|---|---|
| committer | spmfox <spmfox@foxwd.com> | 2023-05-30 19:06:55 -0400 |
| commit | ce0495715ea3154ca9ace198c965a10a6797c20a (patch) | |
| tree | a4ce587e6db8a4fa446734a31b2357110a2b3157 | |
| parent | 2084b4bae22557fa4a4d8dbe50662a730252cfb9 (diff) | |
adding documentation
| -rw-r--r-- | README.md | 58 | ||||
| -rw-r--r-- | docs/images/logo.png | bin | 0 -> 121678 bytes | |||
| -rw-r--r-- | docs/sample-environment.yml | 5 |
3 files changed, 60 insertions, 3 deletions
@@ -1 +1,57 @@ -# ansible-zfs-kvm
\ No newline at end of file +# KVMagic +Ansible roles and playbooks for provisioning Kickstart installed VMs on KVM+ZFS hosts. + + + +This is a quick and declarative way to provision Kickstart installed KVM virtual machines on ZFS datasets then tear them down and destroy the datasets. +The goal is a consistently deployed lab which can be defined with YAML for its creation and deletion. + +## Usage +- ```ansible-playbook -i inventories/your-inventory.yml vm-create.yml``` +- ```ansible-playbook -i inventories/your-inventory.yml vm-delete.yml``` + +## Minimum needed environment file +```yaml +all: + hosts: + test-el8: + vm_name: "test-el8" + os: "rhel8-unknown" + kickstart: "el8.ks" + iso_path: "/path/to/ios/AlmaLinux-8.7-x86_64-dvd.iso" + vars: + memory_mb: 1024 + cpus: 1 + disk_gb: 20 + disk_format: "raw" + timezone: "America/New_York" + hypervisor_host: "hypervisor.fqdn" + parent_dataset: "zfs-parent-dataset/zfs-child-dataset" + network: "bridge:vm-bridge" + root_password: "{{ lookup('password', '/dev/null length=32 chars=ascii_letters,digits') }}" + root_ssh_key: "" +``` +An example with multiple VMs is located in the ```docs``` directory. + +## Requirements +- Ansible +- Ansible collections + - ```ansible-galaxy install -r collections/requirements.yml``` +- KVM +- ZFS + +## Assumptions +- You will create an inventory file based on the examples +- Ansible will use sudo to communicate with KVM and ZFS +- One ZFS dataset per VM is created +- ZFS dataset for each VM will have no child datasets +- Kickstart files and compatible distros are required +- The delete play will completely remove any VMs or datasets defined in your inventory + +## Architecture +The KVM and ZFS tasks are split into different roles, ```libvirt``` and ```zfs```. These roles contain all the needed tasks and variables for each feature. +Variables for libvirt tasks start with ```libvirt_``` and zfs ones start with ```zfs_```. These are the "real" variables that are used in the tasks, +but they are mapped to "friendly: variables for easier use. This mapping can be found in the ```vars/main.yml``` file for each role. + +This is meant for maximum portability and easier readability. Someone could easily take just the tasks from the role or create their own plays at the +upper level that run the role tasks in a different order or multiple new ways. diff --git a/docs/images/logo.png b/docs/images/logo.png Binary files differnew file mode 100644 index 0000000..02ebe45 --- /dev/null +++ b/docs/images/logo.png diff --git a/docs/sample-environment.yml b/docs/sample-environment.yml index dc39165..959f2f5 100644 --- a/docs/sample-environment.yml +++ b/docs/sample-environment.yml @@ -25,5 +25,6 @@ all: hypervisor_host: "hypervisor.fqdn" parent_dataset: "zfs-parent-dataset/zfs-child-dataset" network: "bridge:vm-bridge" - root_password: "{{ lookup('password', '/dev/null length=32 chars=ascii_letters,digits') }}" - root_ssh_key: "" + root_password: "{{ lookup('password', '/dev/null length=32 chars=ascii_letters,digits') }}" #Random root password + root_ssh_key: | + ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFyY+3A07lMnHkyQ6bMez/BEi9j2vh4sotxQdqEMlCS+EJCta8G/CCj54kBvFKrrkiPMs0Jj1Od02ZjWZqGf+W/stZ+KLh97M0EM/69zbRbQJZ7xuCQKng7U87bbopbXcx9Mu9DUCC1pjNJ5Bb7nG6z51hk7mh3mF8QGHJ6qp03FrK+Eiud/2d9Zbn4lNH/E5W7iZ3J7zZHU16nLQH1Tsbx2LFUDkVhz/A4/7sqRmWT/mpwSCVgxN9cFgs1KMHsqb4Z1XXtbb//SWj+bmPvcfbfDUkTnb8Z+KTOd1OViKjDH1owgymxZtDML5S7OOZ2AX0/c5JaDplLRhji7gpVTRLZJE5XHvfVqwJCkxVrxoc4sbcZb9I/G+clJ3CBzSMZXh7p85J4OLVP5GmfOh0o93pakWVsTZBrPgO3EjhOyj0pGay3qUHiQfPqIlU+q92Mku5iijsbFDv28HdUlz5e69igg7E8Hr2/SruZuDijxOqkkHkmW0pnM8kXQpvU5dvW0U= pubkey@box |
