You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Splunk_Int/common/tasks/create_app_via_template.yml

47 lines
1.5 KiB

---
- name: Default files added to the list
set_fact:
app_configs:
- template_path: "{{ playbook_dir }}/common/templates/app.j2"
template_output_path: "app.conf"
- name: Ensure that all local paths exists
file:
path: "{{ playbook_dir }}/splunk_apps/base_apps/{{ app_name }}/local"
state: directory
recurse: yes
force: true
ignore_errors: true
loop: "{{ configs|flatten + app_configs | flatten }}"
- name: Apply provided template.j2 on the provided target file
template:
src: "{{ item.template_path }}"
dest: "{{ playbook_dir }}/splunk_apps/base_apps/{{ app_name }}/local/{{ item.template_output_path }}"
force: true
loop: "{{ configs|flatten + app_configs | flatten }}"
- name: Ensure that all custom paths exists
file:
path: "{{ playbook_dir }}/splunk_apps/base_apps/{{ app_name }}/{{ item.dest_dir }}"
state: directory
recurse: yes
force: true
ignore_errors: true
loop: "{{ files |flatten }}"
when: files is defined
- name: Copy specific files to their local dir
copy:
src: "{{ item.src }}"
dest: "{{ playbook_dir }}/splunk_apps/base_apps/{{ app_name }}/{{ item.dest_dir }}"
force: true
loop: "{{ files |flatten }}"
when: files is defined
- name: Copy app to the different Splunk Topology
copy:
src: "{{ playbook_dir }}/splunk_apps/base_apps/{{ app_name }}"
dest: "{{ playbook_dir }}/splunk_apps/{{ item }}/"
force: yes
loop: "{{ splunk_target_topology }}"