Skip to content

Commit a87d8b8

Browse files
Merge pull request #1251 from unfetter-discover/develop
v0.3.8 into master
2 parents ac93685 + c806f13 commit a87d8b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1034
-375
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ test-certs/output/*
88
data/db/*
99
# need at least one file in the folder
1010
!data/db/.gitkeep
11+
docker-hub.pass.txt

ansible/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ virtualenv
22
data
33
*.retry
44

5+
*.tar
6+
backup/*
7+
!backup/.gitkeep
8+
dist

ansible/ansible.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[defaults]
2-
hostfile = hosts
2+
inventory = hosts.ini

ansible/build-prod.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
####################################################################################
3+
# This playbook only builds the docker images locally
4+
#
5+
####################################################################################
6+
7+
8+
- name: Build the Docker images only. Do not
9+
hosts: build
10+
tasks:
11+
- name: Iterate over group variables
12+
debug:
13+
var: item
14+
with_items: "{{ hostvars | to_nice_json }}"
15+
- name: Start running the commands
16+
import_tasks: discover-tasks.yml
17+

ansible/deploy-all.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
####################################################################################
3+
# This playbook manages the target hosts and calls "discover-tasks.yml" workhorse
4+
# playbook.
5+
# Specific target hosts can be built using the following:
6+
# ansible-playbook -i dev discover.yml
7+
#
8+
#
9+
####################################################################################
10+
11+
- name: Build Playbook
12+
hosts: all
13+
14+
tasks:
15+
- name: Start running the commands
16+
import_tasks: discover-tasks.yml
17+
18+

ansible/deploy-dev.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
####################################################################################
3+
# This playbook only builds in dev mode.
4+
#
5+
####################################################################################
6+
7+
8+
- name: Build Playbook
9+
hosts: dev
10+
tasks:
11+
12+
- name: Start running the commands
13+
import_tasks: discover-tasks.yml
14+
15+

ansible/deploy-prod.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
####################################################################################
3+
# This playbook only builds in dev mode.
4+
#
5+
####################################################################################
6+
7+
8+
- name: Build Playbook
9+
hosts: prod
10+
tasks:
11+
12+
- name: Start running the commands
13+
import_tasks: discover-tasks.yml
14+
15+

ansible/discover-build-local-source.yml

-20
This file was deleted.

ansible/discover-build-repository.yml

-25
This file was deleted.

ansible/discover-run-dev.yml

-21
This file was deleted.

ansible/discover-run-prod.yml

-18
This file was deleted.

ansible/discover-tasks.yml

+67-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
---
2+
3+
#############################################
4+
# discover-tasks.yml
5+
# This task file is the main workhorse for building the docker containers.
6+
#
7+
#############################################
8+
9+
# Override variables allows user sto create a variable file that overrides any of the variables
10+
# from this playbook. Override variables allows users to make changes to how the containers
11+
# are built without changing the core playbook.
12+
13+
14+
- name: Include override vars
15+
register: overrides
16+
include_vars:
17+
file: "{{ playbook_dir }}/group_vars/override_vars.yml"
18+
ignore_errors: yes
19+
20+
# These variables do not change through this playbook. So the facts are set_fact
21+
# here. If override variables exist, they take precedence.
22+
23+
- set_fact:
24+
# docker_tag is the docker image version number.
25+
docker_tag: "{{ overrides.docker_tag | default(docker_tag) }}"
26+
# build_action tells ansible if we are building the image from source "local" or pulling
27+
# from a registry "pull"
28+
build_action: "{{ overrides.build_action | default(build_action) }}"
29+
# Run action is true if we want to run the containers. We can set to "false" to just build the images
30+
run_action: "{{ overrides.run_action | default(run_action) }}"
31+
# If we are running in Dev mode, we need the unfetter-ui container. If in Prod mode, we
32+
# store the UI code inside the gateway
33+
use_unfetter_ui: "{{ overrides.use_unfetter_ui | default(use_unfetter_ui) }}"
34+
# use_uac is true/false, depending on if we are in demo mode or want uac turned on
35+
use_uac: "{{ overrides.use_uac | default(use_uac) }}"
36+
# use_taxii for setting up the taxii server
37+
use_taxii: "{{ overrides.use_taxii | default(use_taxii) }}"
38+
# The location of the registry. Default is docker hub
39+
registry: "{{ overrides.registry | default(registry) }}"
40+
# Prepath is the relative path of the start of the unfetter code directories
41+
prepath: "{{ overrides.prepath | default(prepath) }}"
42+
43+
# Displaying the variables.
44+
- debug:
45+
msg:
46+
- "docker_tag: {{ docker_tag }} "
47+
- "build_action: {{ build_action }}"
48+
- "run_action: {{ run_action }}"
49+
- "use_unfetter_ui: {{ use_unfetter_ui }}"
50+
- "use_uac: {{ use_uac }}"
51+
- "use_taxii: {{ use_taxii }}"
52+
- "registry: {{ registry }}"
53+
- "prepath: {{ prepath }}"
54+
255
- include_role:
356
name: common
57+
- include_role:
58+
name: processor
459
- include_role:
560
name: openssl
661
- include_role:
@@ -11,19 +66,27 @@
1166
name: api
1267
- include_role:
1368
name: explorer
14-
- include_role:
15-
name: processor
69+
1670
- include_role:
1771
name: ui
1872
- include_role:
1973
name: ingest
74+
# if running in dev mode, then the image will be nginx.
75+
76+
# If build_action = pull, pull gateway
77+
# If building local, then nginx
78+
# if dev mode
79+
80+
2081
- include_role:
2182
name: gateway
2283
vars:
2384
image_name: "nginx:1.13.5-alpine"
2485
when:
25-
- run_mode == 'dev'
86+
- build_action == 'local'
87+
# If not running in dev mode, then we are pulling the gateway from the registry
2688
- include_role:
2789
name: gateway
2890
when:
29-
- run_mode != 'dev'
91+
- build_action != 'local'
92+

ansible/discover.yml

-6
This file was deleted.

ansible/group_vars/override_vars.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To override any of the variables, just uncomment the line to override
2+
3+
#tag: "0.3.6"
4+
#docker_tag: "0.3.6"
5+
#prepath: "../../"
6+
#build_action: "pull"
7+
#run_action: "demo"
8+
#use_unfetter_ui: true
9+
#use_uac: true
10+
#use_taxii: false
11+
#run_mode: "dev"
12+
#registry: "unfetter/"

ansible/hosts

-4
This file was deleted.

0 commit comments

Comments
 (0)