Skip to content

Commit

Permalink
Update playbook usage and docs (#21)
Browse files Browse the repository at this point in the history
* Vagrant usage updated

* Add prometheus examples on inventory docs

* Add ansible posix collection to requirements file

* Remove ssl directory from project

* Ansible lint

* Add self signed certificate for trento.local in Vagrantfile

* Update Vagrant usage in README
  • Loading branch information
CDimonaco authored Jan 24, 2024
1 parent 2814225 commit cc48e25
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 8 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ We provide two examples to run the playbook as-is without further modifications.
- Create a json file containing the variables for the playbook or pass them via cli
- Run provision command

**Example inventory to install the trento-server and provision postgres and rabbitmq, all on the same host**
**Example inventory to install the trento-server and provision postgres, rabbitmq and prometheus all on the same host**

```yaml
all:
Expand All @@ -65,6 +65,11 @@ all:
vitellone:
ansible_host: "your-host"
ansible_user: "your-user"
prometheus-hosts:
hosts:
vitellone:
ansible_host: "your-host"
ansible_user: "your-user"
```
**Example json variables file to install trento-server with the all in one node configuration**
Expand All @@ -82,7 +87,7 @@ all:

---

**Example inventory to install trento-server, provision postgres and rabbitmq, each component on dedicated node**
**Example inventory to install trento-server, provision postgres, rabbitmq and prometheus each component on dedicated node**

```yaml
all:
Expand All @@ -102,9 +107,14 @@ all:
vitellone-mq:
ansible_host: "your-host"
ansible_user: "your-user"
prometheus-hosts:
hosts:
vitellone-metrics:
ansible_host: "your-host"
ansible_user: "your-user"
```
**Example json variables files to install trento-server, provision postgres and rabbitmq, each component on dedicated node**
**Example json variables files to install trento-server, provision postgres, prometheus and rabbitmq, each component on dedicated node**
```json
{
Expand Down Expand Up @@ -319,15 +329,19 @@ $ ansible-playbook -i inventory.yml --extra-vars @extra-vars.json playbook.clean

You can test the playbook using vagrant, the default configuration in this repository assumes that you have VirtualBox, change it to what matches your setup.

The `Vagrantfile` contains sane defaults for running the playbook, you can find the application running on `localhost:8080` or `trento.local:8080` if you have `trento.local` as `localhost` alias in your `/etc/hosts`.
The `Vagrantfile` contains sane defaults for running the playbook, it assumes that you have `trento.local` as `localhost` alias in your `/etc/hosts`.

You can reach the trento application using `https://trento.local:8443`.

The Vagrantfile contains a self signed certificate for `trento.local` domain, make sure you accept the exception when prompted by your browser.

Start the vagrant box

```bash
$ vagrant up
```

This will spawn a vagrant box with `Opensuse Leap 15.3` as base box. The provisioning will be automatic after the box starts.
This will spawn a vagrant box with `Opensuse Leap 15.4` as base box. The provisioning will be automatic after the box starts.

Force provision the vagrant box

Expand Down
74 changes: 71 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,91 @@
Vagrant.require_version ">= 1.8.0"

Vagrant.configure(2) do |config|
config.vm.box = "opensuse/Leap-15.4.x86_64"
config.vm.define "machine1"

config.vm.box = "opensuse/Leap-15.3.x86_64"
config.vm.provision "ansible" do |ansible|
# ansible.verbose = "v"
ansible.playbook = "playbook.yml"
ansible.groups = {
"trento-server" => ["machine1"],
"postgres-hosts" => ["machine1"],
"prometheus-hosts" => ["machine1"],
"rabbitmq-hosts" => ["machine1"]
}
ansible.extra_vars = {
web_postgres_password: "pass",
wanda_postgres_password: "wanda",
rabbitmq_password: "trento",
nginx_vhost_filename: "trento.conf",
prometheus_url: "http://localhost",
web_admin_password: "adminpassword",
trento_server_name: "trento.local trento.local:8080"
trento_server_name: "trento.local",
nginx_ssl_cert_as_base64: "false",
nginx_ssl_key_as_base64: "false",
nginx_ssl_cert: "
-----BEGIN CERTIFICATE-----
MIIEZDCCA0ygAwIBAgIUAue46Y/9kwT+zvPPW2xfuNv1+Z4wDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCSVQxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UE
CgwTRGVmYXVsdCBDb21wYW55IEx0ZDEaMBgGA1UEAwwRdHJlbnRvLmxvY2FsOjgw
ODAwHhcNMjQwMTIzMTUyODE1WhcNMzQwMTIwMTUyODE1WjBeMQswCQYDVQQGEwJJ
V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SFAxPWG+VARI
IFdA80LbhuvSqV+7weUbNwIcSnUu7+4oGejk/zonsTKxwYe5hL05jM+trdGkkRvo
hrQ47FQ2MJm2cylrSL1O0Hp46QKBgQC7s4zNqV+sUoEEQwCntLmS+GgNx1iq7Ibx
89QK7Q6WersLi4nVmNCIODrL/SkeraJeZLUIXdDcvZlt4bFWmTx3EECJKoVL1/Q0
YlNx/FZYZBqcCr6hBhovbpMkbOFxX3Xuo2FMf7++tBrEwFom3r/9Wx1KMGkum73G
Sv9vlDqKqQKBgAg9IH51FVoJDSJHM19GLJ6i9raBhDWZztGIK/3zmCK6AJJn6gJk
A+XsrpnSi+LDJya9bIouhgXuPvkCghYJhf8zXRJGoEwou3leEI5kuhxJWzjSZQVP
P9WKsNyr6r3Ebwr/YvOtPytSNUAgWmbZPt76+h/IZQeRNVtPVIhxKPQpAoGABB/N
2DcAgyjM7OsL+KNf8HrEzoiyyg6oaGiTICpVR7kqovZN8QOKkXOq1xCY9rOZ/bj4
wVZOYItJ88AhxWVYjsUspdbpVuFH3F7MtpR00Txh2UvjJGad7KzhTsuVqIgQb03n
tWaZL/eFHw2a7X+3eDmoSxkFNqD1aoX7VthK8QECgYEAs99HdXW9LlGQeoUrG5UX
14Zm7CH/6TtwdWFpbcppJpipEtbDHyjpyiDlrgI4uxVilPnrBQtgzHCf8U2xQDJF
l0GpzDqUXDQI3wdzi8gVUBgPpjfVa9msafc7m6faT8myjHr/p6TJKj9Z36j58WHv
mpNiKDOPALNTs+Ukdkt5KlE=
-----END PRIVATE KEY-----
"
}
end
config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.cpus = 4
end
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 443, host: 8443
end
1 change: 1 addition & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ collections:
- community.general
- community.rabbitmq
- community.postgresql
- ansible.posix
Empty file removed ssl/place-cert-key-here
Empty file.

0 comments on commit cc48e25

Please # to comment.