Skip to content
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

configure_shc_captain fails with no attribute #221

Open
zyphermonkey opened this issue Feb 15, 2024 · 0 comments
Open

configure_shc_captain fails with no attribute #221

zyphermonkey opened this issue Feb 15, 2024 · 0 comments

Comments

@zyphermonkey
Copy link
Contributor

command: "{{ splunk_home }}/bin/splunk bootstrap shcluster-captain -servers_list {{ splunk_shc_uri_list }} -auth {{ splunk_auth }}"

I know I used this in the past on our last SHC, but this time it failed with the following error (after taking off no_log). This is possibly an ansible bug because I know we've upgraded the version of ansible on our control node since the last time we built a SHC.

fatal: [splunk-sh-p01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'splunk_mgmt_uri'. 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'splunk_mgmt_uri'\n\nThe error appears to be in '/home/vagrant/.ansible/roles/ansible-role-for-splunk/tasks/configure_shc_captain.yml': line 23, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- set_fact:\n ^ here\n"}

I solved it by preceding the bootstrap task with the following.

- set_fact:
    splunk_mgmt_uri: "{{ ansible_fqdn }}"

- set_fact:
    splunk_shc_uri_list: "{% for h in groups[splunk_shc_target_group] %}https://{{ hostvars[h].splunk_mgmt_uri }}:{{ splunkd_port }}{% if not loop.last %},{% endif %}{% endfor %}" # If you manage multiple SHCs, configure the var value in group_vars

Looking to start the conversation to see if anyone else can replicate the issue and/or if I should just move forward with a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant