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

Enhancement: Support multiple apps within a single git repo in configure_apps.yml #49

Closed
lmnogues opened this issue Mar 11, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@lmnogues
Copy link
Contributor

On my gitlab, i've a repo name splunk_apps it contains all the apps for the same "project"!

- app_1
- app_2
- ...

May be i've missed something in my configuration but it does not seems possible to install only app_1 on a server and app_2 on a second

For me the issue lies in the task Download defined Git repos to local Ansible host

    - name: Download defined Git repos to local Ansible host
      git:
        accept_hostkey: true
        repo: "{{ item.git_server | default(git_server) }}/{{ item.git_project | default(git_project) }}/{{ item.name }}"
        version: "{{ item.git_version | default(git_version) }}"
        dest: "{{ git_local_clone_path }}{{ ansible_nodename }}/{{ item.name }}"
        key_file: "{{ git_key }}"
        force: true
      loop: "{{ git_apps }}"
      delegate_to: localhost
      changed_when: false
      check_mode: false

it's looping on the param git_apps and is expecting each of them to be a standalone git repo. For me each standalone repo should be configured by the param git_project only

Did I miss something ? May be we can add the 2 possilities with a new parameter git_multiple_app_per_repo

@mason-splunk mason-splunk self-assigned this Mar 11, 2021
@mason-splunk mason-splunk added the enhancement New feature or request label Mar 12, 2021
@mason-splunk
Copy link
Contributor

mason-splunk commented Mar 12, 2021

You did not miss anything. You are correct in that the current implementation expects 1 app:1 repo. Therefore, the functionality that you're describing would be an enhancement request.

If you can tell me a little more about your configuration management strategy, that would be helpful in understanding your use case and what's required for this. i.e. Do you use one repository for all Splunk roles? (e.g. DS, SH, CM, etc.) Or, one repository per Splunk role? Or, per host? Or, something else? Also, what subfolders are in your repository? (e.g. deployment-apps, apps, shcluster/apps) vs. (TA-NIX, outputs_ta, etc.)

--
One possible implementation: Within git_apps vars, have an optional variable where the user can list out the specific folders within the repository that they would like deployed (default to all).

Notes:

@lmnogues
Copy link
Contributor Author

We tend to use 1 git repo for all roles. This is to simplified the dev process & avoid duplicates or confusion (i can see you props.conf)

On example is :

  • an app with sourcetype info
  • an app with inputs script
  • an app with dashboards

Some of them will need to be deployed to a HF and the other to a single instance.

we tend to have all the app on the same level (some times in a subfolder splunk_apps or directly on the root dir of the git repo

@mason-splunk mason-splunk changed the title configure_apps.yml does not support a git repo where there is multiple apps Support multiple apps within a single git repo in configure_apps.yml Mar 16, 2021
@ForsetiJan
Copy link
Contributor

ForsetiJan commented Mar 17, 2021

I resolved this challenge by creating a new task called install_multi_app.yml.
It will still take the git_apps variable to run call configure_apps.yml

The determine_handler.yml task is the following:

- name: sync the apps repo
  include_tasks: configure_apps.yml

- name: "Synchronize  {{ splunk_home }}/{{  app_dest}}/{{ item.app_name }} to {{ splunk_home }}/{{  app_dest  }}/"
  shell:
    cmd: "rsync --delete --checksum --recursive --prune-empty-dirs --itemize-changes --no-owner --no-group --no-times {{ splunk_home }}/{{ {{ app_dest }}/{{ item.app_name }}/* {{ splunk_home }}/{{ app_dest }}/"
  become: true
  become_user: "{{ splunk_nix_user }}"
  loop: "{{ git_apps }}"
  notify: "{{ handler }}"

- name: Ensure correct permissions are set
  file:
    path: "{{ splunk_home }}/{{ app_dest }}/"
    owner: "{{ splunk_nix_user }}"
    group: "{{ splunk_nix_group }}"
    recurse: true
  become: true

- name: remove the temporary app folders
  file:
    state: absent
    path: "{{ splunk_home }}/{{ app_dest }}/{{ item.app_name }}"
  become: true
  become_user: "{{ splunk_nix_user }}"
  loop: "{{ git_apps }}"

@mason-splunk mason-splunk changed the title Support multiple apps within a single git repo in configure_apps.yml Enhancement: Support multiple apps within a single git repo in configure_apps.yml Mar 22, 2021
jewnix added a commit to jewnix/ansible-role-for-splunk that referenced this issue Aug 23, 2022
jewnix added a commit to jewnix/ansible-role-for-splunk that referenced this issue Aug 23, 2022
zyphermonkey pushed a commit to zyphermonkey/ansible-role-for-splunk that referenced this issue Sep 30, 2022
commit 852d71f
Author: Jewnix <[email protected]>
Date:   Wed Aug 24 12:46:39 2022 -0400

    fixes splunk#49 (splunk#130)

    * fixes splunk#49

commit c3c66a5
Author: Jewnix <[email protected]>
Date:   Tue Aug 23 14:26:44 2022 -0400

    configure restartSplunkd on serverclass level (splunk#129)

commit 7da7c25
Author: Jewnix <[email protected]>
Date:   Mon Aug 22 13:24:34 2022 -0400

    fixewd missing quotes (splunk#128)

commit e4c120b
Author: Jewnix <[email protected]>
Date:   Fri Aug 19 10:23:10 2022 -0400

    fixes splunk#75 (splunk#127)

commit 41b2a8e
Author: zyphermonkey <[email protected]>
Date:   Tue Aug 16 21:05:19 2022 -0400

    feat: add option to create polkit rules file for splunk (splunk#115)

    Co-authored-by: Merrel Raney III <[email protected]>
    Co-authored-by: dtwersky <[email protected]>

commit 9276f51
Author: arcsector <[email protected]>
Date:   Tue Aug 16 17:54:09 2022 -0700

    Additional OOTB Cluster components (splunk#125)

    * Fixing splunk#123

    * Adding DMC Playbook and Task

    * DMC playbook merge with task - update README

    Co-authored-by: haraksin <[email protected]>

commit 5e9c8db
Author: Jewnix <[email protected]>
Date:   Tue Aug 16 20:49:41 2022 -0400

    Multiple updates (splunk#122)

    * added license files and test environments to .gitignore

    * Added more license configuration options

    * Disable THP using tuned

    * new variables for version and build. updated to 9.0.0.1

    * check if splunk_package_version is newer. regex gets full version

    * Fixed many boot-start issues

commit a8d2df5
Author: arcsector <[email protected]>
Date:   Wed Aug 3 13:02:23 2022 -0700

    Fixing splunk#123 (splunk#124)

    Co-authored-by: haraksin <[email protected]>

commit 13b7ca9
Author: Jewnix <[email protected]>
Date:   Wed Jun 1 22:43:10 2022 -0400

    Added sysctl to allow read of dmesg (splunk#119)

    * Added sysctl to allow read of dmesg

commit 2a962d1
Merge: 11f3922 e6a32d5
Author: dtwersky <[email protected]>
Date:   Mon Mar 28 11:10:44 2022 -0400

    Merge pull request splunk#117 from jewnix/splunk_version

    updated splunk package to 8.2.5

commit e6a32d5
Author: jewnix <[email protected]>
Date:   Mon Mar 28 10:30:55 2022 -0400

    updated splunk package to 8.2.5

commit 11f3922
Merge: 9ff2b92 62972ef
Author: dtwersky <[email protected]>
Date:   Thu Mar 24 16:59:14 2022 -0400

    Merge pull request splunk#116 from jewnix/fix_thp_disable

    disable-thp.service should be enabled and started

commit 62972ef
Author: jewnix <[email protected]>
Date:   Thu Mar 24 16:18:02 2022 -0400

    disable-thp.service should be enabled and started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants