aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/sample-environment.yml4
-rw-r--r--roles/guest-configure/tasks/rhsm-register.yml4
-rw-r--r--roles/guest-configure/tasks/rhsm-unregister.yml2
-rw-r--r--roles/guest-configure/vars/main.yml1
-rw-r--r--vm-create.yml1
-rw-r--r--vm-delete.yml1
6 files changed, 8 insertions, 5 deletions
diff --git a/docs/sample-environment.yml b/docs/sample-environment.yml
index 8bd8309..1f078c0 100644
--- a/docs/sample-environment.yml
+++ b/docs/sample-environment.yml
@@ -35,9 +35,9 @@ all:
hypervisor_host: "hypervisor.fqdn"
parent_dataset: "zfs-parent-dataset/zfs-child-dataset"
network: "bridge:vm-bridge"
-# root_password: "" #Not defining this will cause a random root password to be generated
+# root_password: "" #Not defining this will cause a random root password to be generated for kickstart purposes
user: "admin" #Regular user with sudo rights
- # SSH key for root and regular user
+ # SSH key for root and regular user - if no key or root password are defined, guest configuration will not run
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
packages: # Packages to install on guest
diff --git a/roles/guest-configure/tasks/rhsm-register.yml b/roles/guest-configure/tasks/rhsm-register.yml
index e1c1ee6..ad09b17 100644
--- a/roles/guest-configure/tasks/rhsm-register.yml
+++ b/roles/guest-configure/tasks/rhsm-register.yml
@@ -1,11 +1,11 @@
-- name: Register system with Red Hat Subscription Manager (without Activation Key)
+- name: Register guest with Red Hat Subscription Manager (without Activation Key)
community.general.redhat_subscription:
username: "{{ guest_configure_rhsm_username }}"
password: "{{ guest_configure_rhsm_password }}"
state: present
when: guest_configure_rhsm_activation_key | length == 0
-- name: Register system with Red Hat Subscription Manager (with Activation Key)
+- name: Register guest with Red Hat Subscription Manager (with Activation Key)
community.general.redhat_subscription:
username: "{{ guest_configure_rhsm_username }}"
password: "{{ guest_configure_rhsm_password }}"
diff --git a/roles/guest-configure/tasks/rhsm-unregister.yml b/roles/guest-configure/tasks/rhsm-unregister.yml
index 50ad570..7af2090 100644
--- a/roles/guest-configure/tasks/rhsm-unregister.yml
+++ b/roles/guest-configure/tasks/rhsm-unregister.yml
@@ -1,4 +1,4 @@
-- name: Unregister system with Red Hat Subscription Manager
+- name: Unregister guest with Red Hat Subscription Manager
community.general.redhat_subscription:
state: absent
ignore_errors: true
diff --git a/roles/guest-configure/vars/main.yml b/roles/guest-configure/vars/main.yml
index 2ffbd32..41a4bcf 100644
--- a/roles/guest-configure/vars/main.yml
+++ b/roles/guest-configure/vars/main.yml
@@ -1,5 +1,6 @@
ansible_ssh_common_args: "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
ansible_user: root
+ansible_ssh_password: "{{ root_password if root_password is defined }}"
guest_configure_user: "{{ user if user is defined }}"
guest_configure_user_shell: "{{ shell if shell is defined }}"
diff --git a/vm-create.yml b/vm-create.yml
index 4aac513..631dd24 100644
--- a/vm-create.yml
+++ b/vm-create.yml
@@ -76,3 +76,4 @@
apply:
tags: guest-configure
tags: guest-configure
+ when: (ssh_key is defined and ssh_key | length > 0) or (root_password is defined and root_password | length > 0)
diff --git a/vm-delete.yml b/vm-delete.yml
index 45f719e..e117326 100644
--- a/vm-delete.yml
+++ b/vm-delete.yml
@@ -46,6 +46,7 @@
apply:
tags: guest-configure
tags: guest-configure
+ when: (ssh_key is defined and ssh_key | length > 0) or (root_password is defined and root_password | length > 0)
- name: Import libvirt role to undefine VM
ansible.builtin.include_role: