Skip to content

Commit

Permalink
Provisioning VM role
Browse files Browse the repository at this point in the history
  • Loading branch information
bardielle committed Feb 29, 2024
1 parent 8048497 commit 3df33ef
Show file tree
Hide file tree
Showing 16 changed files with 1,072 additions and 0 deletions.
9 changes: 9 additions & 0 deletions playbooks/provision_vm/manage_vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Playbook to provision a new VM on VMware
hosts: all
gather_facts: false
roles:
- role: redhat_cop.vmware_ops.provision_vm
vars:
clone_from_template: false
clone_from_vm: false
9 changes: 9 additions & 0 deletions playbooks/provision_vm/provisioning_vm_from_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Playbook to provision a new VM from template on VMware
hosts: all
gather_facts: false
roles:
- role: redhat_cop.vmware_ops.provision_vm
vars:
clone_from_template: true
clone_from_vm: false
10 changes: 10 additions & 0 deletions playbooks/provision_vm/provisioning_vm_from_vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Playbook to provision a new VM from an existing VM on VMware
hosts: all
gather_facts: false
roles:
- role: redhat_cop.vmware_ops.provision_vm
vars:
clone_from_template: false
clone_from_vm: true

69 changes: 69 additions & 0 deletions roles/create_vm_template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Provision virtual machine
================

A role to provision a virtual machine, create associated resources if they don’t exist (subnets, vCPU, memory configuration, storage configuration, etc)
This includes cloning and building from VM templates
Boot a VM from these types:
* Windows Server
* RHEL8
* RHEL9


Requirements
------------

vCenter logged in permission

Role Variables
--------------

* **vcenter_hostname** (str): (Required)
* **vcenter_username** (str): (Required)
* **vcenter_password** (str): (Required)
* **vcenter_validate_certs** (str): (Required)
* **provision_virtual_machine_operation** (str): (Required) Operation to perform. Valid values are:
clone_an_existing_vm, clone_template_to_template, clone_vm_to_template, create_new_vm, create_vm_from_template,
deploy_from_template.

Dependencies
------------

N/A

Example Playbook
----------------

All the variables defined in section [Role Variables](#role-variables) can be defined inside the ``vars.yml`` file.

Create a ``playbook.yml`` file like this:

```
---
- hosts: localhost
gather_facts: true
tasks:
- name: Provision a VM
ansible.builtin.import_role:
name: cloud.vmware_ops.provision_virtual_machine
vars:
aa: "{{ }}"
```

Run the playbook:

```shell
ansible-playbook playbook.yml -e "@vars.yml"
```

License
-------

GNU General Public License v3.0 or later

See [LICENCE](https://github.com/ansible-collections/cloud.vmware_ops/blob/main/LICENSE) to see the full text.

Author Information
------------------

- ??
1 change: 1 addition & 0 deletions roles/create_vm_template/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions roles/create_vm_template/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# vm name or vm template
- name: Create VM or template
ansible.builtin.include_tasks: "clone_vm_to_template.yml"

Loading

0 comments on commit 3df33ef

Please sign in to comment.