Skip to content

Commit 16a34da

Browse files
chore: add a playbook to initialize the dev env (#1131)
Signed-off-by: Alex <aizquier@redhat.com>
1 parent 7d40aa8 commit 16a34da

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

docs/development.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ If you use docker or podman, you can start just the postgres instance with:
232232
task docker:up:postgres
233233
```
234234

235+
### Initializing the deployment
236+
237+
You can initialize the deployment with some basic resources useful for development:
238+
239+
```shell
240+
ansible-playbook tools/ansible/eda_init.yml
241+
```
242+
235243
### Customizing database settings
236244

237245
If you need to run a local or standalone external instance of PostgreSQL service, you will need

tools/ansible/eda_init.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Initialises eda-server with some basic stuff for development and testing.
2+
# Ansible module docs: https://galaxy.ansible.com/ui/repo/published/ansible/eda/docs/
3+
4+
- hosts: localhost
5+
connection: local
6+
gather_facts: no
7+
vars:
8+
# Development environment defaults
9+
# You can override these values or use environment variables
10+
# CONTROLLER_HOST, CONTROLLER_USERNAME, CONTROLLER_PASSWORD
11+
controller_host: https://localhost:8443
12+
controller_username: admin
13+
controller_password: testpass
14+
organization_name: Default
15+
validate_certs: no
16+
module_defaults:
17+
group/ansible.eda.eda:
18+
controller_host: "{{ controller_host }}"
19+
controller_username: "{{ controller_username }}"
20+
controller_password: "{{ controller_password }}"
21+
validate_certs: "{{ validate_certs }}"
22+
tasks:
23+
- name: Import sample project
24+
ansible.eda.project:
25+
organization_name: "{{ organization_name }}"
26+
url: https://github.com/ansible/eda-sample-project
27+
name: Eda sample project
28+
29+
- name: Create default upstream decision environment
30+
ansible.eda.decision_environment:
31+
organization_name: "{{ organization_name }}"
32+
name: Upstream decision environment
33+
image_url: quay.io/ansible/ansible-rulebook:main
34+
35+
- name: Create a credential for a basic event stream
36+
ansible.eda.credential:
37+
organization_name: "{{ organization_name }}"
38+
name: Basic event stream credential
39+
credential_type_name: Basic Event Stream
40+
inputs:
41+
username: secret
42+
password: secret
43+
44+
- name: Create a basic event stream
45+
ansible.eda.event_stream:
46+
organization_name: "{{ organization_name }}"
47+
name: Basic event stream
48+
credential_name: Basic event stream credential
49+
50+
- name: Get and print the url of the basic event stream
51+
block:
52+
- name: Get the event stream generated
53+
register: event_stream_data
54+
ansible.eda.event_stream_info:
55+
name: Basic event stream
56+
57+
- name: Print the event stream url
58+
debug:
59+
msg: "Basic Event Stream URL: {{ event_stream_data.event_streams[0].url }}"
60+
61+
62+

0 commit comments

Comments
 (0)