Last active
July 11, 2021 22:05
-
-
Save theopscorner/779c8a030105ecbf2f89db0fb0cf87da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Deploy VM based on Requested Size | |
hosts: localhost | |
gather_facts: no | |
vars_files: | |
- vars/sizes-vars.yaml | |
vars_prompt: | |
- name: strname | |
prompt: "\nPlease enter the VM name" | |
private: no | |
- name: vm_size | |
prompt: | | |
Enter the size number to select the requested size. | |
1 - Small (2cpus 4g mem) | |
2 - Medium (2cpus 8g mem) | |
3 - Large (4cpus 12g mem) | |
private: no | |
tasks: | |
- set_fact: | |
size: "small" | |
when: vm_size == '1' | |
- set_fact: | |
size: "medium" | |
when: vm_size == '2' | |
- set_fact: | |
size: "large" | |
when: vm_size == '3' | |
- name: Debug the variable for CPU | |
debug: | |
msg: >- | |
Creating VM {{ strname|lower }} | |
with {{ vm_cpu_size[size] }} vCPUs | |
and {{ vm_mem_size[size] }}MB of RAM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment