# Ansible already traces every task # Observability on Board — episode 06 # docs: https://docs.ansible.com/ansible/latest/collections/community/general/opentelemetry_callback.html # page: https://observability-on-board.vercel.app/episodes/ansible/ # video: https://youtube.com/shorts/zYzCoRf1Yxk # # variants: ?ship=bronto|collector|custom ®ion=us &dataset= # ?endpoint=&header=&value= (custom target) # ── Bronto ────────────────────────────────── # On the controller, once: pip install opentelemetry-exporter-otlp # In the ansible.cfg next to the playbook: [defaults] callbacks_enabled = community.general.opentelemetry [callback_opentelemetry] otel_exporter_otlp_traces_protocol = http/protobuf otel_service_name = ansible # In the shell or CI job that runs the play, a bastion's .envrc for example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://ingestion.eu.bronto.io/v1/traces export OTEL_EXPORTER_OTLP_HEADERS="x-bronto-api-key=$BRONTO_API_KEY" ansible-playbook site.yml # The protocol line is required: the default is gRPC, and without it the play exits 0 and # exports nothing. # ── Local Collector ─────────────────────────────── # On the controller, once: pip install opentelemetry-exporter-otlp # In the ansible.cfg next to the playbook: [defaults] callbacks_enabled = community.general.opentelemetry [callback_opentelemetry] otel_exporter_otlp_traces_protocol = http/protobuf otel_service_name = ansible # In the shell or CI job that runs the play, a bastion's .envrc for example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces ansible-playbook site.yml # This assumes a Collector listening on localhost:4318; the # Local Collector setup (https://observability-on-board.vercel.app/setup/#collector) shows how to start one. # ── Your endpoint ────────────────────────────────── # This uses the endpoint and auth header you saved in the # setup guide (https://observability-on-board.vercel.app/setup/#custom). # On the controller, once: pip install opentelemetry-exporter-otlp # In the ansible.cfg next to the playbook: [defaults] callbacks_enabled = community.general.opentelemetry [callback_opentelemetry] otel_exporter_otlp_traces_protocol = http/protobuf otel_service_name = ansible # In the shell or CI job that runs the play, a bastion's .envrc for example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=YOUR_OTLP_ENDPOINT/v1/traces export OTEL_EXPORTER_OTLP_HEADERS="YOUR_AUTH_HEADER=YOUR_AUTH_VALUE" ansible-playbook site.yml