-
Notifications
You must be signed in to change notification settings - Fork 169
Set env vars for service instead of machine #3930
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
Changes from 75 commits
e6a4634
8dd68c7
810e4f0
e5858d6
d50a9c5
640e405
50a8cb5
aecc559
bf7f0a4
da12a5b
fe6a0ce
e091ad7
5282d07
43f49f1
224ab0b
51ed501
9a5310a
75638da
a82a0bf
bb0cce6
802a505
32e46d1
96b256a
35c6573
5b7ab83
3c5c1ab
831c6d0
d3435b8
1ca8eac
f51de23
21944bb
0d543e5
d51b65a
c399f39
c61b1a7
82b7846
44c04f0
ffcb73e
8c8e1bb
e34afce
9c77ee1
237bc45
94602d8
3658946
0719a1e
bf9d767
3c50447
d00b8e6
6388b90
4ff26c6
069ee45
cbaf5d4
1578caa
4f18580
50f9c0f
782aae0
4d8465e
6bbc178
b7dcb09
2c3af09
e87063b
e1cf478
2f6ecf4
d193f50
faca2ce
e1ca7c3
52a6ebf
1b1007f
5edf011
eb38784
b140644
34925c2
b8b7005
8287246
7b076c6
bc206a2
3ca07b7
33534ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
gather_facts: true | ||
become: no | ||
vars: | ||
reg_values: | ||
collector_reg_values: | ||
SPLUNK_CONFIG: '{{ ansible_env.ProgramData }}\Splunk\OpenTelemetry Collector\custom_config.yml' | ||
SPLUNK_INGEST_URL: https://fake-splunk-ingest.com | ||
SPLUNK_API_URL: https://fake-splunk-api.com | ||
|
@@ -15,11 +15,10 @@ | |
SPLUNK_BALLAST_SIZE_MIB: "100" | ||
MY_CUSTOM_VAR1: value1 | ||
MY_CUSTOM_VAR2: value2 | ||
SIGNALFX_DOTNET_TRACER_HOME: '{{ ansible_env.ProgramFiles }}\SignalFx\.NET Tracing\' | ||
dotnet_reg_values: | ||
COR_ENABLE_PROFILING: "true" | ||
iis_reg_values: | ||
COR_ENABLE_PROFILING: "1" | ||
COR_PROFILER: "{B4C89B0F-9908-4F73-9F59-0D77C5A06874}" | ||
CORECLR_ENABLE_PROFILING: "true" | ||
CORECLR_ENABLE_PROFILING: "1" | ||
CORECLR_PROFILER: "{B4C89B0F-9908-4F73-9F59-0D77C5A06874}" | ||
SIGNALFX_ENV: test-environment | ||
SIGNALFX_SERVICE_NAME: test-service-name | ||
|
@@ -28,6 +27,8 @@ | |
SIGNALFX_GLOBAL_TAGS: splunk.zc.method:signalfx-dotnet-tracing-1.0.0,dotnet-tag:dotnet-tag-value | ||
SIGNALFX_DOTNET_VAR1: dotnet-value1 | ||
SIGNALFX_DOTNET_VAR2: dotnet-value2 | ||
machine_reg_values: | ||
SIGNALFX_DOTNET_TRACER_HOME: '{{ ansible_env.ProgramFiles }}\SignalFx\.NET Tracing\' | ||
tasks: | ||
- name: Check splunk-otel-collector service | ||
ansible.windows.win_service: | ||
|
@@ -36,10 +37,6 @@ | |
check_mode: yes | ||
register: service_status | ||
|
||
- name: Assert splunk-otel-collector service status | ||
assert: | ||
that: not service_status.changed | ||
|
||
Comment on lines
-39
to
-42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this removal related to the env var changes? Wonder if there should be a new var to dictate if expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was failing consistently for me because the status had changed to "started" - I confess that I don't understand how it was working before. |
||
- name: Check fluentdwinsvc service | ||
ansible.windows.win_service: | ||
name: fluentdwinsvc | ||
|
@@ -124,12 +121,23 @@ | |
- name: Verify IIS env vars | ||
assert: | ||
that: (item.key + '=' + item.value) in iis_env.value | ||
loop: "{{ dotnet_reg_values | dict2items }}" | ||
loop: "{{ iis_reg_values | dict2items }}" | ||
|
||
- name: Get splunk-otel-collector service env vars | ||
ansible.windows.win_reg_stat: | ||
path: HKLM:\SYSTEM\CurrentControlSet\Services\splunk-otel-collector | ||
name: Environment | ||
register: collector_env | ||
|
||
- name: Verify splunk-otel-collector service env vars | ||
assert: | ||
that: (item.key + '=' + item.value) in collector_env.value | ||
loop: "{{ collector_reg_values | dict2items }}" | ||
|
||
- name: Verify env vars | ||
include_tasks: ../shared/verify_registry_key.yml | ||
vars: | ||
path: HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment | ||
name: "{{ item.key }}" | ||
value: "{{ item.value }}" | ||
loop: "{{ reg_values | combine(dotnet_reg_values) | dict2items }}" | ||
loop: "{{ machine_reg_values | dict2items }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ | |
ansible.windows.win_package: | ||
path: "{{otel_msi_package.dest}}" | ||
state: present | ||
notify: "restart windows splunk-otel-collector" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these removals related and necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the restart should only happen after the environment variables are set for the service. |
||
|
||
- name: Merge custom config into the default config | ||
ansible.builtin.import_tasks: config_override.yml | ||
|
@@ -48,11 +47,9 @@ | |
content: '{{ updated_config | to_nice_yaml (indent=2) }}' | ||
dest: "{{ splunk_otel_collector_config }}" | ||
when: splunk_config_override != '' | ||
notify: "restart windows splunk-otel-collector" | ||
|
||
- name: Push Custom Config file for splunk-otel-collector, If provided | ||
ansible.windows.win_template: | ||
src: "{{splunk_otel_collector_config_source}}" | ||
dest: "{{splunk_otel_collector_config}}" | ||
when: splunk_otel_collector_config_source != "" | ||
notify: "restart windows splunk-otel-collector" |
Uh oh!
There was an error while loading. Please reload this page.