From a64471b1651fa807a003da10305e26066ebf05dc Mon Sep 17 00:00:00 2001 From: Thomas Crowe Date: Sun, 8 Jan 2023 06:56:35 -0500 Subject: [PATCH 1/2] Updating task to generate random password. --- tasks/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 9e337be..ecb5200 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -34,9 +34,13 @@ dest: /var/lib/libvirt/images/centos8-kvm-cnv.qcow2 when: not centos8_cnv.stat.exists +- name: Generate the root password + set_fact: + bastion_password: "{{ lookup('password', '/dev/null length=12 chars=ascii_letters,digits') }}" + - name: Set the root password on the centos8-kvm-cnv image ansible.builtin.command: > - virt-customize -a /var/lib/libvirt/images/centos8-kvm-cnv.qcow2 --root-password password:redhat + virt-customize -a /var/lib/libvirt/images/centos8-kvm-cnv.qcow2 --root-password password:"{{ bastion_password }}" when: not centos8_cnv.stat.exists - name: Setup httpd in the bastion image From e6bd21e54b006782ff21146df29a2243719de79a Mon Sep 17 00:00:00 2001 From: Thomas Crowe Date: Mon, 16 Jan 2023 13:23:09 -0500 Subject: [PATCH 2/2] changed root password to randomly generated string --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index ecb5200..05d0153 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -40,7 +40,7 @@ - name: Set the root password on the centos8-kvm-cnv image ansible.builtin.command: > - virt-customize -a /var/lib/libvirt/images/centos8-kvm-cnv.qcow2 --root-password password:"{{ bastion_password }}" + virt-customize -a /var/lib/libvirt/images/centos8-kvm-cnv.qcow2 --root-password password:{{ bastion_password }} when: not centos8_cnv.stat.exists - name: Setup httpd in the bastion image