Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
---
- 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