Official Ansible role fails to start OpenSearch

Replying to myself once again :slight_smile:

I solved the issue by:
a) using CentOS 7.9 as the operating system in the VMs
b) replacing the original installation method from tarball and using the RPM instead.

Original code snippet from tasks/opensearch.yml:

- name: OpenSearch Install | Download opensearch {{ os_version }}
  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
  user:
    name: "{{ os_user }}"
    state: present
    shell: /bin/bash
  when: download.changed

- name: OpenSearch Install | Create home directory
  file:
    path: "{{ os_home }}"
    state: directory
    owner: "{{ os_user }}"
    group: "{{ os_user }}"
  when: download.changed

- name: OpenSearch Install | Extract the tar file
  command: chdir=/tmp/ tar -xvzf opensearch.tar.gz -C "{{ os_home }}" --strip-components=1
  when: download.changed

Replaced with:

- name: OpenSearch Install | Import PGP key
  rpm_key:
    state: present
    key: https://artifacts.opensearch.org/publickeys/opensearch.pgp

- name: OpenSearch Install | Add OpenSearch 2.x repository
  get_url:
    url: https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/opensearch-2.x.repo
    dest: /etc/yum.repos.d/opensearch-2.x.repo
    owner: root
    group: root
    mode: 0644

- name: OpenSearch Install | Add OpenSearch Dashboards 2.x repository
  get_url:
    url: https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.x/opensearch-dashboards-2.x.repo
    dest: /etc/yum.repos.d/opensearch-dashboards-2.x.repo
    owner: root
    group: root
    mode: 0644

- name: OpenSearch Install | Install packages
  package:
    name:
      - opensearch
      - opensearch-dashboards
      - firewalld
    state: latest

- name: OpenSearch Install | Start firewalld
  systemd:
    name: firewalld
    daemon_reload: yes
    state: started

OpenSearch starts as expected.

1 Like