Skip to content

Commit

Permalink
chore: add a playbook to initialize the dev env (ansible#1131)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex <[email protected]>
  • Loading branch information
Alex-Izquierdo authored Nov 7, 2024
1 parent 7d40aa8 commit 16a34da
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ If you use docker or podman, you can start just the postgres instance with:
task docker:up:postgres
```

### Initializing the deployment

You can initialize the deployment with some basic resources useful for development:

```shell
ansible-playbook tools/ansible/eda_init.yml
```

### Customizing database settings

If you need to run a local or standalone external instance of PostgreSQL service, you will need
Expand Down
62 changes: 62 additions & 0 deletions tools/ansible/eda_init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Initialises eda-server with some basic stuff for development and testing.
# Ansible module docs: https://galaxy.ansible.com/ui/repo/published/ansible/eda/docs/

- hosts: localhost
connection: local
gather_facts: no
vars:
# Development environment defaults
# You can override these values or use environment variables
# CONTROLLER_HOST, CONTROLLER_USERNAME, CONTROLLER_PASSWORD
controller_host: https://localhost:8443
controller_username: admin
controller_password: testpass
organization_name: Default
validate_certs: no
module_defaults:
group/ansible.eda.eda:
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: "{{ validate_certs }}"
tasks:
- name: Import sample project
ansible.eda.project:
organization_name: "{{ organization_name }}"
url: https://github.com/ansible/eda-sample-project
name: Eda sample project

- name: Create default upstream decision environment
ansible.eda.decision_environment:
organization_name: "{{ organization_name }}"
name: Upstream decision environment
image_url: quay.io/ansible/ansible-rulebook:main

- name: Create a credential for a basic event stream
ansible.eda.credential:
organization_name: "{{ organization_name }}"
name: Basic event stream credential
credential_type_name: Basic Event Stream
inputs:
username: secret
password: secret

- name: Create a basic event stream
ansible.eda.event_stream:
organization_name: "{{ organization_name }}"
name: Basic event stream
credential_name: Basic event stream credential

- name: Get and print the url of the basic event stream
block:
- name: Get the event stream generated
register: event_stream_data
ansible.eda.event_stream_info:
name: Basic event stream

- name: Print the event stream url
debug:
msg: "Basic Event Stream URL: {{ event_stream_data.event_streams[0].url }}"



0 comments on commit 16a34da

Please sign in to comment.