splunk / splunk-platform-automator

Ansible framework providing a fast and simple way to spin up complex Splunk environments.
Apache License 2.0
117 stars 45 forks source link

Single node example config fails to bootstrap if no UF in the splunk_config.yml #16

Closed guilhemmarchand closed 3 years ago

guilhemmarchand commented 3 years ago

Describe the bug The sample standalone config in:

example/single_node.yml

Fails to proceed unless at least one uf is part of the configuration.

To Reproduce

cp examples/single_node.yml config/
cd config
vagrant up; ansible-playbook ansible/deploy-site.yml

Screenshots

Ansible fails at:

TASK [common : Check SELinux state] **************************************************************************************************************************************************************************************************************************
fatal: [shidx]: FAILED! => {"msg": "The conditional check 'inventory_hostname not in groups.role_universal_forwarder' failed. The error was: error while evaluating conditional (inventory_hostname not in groups.role_universal_forwarder): 'dict object' has no attribute 'role_universal_forwarder'\n\nThe error appears to be in '/Users/guilhem/Vagrant/Splunkenizer-preprod/ansible/roles/common/tasks/disable_selinux.yml': line 4, 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- name: Check SELinux state\n  ^ here\n"}

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************
shidx                      : ok=4    changed=3    unreachable=0    failed=1    skipped=2    rescued=0    ignored=0

If a UF is enabled, in splunk_config.yml:

---
# splunk_config.yml

# General settings
general:
  start_ip: 172.16.2.100

os:
  time_zone: "Europe/London"

virtualbox:
#  box: "centos/7" # Default
#  box: "ubuntu/xenial64"

# Splunk default settings
splunk_defaults:
  splunk_env_name: geodis
#  splunk_version: '6.5.7'
#  splunk_admin_password: 'splunklab'
  splunk_license_file: Splunk_Enterprise.lic
#  splunk_indexes:
#    - test1
#    - test2

# Splunk hosts with its settings
splunk_hosts:
  # Indexer and Search Head on single node
  - name: shidx
    roles:
      - indexer
      - search_head

   # Universal Forwarder
  - name: ufpre
    roles:
      - universal_forwarder

The deployment proceeds successfully as expected, otherwise fails with just the single node.

Desktop (please complete the following information):

splunkenizer commented 3 years ago

This is fixed now. Thanks for reporting.