Unverified Commit 9b7e1716 by Simon Chen Committed by GitHub

Merge pull request #4407 from edx/schen/integrate_amazon_linux

Update splunk forwarder role so it can be installed on Amazon Linux OS
parents 5ad8138a 904286db
- Role: splunkforwarder
- Updated the role so the splunkforwarder can be installed on Amazon Linux OS environment, which is a RHEL variant
- Role: server_utils
- Update to only do things for debian varient environment
- Role: xqueue - Role: xqueue
- Added `XQUEUE_SESSION_ENGINE` to allow a configurable xqueue session engine. - Added `XQUEUE_SESSION_ENGINE` to allow a configurable xqueue session engine.
- Added `XQUEUE_CACHES` to allow a configurable xqueue cache. - Added `XQUEUE_CACHES` to allow a configurable xqueue cache.
......
...@@ -24,10 +24,11 @@ ...@@ -24,10 +24,11 @@
- name: Check for expired edx key - name: Check for expired edx key
command: "apt-key list | grep {{ SERVER_UTILS_EDX_PPA_KEY_ID }}" command: "apt-key list | grep {{ SERVER_UTILS_EDX_PPA_KEY_ID }}"
register: ppa_key_status register: ppa_key_status
when: ansible_distribution in common_debian_variants
- name: remove expired edx key - name: remove expired edx key
command: "sudo apt-key adv --keyserver {{ SERVER_UTILS_EDX_PPA_KEY_SERVER }} --recv-keys {{ SERVER_UTILS_EDX_PPA_KEY_ID }}" command: "sudo apt-key adv --keyserver {{ SERVER_UTILS_EDX_PPA_KEY_SERVER }} --recv-keys {{ SERVER_UTILS_EDX_PPA_KEY_ID }}"
when: "'expired' in ppa_key_status.stdout" when: ansible_distribution in common_debian_variants and "'expired' in ppa_key_status.stdout"
- name: Install ubuntu system packages - name: Install ubuntu system packages
apt: apt:
...@@ -36,4 +37,4 @@ ...@@ -36,4 +37,4 @@
state: present state: present
update_cache: yes update_cache: yes
with_items: "{{ server_utils_debian_pkgs }}" with_items: "{{ server_utils_debian_pkgs }}"
when: ansible_distribution == 'Ubuntu' when: ansible_distribution in common_debian_variants
...@@ -18,6 +18,7 @@ splunk_role_name: 'splunk' ...@@ -18,6 +18,7 @@ splunk_role_name: 'splunk'
SPLUNKFORWARDER_PACKAGE_URL: !!null SPLUNKFORWARDER_PACKAGE_URL: !!null
SPLUNKFORWARDER_DEB: !!null SPLUNKFORWARDER_DEB: !!null
SPLUNKFORWARDER_RPM: !!null
SPLUNKFORWARDER_PASSWORD: !!null SPLUNKFORWARDER_PASSWORD: !!null
# A list of dicts with the following keys: # A list of dicts with the following keys:
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# #
# #
# Install Splunk Forwarder # Install Splunk Forwarder for common_debian_variants
- name: Install splunkforwarder specific system packages - name: Install splunkforwarder specific system packages
apt: apt:
name: "{{ item }}" name: "{{ item }}"
...@@ -31,18 +31,34 @@ ...@@ -31,18 +31,34 @@
- splunk - splunk
- install - install
- update - update
when: ansible_distribution in common_debian_variants
- name: Download the splunk deb - name: Download the splunk deb
get_url: get_url:
dest: "/tmp/{{ SPLUNKFORWARDER_DEB }}" dest: "/tmp/{{ SPLUNKFORWARDER_DEB }}"
url: "{{ SPLUNKFORWARDER_PACKAGE_URL }}" url: "{{ SPLUNKFORWARDER_PACKAGE_URL }}"
register: download_deb register: download_package
until: download_deb|succeeded until: download_package|succeeded
retries: 5 retries: 5
when: ansible_distribution in common_debian_variants
- name: Install splunk forwarder - name: Install splunk forwarder
shell: "gdebi -nq /tmp/{{ SPLUNKFORWARDER_DEB }}" shell: "gdebi -nq /tmp/{{ SPLUNKFORWARDER_DEB }}"
when: download_deb.changed when: ansible_distribution in common_debian_variants and download_package.changed
# Install Splunk Forwarder for common_redhat_variants
- name: Download the splunk rpm
get_url:
dest: "/tmp/{{ SPLUNKFORWARDER_RPM }}"
url: "{{ SPLUNKFORWARDER_PACKAGE_URL }}"
register: download_package
until: download_package|succeeded
retries: 5
when: ansible_distribution in common_redhat_variants
- name: Install splunk forwarder
shell: "rpm -i /tmp/{{ SPLUNKFORWARDER_RPM }}"
when: ansible_distribution in common_redhat_variants and download_package.changed
- name: Create splunk user - name: Create splunk user
user: user:
...@@ -51,7 +67,7 @@ ...@@ -51,7 +67,7 @@
state: present state: present
append: yes append: yes
groups: syslog,adm groups: syslog,adm
when: download_deb.changed when: download_package.changed
# Need to start splunk manually so that it can create various files # Need to start splunk manually so that it can create various files
# and directories that aren't created till the first run and are needed # and directories that aren't created till the first run and are needed
...@@ -60,19 +76,19 @@ ...@@ -60,19 +76,19 @@
shell: "{{ splunkforwarder_output_dir }}/bin/splunk start --accept-license --answer-yes --no-prompt" shell: "{{ splunkforwarder_output_dir }}/bin/splunk start --accept-license --answer-yes --no-prompt"
args: args:
creates: "{{ splunkforwarder_output_dir }}/var/lib/splunk" creates: "{{ splunkforwarder_output_dir }}/var/lib/splunk"
when: download_deb.changed when: download_package.changed
register: started_manually register: started_manually
- name: Stop splunk manually - name: Stop splunk manually
shell: "{{ splunkforwarder_output_dir }}/bin/splunk stop --accept-license --answer-yes --no-prompt" shell: "{{ splunkforwarder_output_dir }}/bin/splunk stop --accept-license --answer-yes --no-prompt"
when: download_deb.changed and started_manually.changed when: download_package.changed and started_manually.changed
- name: Create boot script - name: Create boot script
shell: "{{ splunkforwarder_output_dir }}/bin/splunk enable boot-start -user splunk --accept-license --answer-yes --no-prompt" shell: "{{ splunkforwarder_output_dir }}/bin/splunk enable boot-start -user splunk --accept-license --answer-yes --no-prompt"
args: args:
creates: /etc/init.d/splunk creates: /etc/init.d/splunk
register: create_boot_script register: create_boot_script
when: download_deb.changed when: download_package.changed
notify: restart splunkforwarder notify: restart splunkforwarder
- name: Ensure splunk forder permissions - name: Ensure splunk forder permissions
...@@ -82,12 +98,12 @@ ...@@ -82,12 +98,12 @@
recurse: yes recurse: yes
owner: splunk owner: splunk
group: splunk group: splunk
when: download_deb.changed when: download_package.changed
notify: restart splunkforwarder notify: restart splunkforwarder
- name: Update admin pasword - name: Update admin pasword
shell: "{{ splunkforwarder_output_dir }}/bin/splunk edit user admin -password '{{ SPLUNKFORWARDER_PASSWORD }}' -auth admin:changeme --accept-license --answer-yes --no-prompt" shell: "{{ splunkforwarder_output_dir }}/bin/splunk edit user admin -password '{{ SPLUNKFORWARDER_PASSWORD }}' -auth admin:changeme --accept-license --answer-yes --no-prompt"
when: download_deb.changed when: download_package.changed
notify: restart splunkforwarder notify: restart splunkforwarder
- name: Add chkconfig to init script - name: Add chkconfig to init script
...@@ -97,7 +113,7 @@ ...@@ -97,7 +113,7 @@
line: "# chkconfig: 235 98 55" line: "# chkconfig: 235 98 55"
insertafter: "#!/bin/sh" insertafter: "#!/bin/sh"
state: present state: present
when: download_deb.changed and create_boot_script.changed when: download_package.changed and create_boot_script.changed
notify: restart splunkforwarder notify: restart splunkforwarder
- name: Make sure necessary dirs exist - name: Make sure necessary dirs exist
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment