Split network and vm creation into own roles

This commit is contained in:
Sebastian Haderecker
2021-02-13 17:22:49 +01:00
parent 487c091ba7
commit bb8d2f27c6
4 changed files with 27 additions and 27 deletions

View File

@ -0,0 +1,24 @@
- name: Generate T-Pot name
set_fact:
tpot_name: "t-pot-ansible-{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=6') }}"
- name: Create instance
os_server:
cloud: open-telekom-cloud
name: "{{ tpot_name.stdout }}"
availability_zone: "{{ availability_zone }}"
image: "{{ image }}"
boot_from_volume: yes
volume_size: "{{ volume_size }}"
key_name: "{{ key_name }}"
timeout: 200
flavor: "{{ flavor }}"
security_groups: sg-tpot-any
network: network-tpot
register: tpot
- name: Add instance to inventory
add_host:
hostname: "{{ tpot_name.stdout }}"
ansible_host: "{{ tpot.server.public_v4 }}"
groups: tpot