Skip to content

[ansible] Add option to set service CLI args #6270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions deployments/ansible/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## ansible-v0.32.0

### 💡 Enhancements 💡

- Add support for the `splunk_otel_collector_command_line_args` option to
configure the command line arguments for the Splunk OpenTelemetry Collector
service.

## ansible-v0.31.0

### 🛑 Breaking changes 🛑
Expand Down
1 change: 1 addition & 0 deletions deployments/ansible/molecule/custom_vars/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
splunk_service_user: custom-user
splunk_service_group: custom-group
splunk_memory_total_mib: 256
splunk_otel_collector_command_line_args: "--discovery"
gomemlimit: 230
splunk_listen_interface: 1.2.3.4
splunk_fluentd_config: /etc/otel/collector/fluentd/custom_fluentd.conf
Expand Down
7 changes: 7 additions & 0 deletions deployments/ansible/molecule/custom_vars/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
state: present
check_mode: yes

- name: Assert OTELCOL_OPTIONS env var is set per splunk_otel_collector_command_line_args
ansible.builtin.lineinfile:
line: OTELCOL_OPTIONS=--discovery
dest: /etc/otel/collector/splunk-otel-collector.conf
state: present
check_mode: yes

- name: Assert MY_CUSTOM_VAR1 env var is set
ansible.builtin.lineinfile:
line: MY_CUSTOM_VAR1=value1
Expand Down
10 changes: 10 additions & 0 deletions deployments/ansible/roles/collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ $> ansible-playbook playbook.yaml -e start_service=false
`splunk_otel_collector_proxy_http` or `splunk_otel_collector_proxy_https` is
defined. (**default:** `localhost,127.0.0.1,::1`)

- `splunk_otel_collector_command_line_args`: Command-line arguments to pass to the
Splunk OpenTelemetry Collector. These will be added as arguments to the service
command line.
(**default:** `""`)

Example:
```yaml
splunk_otel_collector_command_line_args: "--discovery --set=processors.batch.timeout=10s"
```

- `splunk_memory_total_mib`: Amount of memory in MiB allocated to the Splunk OTel
Collector. (**default:** `512`)

Expand Down
3 changes: 3 additions & 0 deletions deployments/ansible/roles/collector/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ splunk_realm: us0

splunk_otel_collector_version: latest

# Command-line arguments to pass to the collector service.
splunk_otel_collector_command_line_args: ""

# Set this variable to /etc/otel/collector/gateway_config.yaml on linux,
# "Program Files\Splunk\OpenTelemetry Collector\gateway_config.yaml" on Windows
# in order to deploy splunk-otel-collector in gateway mode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
OTELCOL_CONFIG={{ splunk_otel_collector_command_line_args }}
SPLUNK_CONFIG={{ splunk_otel_collector_config }}
SPLUNK_ACCESS_TOKEN={{ splunk_access_token }}
SPLUNK_REALM={{ splunk_realm }}
Expand Down
Loading