diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f5fae3a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# Core dependency for Paramiko connection type in Ansible +# Install using: pip install -r requirements.txt +paramiko>=2.11.0 diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..eaa4652 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,12 @@ +--- +# Install using: ansible-galaxy collection install -r requirements.yml +collections: + # For the sefcontext module (used for SELinux context management) + - name: ansible.posix + version: ">=2.0.0" + # For ini_file and slack modules + - name: community.general + version: ">=3.0.0" + # Most other modules (stat, command, include_tasks, debug, file, unarchive, template, git, etc.) + # are part of ansible-core and require no additional collection. + diff --git a/roles/splunk/tasks/download_and_unarchive.yml b/roles/splunk/tasks/download_and_unarchive.yml index 56fce9c..5ec76b7 100644 --- a/roles/splunk/tasks/download_and_unarchive.yml +++ b/roles/splunk/tasks/download_and_unarchive.yml @@ -31,6 +31,14 @@ notify: - start splunk +- name: "Restore SELinux contexts on Splunk directory" + become: true + command: "restorecon -Rv {{ splunk_home }}" + when: + - ansible_facts['os_family'] == "RedHat" + - ansible_facts['selinux']['status'] == "enabled" + - ansible_facts['selinux']['mode'] == "enforcing" + - name: "Remove {{ splunk_package_path }}/{{ splunk_file }} package" become: true ansible.builtin.file: diff --git a/roles/splunk/tasks/main.yml b/roles/splunk/tasks/main.yml index 213e1f3..fe7c099 100644 --- a/roles/splunk/tasks/main.yml +++ b/roles/splunk/tasks/main.yml @@ -3,8 +3,8 @@ ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ ansible_distribution }}{{ ansible_distribution_version }}.yml" - - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" - name: Include prerequisites diff --git a/roles/splunk/vars/RedHat10.yml b/roles/splunk/vars/RedHat10.yml new file mode 100644 index 0000000..9053435 --- /dev/null +++ b/roles/splunk/vars/RedHat10.yml @@ -0,0 +1,21 @@ +--- +global_bashrc: /etc/bashrc +chk_config_cmd: chkconfig --add disable-thp +linux_packages: + - nload + - iotop + - iftop + - sysstat + - telnet + - tcpdump + - htop + - atop + - lsof + - policycoreutils-python-utils + - policycoreutils + - setroubleshoot + - nethogs + - gdb + - bind-utils +firewall_service: firewalld +logrotate_file: /etc/logrotate.d/rsyslog