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

How to use ansible-role-for-splunk in your playbooks? #165

Open
EsOsO opened this issue Jan 12, 2023 · 3 comments
Open

How to use ansible-role-for-splunk in your playbooks? #165

EsOsO opened this issue Jan 12, 2023 · 3 comments

Comments

@EsOsO
Copy link

EsOsO commented Jan 12, 2023

Hi, I'm using the provided playbooks to install some new indexers and it works well.
Now I'd like to execute some more steps before and after the "Splunk" part (eg. chowning the indexes directory to the splunk user) and here comes my question: how to reuse the role vars to avoid defining it in my own roles?

@nockstarr
Copy link

Like this

--

- hosts:
    - all
  roles:
    - ../roles/splunk
  serial: 50
  vars:
    - deployment_task: your_custom_task.yml
    ```

@EsOsO
Copy link
Author

EsOsO commented Jan 13, 2023

I know that. What I'm asking is how to use calculated vars like splunk_home in your plays.

I'm using like this:

---
- name: Install or upgrade Splunk
  hosts:
    - all
  roles:
    - ../roles/splunk
  vars:
    - deployment_task: check_splunk.yml

- name: Tune system for Splunk workload
  hosts:
    - all
  roles:
    - ../roles/splunk
  vars:
    - deployment_task: configure_os.yml

- name: Post installation steps
  hosts: all
  roles:
    - ../roles/common

I'd like to use the splunk role vars in my own role without the need to duplicate the logic or the definition.

@Ces-Ces
Copy link

Ces-Ces commented Jan 13, 2023

@EsOsO you can call the splunk role or specific task from the splunk role in your common role.

- name: do something
  include_role:
    name: splunk
    tasks_from: task.yml

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

3 participants