sap-linuxlab / community.sap_libs

Automation for SAP - Collection of Ansible Modules for SAP for low-level activities which are highly reusable
Apache License 2.0
16 stars 7 forks source link

sap_system_facts must be run on SAP machine: undocumented, doesn't fail if not #34

Closed azrdev closed 4 months ago

azrdev commented 8 months ago

Summary

Apparently the modules can be run on any machine (e.g. delegate_to: localhost) except for sap_system_facts, which (according to the source) looks on the managed node it is executed on.

Furthermore, in such a case it just returns successfully without producing facts, I'd expect a task failure if there's no SAP on that host

Issue Type

Bug Report

Component Name

community.sap_libs.sap_system_facts

Ansible Version

$ ansible --version
ansible [core 2.15.0]

community.sap_libs Version

$ ansible-galaxy collection list community.sap_libs
1.4.1

Configuration

No response

OS / Environment

AAP 2.4 / AAC 4.4.7

Steps to Reproduce

- hosts: localhost
  gather_facts: false
  tasks:
  - community.sap_libs.sap_system_facts:
    ignore_errors: true

  - community.sap_libs.sap_system_facts:
      conn_host: sap.example.com
      conn_username: admin
      conn_password: password

Expected Results

  1. a task failure
  2. a task success

Actual Results

No response

Code of Conduct

kksat commented 8 months ago

I see that you are using AAP. You might be interested in supported version of this module

https://console.redhat.com/ansible/automation-hub/repo/published/sap/sap_operations/content/module/host_info/#examples

Personally I think this is a bad idea to fail if not SAP instances found and it can be covered with ansible functionality like so


    - name: Test host_info module
      sap.sap_operations.host_info:
      register: _
      failed_when:  _.instances | length == 0  and  _.databases | length == 0
rainerleber commented 4 months ago

this "feature" is against the behaviour of facts you could implement as @kksat suggested this with a failed_when