forked from picoCTF/picoCTF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker support to local_development ansible
Allows docker support on the local development Vagrant vm. Currently collocates docker challenges on the shell server, but does all the certificate configuration as if it were on a separate host.
- Loading branch information
1 parent
861255d
commit f108297
Showing
6 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
deploy_keys | ||
certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,42 @@ | ||
--- | ||
# Playbook to deploy the entire picoCTF environment | ||
|
||
- hosts: db | ||
- hosts: docker | ||
remote_user: "{{ ansible_user }}" | ||
become: yes | ||
become_method: sudo | ||
roles: | ||
- common | ||
- mongodb | ||
- {role: common , tags: ["common"]} | ||
- {role: docker , tags: ["docker"]} | ||
- {role: docker_tls , tags: ["docker"], vars: {server_SAN: "{{docker_server_SAN}}"}} | ||
post_tasks: | ||
- import_tasks: "tasks/docker_gen_client_certs.yml" | ||
|
||
- hosts: shell | ||
remote_user: "{{ ansible_user }}" | ||
become: yes | ||
become_method: sudo | ||
pre_tasks: | ||
- import_tasks: "tasks/docker_deploy_client_certs.yml" | ||
roles: | ||
- {role: common , tags: ["common"]} | ||
- {role: docker , tags: ["docker"]} | ||
- {role: pico-shell , tags: ["shell"]} | ||
|
||
- hosts: db | ||
remote_user: "{{ ansible_user }}" | ||
become: yes | ||
become_method: sudo | ||
roles: | ||
- common | ||
- pico-shell | ||
- {role: common , tags: ["common"]} | ||
- {role: mongodb , tags: ["db"]} | ||
|
||
- hosts: web | ||
remote_user: "{{ ansible_user }}" | ||
become: yes | ||
become_method: sudo | ||
pre_tasks: | ||
- import_tasks: "tasks/docker_deploy_client_certs.yml" | ||
roles: | ||
- common | ||
- pico-web | ||
- {role: common , tags: ["common"]} | ||
- {role: pico-web , tags: ["web"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
# deploy a client certificate to a server | ||
# must have already been generated with docker_gen_client_certs.yml | ||
|
||
- name: "Deploy docker client certs ({{client}}" | ||
import_role: | ||
name: docker_tls | ||
tasks_from: config_user | ||
vars: | ||
user : "{{ansible_user}}" | ||
tags: ["docker", "docker-client"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
# tasks to run after the docker server is provisioned | ||
# generate certificates as nessecary | ||
|
||
- name: "Generate Docker Client Certs ({{client}})" | ||
include_role: | ||
name: docker_tls | ||
tasks_from: gen_client | ||
with_items: | ||
- "{{ web_fqdn }}" | ||
- "{{ shell_hostname }}" | ||
loop_control: | ||
loop_var: client | ||
tags: ["docker", "docker-client"] |