From 2d0c10aa3557f2d8570c9fcc2ee626b57053bfbd Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 5 Oct 2019 16:41:25 -0500 Subject: [PATCH] Add vm_guest additions role --- roles/vm_guest/defaults/main.yaml | 4 ++++ roles/vm_guest/tasks/kvm.yaml | 11 +++++++++++ roles/vm_guest/tasks/main.yaml | 28 ++++++++++++++++++++++++++++ roles/vm_guest/vars/Debian.yaml | 1 + roles/vm_guest/vars/kvm.yaml | 10 ++++++++++ 5 files changed, 54 insertions(+) create mode 100644 roles/vm_guest/defaults/main.yaml create mode 100644 roles/vm_guest/tasks/kvm.yaml create mode 100644 roles/vm_guest/tasks/main.yaml create mode 100644 roles/vm_guest/vars/Debian.yaml create mode 100644 roles/vm_guest/vars/kvm.yaml diff --git a/roles/vm_guest/defaults/main.yaml b/roles/vm_guest/defaults/main.yaml new file mode 100644 index 0000000..b0fa5c3 --- /dev/null +++ b/roles/vm_guest/defaults/main.yaml @@ -0,0 +1,4 @@ +--- +vm_guest_agent_package_state: present +vm_guest_agent_service_state: started +vm_guest_agent_service_enabled: yes diff --git a/roles/vm_guest/tasks/kvm.yaml b/roles/vm_guest/tasks/kvm.yaml new file mode 100644 index 0000000..cfcff26 --- /dev/null +++ b/roles/vm_guest/tasks/kvm.yaml @@ -0,0 +1,11 @@ +--- +- name: install SPICE agent + package: + name: "{{ vm_guest_spice_agent_package_name }}" + state: "{{ vm_guest_spice_agent_package_state }}" + +- name: start SPICE agent + service: + name: "{{ vm_guest_spice_agent_service_name }}" + state: "{{ vm_guest_spice_agent_service_state }}" + enabled: "{{ vm_guest_spice_agent_service_enabled }}" diff --git a/roles/vm_guest/tasks/main.yaml b/roles/vm_guest/tasks/main.yaml new file mode 100644 index 0000000..5e8b7db --- /dev/null +++ b/roles/vm_guest/tasks/main.yaml @@ -0,0 +1,28 @@ +--- +- name: gather OS specific variables + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml" + - "{{ ansible_distribution }}.yaml" + - "{{ ansible_os_family }}.yaml" + +- name: gather virtualization specific variables + include_vars: "{{ item }}" + with_first_found: + "{{ ansible_virtualization_type }}.yaml" + +- name: install guest agent + package: + name: "{{ vm_guest_agent_package_name }}" + state: "{{ vm_guest_agent_package_state }}" + +- name: start guest agent + service: + name: "{{ vm_guest_agent_service_name }}" + state: "{{ vm_guest_agent_service_state }}" + enabled: "{{ vm_guest_agent_service_enabled }}" + +- name: run virtualization specific tasks + include: "{{ item }}" + with_first_found: + "{{ ansible_virtualization_type }}.yaml" diff --git a/roles/vm_guest/vars/Debian.yaml b/roles/vm_guest/vars/Debian.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/roles/vm_guest/vars/Debian.yaml @@ -0,0 +1 @@ +--- diff --git a/roles/vm_guest/vars/kvm.yaml b/roles/vm_guest/vars/kvm.yaml new file mode 100644 index 0000000..bd46b3b --- /dev/null +++ b/roles/vm_guest/vars/kvm.yaml @@ -0,0 +1,10 @@ +--- +vm_guest_agent_package_name: qemu-guest-agent +vm_guest_agent_service_name: qemu-guest-agent + +vm_guest_spice_agent_package_name: spice-vdagent +vm_guest_spice_agent_service_name: spice-vdagent + +vm_guest_spice_agent_package_state: present +vm_guest_spice_agent_service_state: started +vm_guest_spice_agent_service_enabled: yes