mirror of
https://github.com/trailofbits/algo.git
synced 2025-04-22 00:57:08 +02:00
parent
9d3a65b555
commit
1cca3b1093
4 changed files with 56 additions and 17 deletions
7
algo
7
algo
|
@ -308,6 +308,13 @@ Enter the public IP address of your server: (IMPORTANT! This IP is used to verif
|
|||
ROLES="local vpn"
|
||||
EXTRA_VARS="server_ip=$server_ip server_user=$server_user IP_subject_alt_name=$IP_subject"
|
||||
SKIP_TAGS+=" cloud update-alternatives"
|
||||
|
||||
read -p "
|
||||
Was this server deployed by Algo previously?
|
||||
[y/N]: " -r Deployed_By_Algo
|
||||
Deployed_By_Algo=${Deployed_By_Algo:-n}
|
||||
if [[ "$Deployed_By_Algo" =~ ^(y|Y)$ ]]; then EXTRA_VARS+=" Deployed_By_Algo=Y"; fi
|
||||
|
||||
}
|
||||
|
||||
algo_provisioning () {
|
||||
|
|
26
deploy.yml
26
deploy.yml
|
@ -9,6 +9,12 @@
|
|||
include: playbooks/local.yml
|
||||
tags: [ 'always' ]
|
||||
|
||||
- name: Local pre-tasks
|
||||
include: playbooks/local_ssh.yml
|
||||
become: false
|
||||
when: Deployed_By_Algo is defined and Deployed_By_Algo == "Y"
|
||||
tags: [ 'local' ]
|
||||
|
||||
roles:
|
||||
- { role: cloud-digitalocean, tags: ['digitalocean'] }
|
||||
- { role: cloud-ec2, tags: ['ec2'] }
|
||||
|
@ -17,24 +23,10 @@
|
|||
- { role: local, tags: ['local'] }
|
||||
|
||||
post_tasks:
|
||||
- name: Wait until SSH becomes ready...
|
||||
local_action:
|
||||
module: wait_for
|
||||
port: 22
|
||||
host: "{{ cloud_instance_ip }}"
|
||||
search_regex: "OpenSSH"
|
||||
delay: 10
|
||||
timeout: 320
|
||||
state: present
|
||||
- name: Local pre-tasks
|
||||
include: playbooks/post.yml
|
||||
become: false
|
||||
tags:
|
||||
- cloud
|
||||
|
||||
- name: A short pause, in order to be sure the instance is ready
|
||||
pause:
|
||||
seconds: 10
|
||||
tags:
|
||||
- cloud
|
||||
tags: [ 'cloud' ]
|
||||
|
||||
- name: Configure the server and install required software
|
||||
hosts: vpn-host
|
||||
|
|
23
playbooks/local_ssh.yml
Normal file
23
playbooks/local_ssh.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
|
||||
- name: Ensure the local ssh directory is exist
|
||||
local_action:
|
||||
module: file
|
||||
path: "~/.ssh/"
|
||||
state: directory
|
||||
|
||||
- name: Copy the algo ssh key to the local ssh directory
|
||||
local_action:
|
||||
module: copy
|
||||
src: configs/algo.pem
|
||||
dest: ~/.ssh/algo.pem
|
||||
mode: '0600'
|
||||
|
||||
- name: Configure the local ssh config
|
||||
blockinfile:
|
||||
dest: "~/.ssh/config"
|
||||
marker: "# {mark} ALGO MANAGED BLOCK {{ cloud_instance_ip|default(server_ip) }}"
|
||||
insertbefore: BOF
|
||||
block: |
|
||||
Host {{ cloud_instance_ip|default(server_ip) }}
|
||||
IdentityFile ~/.ssh/algo.pem
|
17
playbooks/post.yml
Normal file
17
playbooks/post.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
|
||||
- name: Wait until SSH becomes ready...
|
||||
local_action:
|
||||
module: wait_for
|
||||
port: 22
|
||||
host: "{{ cloud_instance_ip }}"
|
||||
search_regex: "OpenSSH"
|
||||
delay: 10
|
||||
timeout: 320
|
||||
state: present
|
||||
|
||||
- name: A short pause, in order to be sure the instance is ready
|
||||
pause:
|
||||
seconds: 10
|
||||
|
||||
- include: local_ssh.yml
|
Loading…
Add table
Reference in a new issue