first round of debugging

This commit is contained in:
milkmix 2019-03-05 17:28:50 +01:00 committed by milkmix
parent 53260c9a82
commit 24e03b6faf
4 changed files with 66 additions and 51 deletions

View file

@ -20,7 +20,7 @@
- { name: Google Compute Engine, alias: gce }
- { name: Scaleway, alias: scaleway}
- { name: OpenStack (DreamCompute optimised), alias: openstack }
- { name: CloudStack, alias: cloudstask }
- { name: CloudStack, alias: cloudstack }
- { name: Install to existing Ubuntu 18.04 server (Advanced), alias: local }
vars_files:
- config.cfg

View file

@ -1,58 +1,66 @@
---
- block:
- name: Build python virtual environment
import_tasks: venv.yml
- name: Build python virtual environment
import_tasks: venv.yml
- block:
- name: Security group created
cs_securitygroup:
name: "{{ algo_server_name }}-security_group"
description: AlgoVPN security group
register: cs_security_group
- block:
- name: Include prompts
import_tasks: prompts.yml
- name: Security group created
local_action:
module: cs_securitygroup
name: "{{ algo_server_name }}-security_group"
description: AlgoVPN security group
register: cs_security_group
- name: Security rules created
cs_security_group_rule:
security_group: "{{ cs_security_group.name }}"
protocol: "{{ item.proto }}"
start_port: "{{ item.port_min }}"
end_port: "{{ item.port_max }}"
cidr: "{{ item.range }}"
with_items:
- { proto: tcp, start_port: 22, end_port: 22, range: 0.0.0.0/0 }
- { proto: udp, start_port: 4500, end_port: 4500, range: 0.0.0.0/0 }
- { proto: udp, start_port: 500, end_port: 500, range: 0.0.0.0/0 }
- { proto: udp, start_port: "{{ wireguard_port }}", end_port: "{{ wireguard_port }}", range: 0.0.0.0/0 }
- name: Security rules created
local_action:
module: cs_security_group_rule
security_group: "{{ cs_security_group.name }}"
protocol: "{{ item.proto }}"
start_port: "{{ item.port_min }}"
end_port: "{{ item.port_max }}"
cidr: "{{ item.range }}"
with_items:
- { proto: tcp, start_port: 22, end_port: 22, range: 0.0.0.0/0 }
- { proto: udp, start_port: 4500, end_port: 4500, range: 0.0.0.0/0 }
- { proto: udp, start_port: 500, end_port: 500, range: 0.0.0.0/0 }
- { proto: udp, start_port: "{{ wireguard_port }}", end_port: "{{ wireguard_port }}", range: 0.0.0.0/0 }
- name: Keypair created
cs_sshkeypair:
name: "{{ SSH_keys.comment|regex_replace('@', '_') }}"
public_key: "{{ SSH_keys.public }}"
register: cs_keypair
- name: Keypair created
local_action:
module: cs_sshkeypair
name: "{{ SSH_keys.comment|regex_replace('@', '_') }}"
public_key: "{{ SSH_keys.public }}"
register: cs_keypair
- name: Set facts
set_fact:
image_id: "{{ cloud_providers.cloudstack.image }}"
size: "{{ cloud_providers.cloudstack.size }}"
disk: "{{ cloud_providers.cloudstack.disk }}"
keypair_name: "{{ cs_keypair.name }}"
- name: Set facts
set_fact:
image_id: "{{ cloud_providers.cloudstack.image }}"
size: "{{ cloud_providers.cloudstack.size }}"
disk: "{{ cloud_providers.cloudstack.disk }}"
keypair_name: "{{ cs_keypair.name }}"
- name: Server created
cs_instance:
name: "{{ algo_server_name }}"
root_disk_size: "{{ disk }}"
image: "{{ image_id }}"
ssh_key: "{{ keypair_name }}"
security_groups: "{{ cs_security_group.name }}"
register: cs_server
- name: Server created
local_action:
module: cs_instance
name: "{{ algo_server_name }}"
root_disk_size: "{{ disk }}"
image: "{{ image_id }}"
ssh_key: "{{ keypair_name }}"
security_groups: "{{ cs_security_group.name }}"
zone: "{{ _algo_region }}"
register: cs_server
- set_fact:
cloud_instance_ip: "{{ cs_server.default_ip }}"
ansible_ssh_user: ubuntu
environment:
PYTHONPATH: "{{ cloudstack_venv }}/lib/python2.7/site-packages/"
- set_fact:
cloud_instance_ip: "{{ cs_server.default_ip }}"
ansible_ssh_user: ubuntu
environment:
PYTHONPATH: "{{ cloudstack_venv }}/lib/python2.7/site-packages/"
rescue:
- debug: var=fail_hint
tags: always
- fail:
tags: always
rescue:
- debug: var=fail_hint
tags: always
- fail:
tags: always

View file

@ -0,0 +1,7 @@
---
- block:
- pause:
prompt: |
What region should the server be located in?
register: _algo_region
when: region is undefined

View file

@ -7,7 +7,7 @@
- name: Install requirements
pip:
name: sc
name: cs
version: 2.5.8
virtualenv: "{{ cloudstack_venv }}"
virtualenv_python: python2.7