mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-29 03:38:51 +00:00
56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
- name: Create T-Pot name
|
|
shell: echo t-pot-ansible-$(pwgen -ns 6 -1)
|
|
register: tpot_name
|
|
|
|
- name: Import OpenStack authentication variables
|
|
include_vars:
|
|
file: roles/deploy/vars/os_auth.yaml
|
|
|
|
- name: Create security group
|
|
os_security_group:
|
|
auth:
|
|
auth_url: "{{ auth_url }}"
|
|
username: "{{ username }}"
|
|
password: "{{ password }}"
|
|
project_name: "{{ project_name }}"
|
|
os_user_domain_name: "{{ os_user_domain_name }}"
|
|
name: sg-tpot-any
|
|
description: tpot any-any
|
|
|
|
- name: Add rules to security group
|
|
os_security_group_rule:
|
|
auth:
|
|
auth_url: "{{ auth_url }}"
|
|
username: "{{ username }}"
|
|
password: "{{ password }}"
|
|
project_name: "{{ project_name }}"
|
|
os_user_domain_name: "{{ os_user_domain_name }}"
|
|
security_group: sg-tpot-any
|
|
remote_ip_prefix: 0.0.0.0/0
|
|
|
|
- name: Launch an instance
|
|
os_server:
|
|
auth:
|
|
auth_url: "{{ auth_url }}"
|
|
username: "{{ username }}"
|
|
password: "{{ password }}"
|
|
project_name: "{{ project_name }}"
|
|
os_user_domain_name: "{{ os_user_domain_name }}"
|
|
name: "{{ tpot_name.stdout }}"
|
|
region_name: "{{ region_name }}"
|
|
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 }}"
|
|
register: tpot
|
|
|
|
- name: Add instance to inventory
|
|
add_host:
|
|
hostname: "{{ tpot_name.stdout }}"
|
|
ansible_host: "{{ tpot.server.public_v4 }}"
|
|
groups: TPOT
|