mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 04:52:11 +00:00
Split network and vm creation into own roles
This commit is contained in:
parent
487c091ba7
commit
bb8d2f27c6
4 changed files with 27 additions and 27 deletions
|
@ -7,7 +7,8 @@
|
||||||
- name: Deploy instance
|
- name: Deploy instance
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
roles:
|
roles:
|
||||||
- deploy
|
- create_net
|
||||||
|
- create_vm
|
||||||
|
|
||||||
- name: Install T-Pot on new instance
|
- name: Install T-Pot on new instance
|
||||||
hosts: tpot
|
hosts: tpot
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
- name: Generate T-Pot name
|
|
||||||
set_fact:
|
|
||||||
tpot_name: "t-pot-ansible-{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=6') }}"
|
|
||||||
|
|
||||||
- name: Create security group
|
- name: Create security group
|
||||||
os_security_group:
|
os_security_group:
|
||||||
cloud: open-telekom-cloud
|
cloud: open-telekom-cloud
|
||||||
|
@ -35,24 +31,3 @@
|
||||||
name: router-tpot
|
name: router-tpot
|
||||||
interfaces:
|
interfaces:
|
||||||
- subnet-tpot
|
- subnet-tpot
|
||||||
|
|
||||||
- name: Launch an 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
|
|
24
cloud/ansible/openstack/roles/create_vm/tasks/main.yaml
Normal file
24
cloud/ansible/openstack/roles/create_vm/tasks/main.yaml
Normal 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
|
|
@ -2,4 +2,4 @@ availability_zone: eu-de-03
|
||||||
image: Standard_Debian_10_latest
|
image: Standard_Debian_10_latest
|
||||||
volume_size: 128
|
volume_size: 128
|
||||||
key_name: your-KeyPair
|
key_name: your-KeyPair
|
||||||
flavor: s2.medium.8
|
flavor: s3.medium.8
|
Loading…
Reference in a new issue