From 4257849ca458855c1cbbb3fef7656b597fc6cc73 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Thu, 10 Jun 2021 15:07:48 +0200 Subject: [PATCH] Set password;Force reboot --- ansible/roles/firstboot/files/ansible_payload/playbook.yml | 1 + .../files/ansible_payload/roles/cleanup/tasks/main.yml | 3 ++- .../files/ansible_payload/roles/users/tasks/main.yml | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml diff --git a/ansible/roles/firstboot/files/ansible_payload/playbook.yml b/ansible/roles/firstboot/files/ansible_payload/playbook.yml index ff818a9..8f1d997 100644 --- a/ansible/roles/firstboot/files/ansible_payload/playbook.yml +++ b/ansible/roles/firstboot/files/ansible_payload/playbook.yml @@ -6,4 +6,5 @@ roles: - vapp - network + - users - cleanup diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/cleanup/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/cleanup/tasks/main.yml index 78f1e72..f52895f 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/cleanup/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/cleanup/tasks/main.yml @@ -3,4 +3,5 @@ name: firstboot state: absent - name: Reboot host - reboot: + ansible.builtin.shell: + cmd: reboot now diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml new file mode 100644 index 0000000..47c5f45 --- /dev/null +++ b/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml @@ -0,0 +1,7 @@ +- name: Set root password + ansible.builtin.user: + name: root + password: "{{ ovfproperties['guestinfo.rootpw'] }}" + generate_ssh_key: yes + ssh_key_bits: 2048 + ssh_key_file: .ssh/id_rsa