--- - name: Create and configure VMs hosts: all strategy: free gather_facts: false become: true vars_prompt: - name: user_name prompt: | What is your username? private: false - name: user_password prompt: | What is your password? confirm: true - name: root_password prompt: | What is your root password? confirm: true vars_files: vars.yml pre_tasks: - name: Set ansible_python_interpreter when: os | lower in ["rhel9", "rhel8"] ansible.builtin.set_fact: ansible_python_interpreter: /usr/bin/python3 - name: Validate variables ansible.builtin.assert: that: - filesystem in ["ext4", "xfs"] - install_drive is defined - os in ["rhel8", "rhel9"] - (vm_size | int) >= 20) - (vm_size | float) >= ((vm_memory | float / 1024 >= 16.0) | ternary((vm_memory | float / 2048), [vm_memory | float / 1024, 4.0] | max) + 16) fail_msg: Invalid input specified, please try again. - name: Set connection ansible.builtin.set_fact: ansible_connection: vmware_tools roles: - role: virtualization become: false vars: ansible_connection: local - role: environment vars: ansible_connection: vmware - role: partitioning vars: boot_partition_suffix: 1 main_partition_suffix: 2 - role: bootstrap - role: configuration - role: cis when: cis | bool - role: cleanup vars: ansible_connection: local tasks: - name: Set final SSH Credentials when: vmware_ssh | bool ansible.builtin.set_fact: ansible_user: "{{ user_name }}" ansible_password: "{{ user_password }}" ansible_become_password: "{{ user_password }}" ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - name: Check if VM is back and running ansible.builtin.wait_for_connection: timeout: 300