Add initial configuration and templates for feedstack role.
This commit is contained in:
22
defaults/main.yml
Normal file
22
defaults/main.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
# Define the feedstack serer host name, defaulting to the inventory host.
|
||||
feedstack_server_hostname: "{{ hostname }}.{{ domain }}"
|
||||
|
||||
# Define a default location for the feedstack certificates on the host filesystem.
|
||||
feedstack_cert_directory: "/var/local/certs/{{ feedstack_server_hostname }}"
|
||||
|
||||
# Define default names for the feedstack server SSL certificate and key files.
|
||||
feedstack_server_cert_filename: "fullchain.pem"
|
||||
feedstack_server_key_filename: "privkey.pem"
|
||||
|
||||
# Define the default weatherfeeder container image and tag.
|
||||
feedstack_weatherfeeder_container_image: "harbor.maximumdirect.net/library/weatherfeeder"
|
||||
feedstack_weatherfeeder_container_tag: "latest"
|
||||
|
||||
# Define the default agent container image and tag.
|
||||
feedstack_nats_container_image: "nats"
|
||||
feedstack_nats_container_tag: "linux"
|
||||
|
||||
# Define the default Watchtower container image and tag.
|
||||
feedstack_watchtower_container_image: "containrrr/watchtower"
|
||||
feedstack_watchtower_container_tag: "latest"
|
||||
4
meta/main.yml
Normal file
4
meta/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: docker
|
||||
...
|
||||
30
tasks/main.yml
Normal file
30
tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Create the directory for the weatherfeeder configuration file if it doesn't already exist.
|
||||
file:
|
||||
path: "{{ docker_appdata_directory}}/{{ feedstack_directory_item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- weatherfeeder
|
||||
- nats/config
|
||||
- nats/data
|
||||
loop_control:
|
||||
loop_var: feedstack_directory_item
|
||||
label: "{{ feedstack_directory_item }}"
|
||||
become: true
|
||||
|
||||
- name: Create the weatherfeeder configuration file from the provided template.
|
||||
template:
|
||||
src: "weatherfeeder/config.yml.j2"
|
||||
dest: "{{ docker_appdata_directory }}/weatherfeeder/config.yml"
|
||||
become: true
|
||||
|
||||
- name: Create the nats configuration file from the provided template.
|
||||
template:
|
||||
src: "nats/nats.conf.j2"
|
||||
dest: "{{ docker_appdata_directory }}/nats/config/nats.conf"
|
||||
become: true
|
||||
|
||||
- name: Run the docker-compose role to apply the docker-compose.yml file.
|
||||
import_role:
|
||||
name: "docker-compose"
|
||||
...
|
||||
13
templates/nats/nats.conf.j2
Normal file
13
templates/nats/nats.conf.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
# Single-node NATS configuration for local app-to-app messaging.
|
||||
# WeatherFeeder can publish to this server without authentication.
|
||||
|
||||
# Client connections (WeatherFeeder + consumers).
|
||||
port: 4222
|
||||
|
||||
# HTTP monitoring endpoint.
|
||||
monitor_port: 8222
|
||||
|
||||
# Optional persistence for future stream use.
|
||||
jetstream {
|
||||
store_dir: "/data"
|
||||
}
|
||||
59
templates/weatherfeeder/config.yml.j2
Normal file
59
templates/weatherfeeder/config.yml.j2
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
sources:
|
||||
- name: NWSObservationKSTL
|
||||
kind: observation
|
||||
driver: nws_observation
|
||||
every: 10m
|
||||
params:
|
||||
url: "https://api.weather.gov/stations/KSTL/observations/latest"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
- name: OpenMeteoObservation
|
||||
kind: observation
|
||||
driver: openmeteo_observation
|
||||
every: 10m
|
||||
params:
|
||||
url: "https://api.open-meteo.com/v1/forecast?latitude=38.6263&longitude=-90.3432¤t=temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m,wind_direction_10m,precipitation,surface_pressure,rain,showers,snowfall,cloud_cover,apparent_temperature,is_day,wind_gusts_10m,pressure_msl&forecast_days=1"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
- name: NWSObservationKSUS
|
||||
kind: observation
|
||||
driver: nws_observation
|
||||
every: 10m
|
||||
params:
|
||||
url: "https://api.weather.gov/stations/KSUS/observations/latest"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
- name: NWSObservationKCPS
|
||||
kind: observation
|
||||
driver: nws_observation
|
||||
every: 10m
|
||||
params:
|
||||
url: "https://api.weather.gov/stations/KCPS/observations/latest"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
- name: NWSHourlyForecastSTL
|
||||
kind: forecast
|
||||
driver: nws_forecast
|
||||
every: 45m
|
||||
params:
|
||||
url: "https://api.weather.gov/gridpoints/LSX/90,74/forecast/hourly"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
- name: NWSAlertsSTL
|
||||
kind: alert
|
||||
driver: nws_alerts
|
||||
every: 1m
|
||||
params:
|
||||
url: "https://api.weather.gov/alerts?point=38.6263,-90.3432&limit=20"
|
||||
user_agent: "HomeOps (weatherfeeder@maximumdirect.net)"
|
||||
|
||||
sinks:
|
||||
- name: stdout
|
||||
driver: stdout
|
||||
params: {}
|
||||
|
||||
routes:
|
||||
- sink: stdout
|
||||
kinds: ["observation", "forecast", "alert"]
|
||||
...
|
||||
27
vars/containers/nats.yml
Normal file
27
vars/containers/nats.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
nats:
|
||||
|
||||
# Define the name of this container.
|
||||
name: "nats"
|
||||
|
||||
# Define the docker image to be used for this container.
|
||||
image: "{{ feedstack_nats_container_image }}:{{ feedstack_nats_container_tag }}"
|
||||
|
||||
# Define the path where application data for this container will be stored.
|
||||
appdata_directory: "{{ docker_appdata_directory }}/nats"
|
||||
|
||||
# Define the volumes that should be mounted into the container.
|
||||
volumes:
|
||||
- "{{ docker_appdata_directory }}/nats/data:/data"
|
||||
- "{{ docker_appdata_directory }}/nats/config/nats.conf:/etc/nats/nats.conf:ro"
|
||||
|
||||
# Define the ports that should be opened to the outside world.
|
||||
ports:
|
||||
- "4222:4222" # client port
|
||||
- "6222:6222" # cluster port
|
||||
- "8222:8222" # monitoring port
|
||||
|
||||
# Define environment variables to be passed to the container.
|
||||
#environment_variables: []
|
||||
|
||||
...
|
||||
16
vars/containers/watchtower.yml
Normal file
16
vars/containers/watchtower.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
watchtower:
|
||||
|
||||
# Define the name of this container.
|
||||
name: "feedstack-watchtower"
|
||||
|
||||
# Define the docker image to be used for this container.
|
||||
image: "{{ feedstack_watchtower_container_image }}:{{ feedstack_watchtower_container_tag }}"
|
||||
|
||||
# Define the path where application data for this container will be stored.
|
||||
appdata_directory: "{{ docker_appdata_directory }}/watchtower"
|
||||
|
||||
# Define the volumes that should be mounted into the container.
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
...
|
||||
23
vars/containers/weatherfeeder.yml
Normal file
23
vars/containers/weatherfeeder.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
weatherfeeder:
|
||||
|
||||
# Define the name of this container.
|
||||
name: "weatherfeeder"
|
||||
|
||||
# Define the docker image to be used for this container.
|
||||
image: "{{ feedstack_weatherfeeder_container_image }}:{{ feedstack_weatherfeeder_container_tag }}"
|
||||
|
||||
# Define the path where application data for this container will be stored.
|
||||
appdata_directory: "{{ docker_appdata_directory }}/weatherfeeder"
|
||||
|
||||
# Define the volumes that should be mounted into the container.
|
||||
volumes:
|
||||
- "{{ docker_appdata_directory }}/weatherfeeder/config.yml:/weatherfeeder/config.yml:ro"
|
||||
|
||||
# Define the ports that should be opened to the outside world.
|
||||
#ports: []
|
||||
|
||||
# Define environment variables to be passed to the container.
|
||||
#environment_variables: []
|
||||
|
||||
...
|
||||
3
vars/main.yml
Normal file
3
vars/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
...
|
||||
Reference in New Issue
Block a user