-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .deb and .rpm Installation and make .tar Installation the Fallback
Split Configuration and Installation into own .yml files Add variables file for OS Specific Values Signed-off-by: Johannes Wagner <[email protected]>
- Loading branch information
Showing
9 changed files
with
145 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- name: OpenSearch Configuration | Copy Configuration File | ||
ansible.builtin.blockinfile: | ||
block: "{{ lookup('template', 'templates/opensearch-{{ cluster_type }}.yml') }}" | ||
dest: "{{ os_conf_dir }}/opensearch.yml" | ||
backup: true | ||
state: present | ||
create: true | ||
marker: "## {mark} opensearch main configuration ##" | ||
owner: "{{ os_user }}" | ||
group: "{{ os_user }}" | ||
mode: 0600 | ||
|
||
- name: OpenSearch Configuration | Copy jvm.options File for Instance | ||
ansible.builtin.template: | ||
src: jvm.options | ||
dest: "{{ os_conf_dir }}/jvm.options" | ||
owner: "{{ os_user }}" | ||
group: "{{ os_user }}" | ||
mode: 0600 | ||
force: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
- name: OpenSearch Install | Install from .deb | ||
when: ansible_os_family == 'Debian' | ||
block: | ||
- name: OpenSearch Install | Download GPG Key | ||
ansible.builtin.get_url: | ||
url: https://artifacts.opensearch.org/publickeys/opensearch.pgp | ||
dest: /tmp/opensearch.pgp | ||
|
||
- name: OpenSearch Install | Install GPG Key | ||
ansible.builtin.command: gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring /tmp/opensearch.pgp | ||
|
||
- name: OpenSearch Install | Deploy deb repository file | ||
ansible.builtin.apt_repository: | ||
repo: deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main | ||
state: present | ||
filename: opensearch-core.list | ||
notify: update repository cache | ||
|
||
- name: OpenSearch Install | Flush handlers | ||
meta: flush_handlers | ||
|
||
- name: OpenSearch Install | Get installed Packages | ||
package_facts: | ||
manager: "auto" | ||
|
||
- name: OpenSearch Install | Unhold opensearch | ||
ansible.builtin.dpkg_selections: | ||
name: opensearch | ||
selection: install | ||
when: "'opensearch' in ansible_facts.packages" | ||
|
||
- name: OpenSearch Install | Install OpenSearch | ||
ansible.builtin.apt: | ||
name: opensearch={{ os_version }} | ||
state: present | ||
environment: | ||
OPENSEARCH_INITIAL_ADMIN_PASSWORD: "{{ admin_password }}" | ||
|
||
- name: OpenSearch Install | Hold opensearch | ||
ansible.builtin.dpkg_selections: | ||
name: opensearch | ||
selection: hold | ||
|
||
- name: OpenSearch Install | Install from .rpm | ||
when: ansible_os_family == 'RedHat' | ||
block: | ||
- name: OpenSearch Install | Install OpenSearch | ||
ansible.builtin.yum: | ||
name: https://artifacts.opensearch.org/releases/bundle/opensearch/{{ os_version }}/opensearch-{{ os_version }}-linux-x64.rpm | ||
state: present | ||
disable_gpg_check: true | ||
|
||
|
||
- name: OpenSearch Install | Install from tar | ||
when: ansible_os_family != 'Debian' and ansible_os_family != 'RedHat' | ||
block: | ||
- name: OpenSearch Install | Download opensearch {{ os_version }} | ||
ansible.builtin.get_url: | ||
url: "{{ os_download_url }}/{{ os_version }}/opensearch-{{ os_version }}-linux-x64.tar.gz" | ||
dest: "/tmp/opensearch.tar.gz" | ||
register: download | ||
|
||
- name: OpenSearch Install | Create opensearch user | ||
ansible.builtin.user: | ||
name: "{{ os_user }}" | ||
state: present | ||
shell: /bin/false | ||
create_home: true | ||
home: "{{ os_home }}" | ||
when: download.changed or iac_enable | ||
|
||
- name: OpenSearch Install | Create home directory | ||
ansible.builtin.file: | ||
path: "{{ os_home }}" | ||
state: directory | ||
owner: "{{ os_user }}" | ||
group: "{{ os_user }}" | ||
when: download.changed or iac_enable | ||
|
||
- name: OpenSearch Install | Extract the tar file | ||
ansible.builtin.command: chdir=/tmp/ tar -xvzf opensearch.tar.gz -C "{{ os_home }}" --strip-components=1 | ||
when: download.changed or iac_enable | ||
|
||
- name: OpenSearch Install | create systemd service | ||
ansible.builtin.template: | ||
src: opensearch.service | ||
dest: "{{ systemctl_path }}/opensearch.service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Include Debian-specific variables | ||
include_vars: "{{ ansible_distribution }}.yml" | ||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Include RedHat-specific variables | ||
include_vars: "{{ ansible_os_family }}.yml" | ||
when: ansible_os_family == 'RedHat' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
os_home: /usr/share/opensearch | ||
os_conf_dir: /etc/opensearch | ||
os_plugin_bin_path: /usr/share/opensearch/bin/opensearch-plugin | ||
os_sec_plugin_conf_path: /etc/opensearch | ||
os_sec_plugin_tools_path: /usr/share/opensearch/plugins/opensearch-security/tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
os_home: /usr/share/opensearch | ||
os_conf_dir: /etc/opensearch | ||
os_plugin_bin_path: /usr/share/opensearch/bin/opensearch-plugin | ||
os_sec_plugin_conf_path: /etc/opensearch | ||
os_sec_plugin_tools_path: /usr/share/opensearch/plugins/opensearch-security/tools |