Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Cannot get this to run on suse tumbleweed and leap #53

Closed
MrFastDie opened this issue Nov 21, 2024 · 7 comments
Closed

🐛 Bug: Cannot get this to run on suse tumbleweed and leap #53

MrFastDie opened this issue Nov 21, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@MrFastDie
Copy link

Installed suse tumbleweed or leap (current version), tried to install this package but it fails on "Fail when OS is unknown"

SUMMARY

After installing fresh suse and installing python3-distro the install step fails at sva.sentinelone.install_agent : Preflight check: Fail when OS is unknown

ISSUE TYPE
  • Bug Report
COMPONENT NAME

sva.sentinelone.install_agent

ANSIBLE VERSION
ansible [core 2.18.0]
  config file = /home/daniel/truffle/zzz_systemhaus/ansible/ansible.cfg
  configured module search path = ['/home/daniel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/daniel/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
~/t/z/ansible   *…  ansible-galaxy collection list                                                          228ms  Thu 21 Nov 2024 09:38:42 AM CET

# /home/daniel/.ansible/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
ansible.posix                            1.6.2  
sva.sentinelone                          2.0.2  

# /usr/lib/python3.12/site-packages/ansible_collections
Collection                               Version
---------------------------------------- -------
amazon.aws                               8.2.1  
ansible.netcommon                        6.1.3  
ansible.posix                            1.6.2  
ansible.utils                            4.1.0  
ansible.windows                          2.5.0  
arista.eos                               9.0.0  
awx.awx                                  24.6.1 
azure.azcollection                       2.7.0  
check_point.mgmt                         5.2.3  
chocolatey.chocolatey                    1.5.3  
cisco.aci                                2.10.1 
cisco.asa                                5.0.1  
cisco.dnac                               6.22.0 
cisco.intersight                         2.0.20 
cisco.ios                                8.0.0  
cisco.iosxr                              9.0.0  
cisco.ise                                2.9.5  
cisco.meraki                             2.18.3 
cisco.mso                                2.9.0  
cisco.nxos                               8.1.0  
cisco.ucs                                1.14.0 
cloud.common                             3.0.0  
cloudscale_ch.cloud                      2.4.0  
community.aws                            8.0.0  
community.ciscosmb                       1.0.9  
community.crypto                         2.22.3 
community.digitalocean                   1.27.0 
community.dns                            3.0.6  
community.docker                         3.13.1 
community.general                        9.5.1  
community.grafana                        1.9.1  
community.hashi_vault                    6.2.0  
community.hrobot                         2.0.2  
community.library_inventory_filtering_v1 1.0.2  
community.libvirt                        1.3.0  
community.mongodb                        1.7.8  
community.mysql                          3.10.3 
community.network                        5.1.0  
community.okd                            3.0.1  
community.postgresql                     3.7.0  
community.proxysql                       1.6.0  
community.rabbitmq                       1.3.0  
community.routeros                       2.20.0 
community.sap_libs                       1.4.2  
community.sops                           1.9.1  
community.vmware                         4.8.0  
community.windows                        2.3.0  
community.zabbix                         2.5.1  
containers.podman                        1.16.2 
cyberark.conjur                          1.3.1  
cyberark.pas                             1.0.27 
dellemc.enterprise_sonic                 2.5.1  
dellemc.openmanage                       9.8.0  
dellemc.powerflex                        2.5.0  
dellemc.unity                            2.0.0  
f5networks.f5_modules                    1.32.1 
fortinet.fortimanager                    2.7.0  
fortinet.fortios                         2.3.8  
frr.frr                                  2.0.2  
google.cloud                             1.4.1  
grafana.grafana                          5.6.0  
hetzner.hcloud                           3.1.1  
ibm.qradar                               3.0.0  
ibm.spectrum_virtualize                  2.0.0  
ibm.storage_virtualize                   2.5.0  
ieisystem.inmanage                       2.0.0  
infinidat.infinibox                      1.4.5  
infoblox.nios_modules                    1.7.0  
inspur.ispim                             2.2.3  
inspur.sm                                2.3.0  
junipernetworks.junos                    8.0.0  
kaytus.ksmanage                          1.2.2  
kubernetes.core                          3.2.0  
kubevirt.core                            1.5.0  
lowlydba.sqlserver                       2.3.4  
microsoft.ad                             1.7.1  
netapp.cloudmanager                      21.24.0
netapp.ontap                             22.12.0
netapp.storagegrid                       21.13.0
netapp_eseries.santricity                1.4.1  
netbox.netbox                            3.20.0 
ngine_io.cloudstack                      2.5.0  
ngine_io.exoscale                        1.1.0  
openstack.cloud                          2.2.0  
openvswitch.openvswitch                  2.1.1  
ovirt.ovirt                              3.2.0  
purestorage.flasharray                   1.31.1 
purestorage.flashblade                   1.19.1 
sensu.sensu_go                           1.14.0 
splunk.es                                3.0.0  
t_systems_mms.icinga_director            2.0.1  
telekom_mms.icinga_director              2.2.0  
theforeman.foreman                       4.2.0  
vmware.vmware                            1.6.0  
vmware.vmware_rest                       3.2.0  
vultr.cloud                              1.13.0 
vyos.vyos                                4.1.0  
wti.remote                               1.0.10 
DEPENDENCY VERSIONS
 ~/t/z/ansible   *…  pip freeze                                                                              335ms  Thu 21 Nov 2024 09:39:22 AM CET
annotated-types==0.7.0
ansible==10.6.0
ansible-core==2.18.0
arandr==0.1.11
argcomplete==3.4.0
asgiref==3.8.1
attrs==23.2.1.dev0
autocommand==2.2.2
bcrypt==4.1.3
blinker==1.8.2
Brlapi==0.8.6
btrfsutil==6.10
build==1.2.2
cairocffi==1.6.1
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.4.0
click==8.1.7
cryptography==42.0.8
distro-info==1.10
Django==5.1.2
django-tagging==0.5.0
fastjsonschema==2.20.0
fido2==1.1.3
filelock==3.13.3
Flask==2.3.3
FVS==0.3.4
icoextract==0.1.5
idna==3.10
inflect==7.4.0
installer==0.7.0
itsdangerous==2.1.2
jaraco.classes==3.4.0
jaraco.collections==5.0.1
jaraco.context==5.3.0
jaraco.functools==4.0.2
jaraco.text==4.0.0
jeepney==0.8.0
Jinja2==3.1.4
keyring==25.2.1
libfdt==1.7.1
libvirt-python==10.9.0
lit==18.1.8.dev0
louis==3.31.0
Mako==1.3.6.dev0
Markdown==3.7
MarkupSafe==2.1.5
mercurial==6.8.2
meson==1.6.0
more-itertools==10.3.0
nftables==0.1
ordered-set==4.1.0
orjson==3.10.11
packaging==24.1
paramiko==3.4.0
passlib==1.7.4
pathvalidate==0.0.0
patool==3.0.3
pefile==2023.2.7
platformdirs==4.3.6
ply==3.11
powerline-status==2.8.4
pybind11==2.13.6
pycairo==1.27.0
pycparser==2.22
pycurl==7.45.3
pydantic==2.9.2
pydantic_core==2.23.4
PyGObject==3.50.0
PyNaCl==1.5.0
pyOpenSSL==24.2.1
pyparsing==3.1.2
pyproject_hooks==1.2.0
pyscard==2.0.10
pytz==2024.2
PyYAML==6.0.2
ranger-fm==1.9.4
requests==2.32.3
resolvelib==1.1.0
SecretStorage==3.3.3
setuptools==75.2.0
six==1.16.0
sqlparse==0.5.1
ssh-audit==3.3.0
structlog==24.4.0
toml==0.10.2
tomli==2.0.1
tqdm==4.67.0
trove-classifiers==2024.10.21.16
typeguard==4.3.0
typing_extensions==4.12.2
tzlocal==5.2
urllib3==1.26.20
validate-pyproject==0.22
vkbasalt-cli==3.1.1
Werkzeug==3.0.4
wheel==0.44.0
yubikey-manager==5.5.1
CONFIGURATION
 ~/t/z/ansible   *…  ansible-config dump --only-changed                                                      352ms  Thu 21 Nov 2024 09:40:07 AM CET
CONFIG_FILE() = /home/z/xxx/yyy/ansible/ansible.cfg
DEFAULT_ASK_PASS(/home/z/xxx/yyy/ansible/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/z/xxx/yyy/ansible/ansible.cfg) = ['/home/z/xxx/yyy/ansible/inventories']

OS / ENVIRONMENT

Host: Arch Linux
Target: suse Tumbleweed or suse Leap (doesn't matter)

STEPS TO REPRODUCE

Install tumbleweed or leap and run this

# Read https://galaxy.ansible.com/ui/repo/published/sva/sentinelone/content/role/install_agent/

- name: Install agent
  ansible.builtin.include_role:
      name: sva.sentinelone.install_agent
  vars:
      console_url: "{{ SENTINELONE_CONSOLE_URL }}"
      api_token: "{{ SENTINELONE_API_TOKEN }}"
      site: "{{ SENTINELONE_SITE }}"
      group: "{{ SENTINELONE_GROUP }}"
      gpg_key: "{{ SENTINELONE_GPG_KEY }}"
  #when: ansible_facts.ansible_system is defined and ansible_facts.ansible_system == "Linux"
EXPECTED RESULTS

SentinelOne gets installed

ACTUAL RESULTS
 ~/t/z/ansible   *…  ansible-playbook --inventory-file=inventories/trufflepig_test clients.yml -e host=daniel-test --ask-become-pass
SSH password: 
BECOME password[defaults to SSH password]: 

PLAY [clients] ****************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************
[WARNING]: Platform linux on host daniel-test is using the discovered Python interpreter at /usr/bin/python3.11, but future installation of another
Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-
core/2.18/reference_appendices/interpreter_discovery.html for more information.
ok: [daniel-test]

TASK [Install agent] **********************************************************************************************************************************
included: sva.sentinelone.install_agent for daniel-test

TASK [sva.sentinelone.install_agent : Validating arguments against arg spec 'main' - Entrypoint for install_agent role] *******************************
ok: [daniel-test]

TASK [sva.sentinelone.install_agent : Gather facts] ***************************************************************************************************
skipping: [daniel-test]

TASK [sva.sentinelone.install_agent : Preflight check: Fail when OS is unknown] ***********************************************************************
fatal: [daniel-test]: FAILED! => {"changed": false, "msg": "The package management system on this system is unknown. This can happen if the role runs on an unsupported os."}

PLAY RECAP ********************************************************************************************************************************************
daniel-test                : ok=3    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0   
@MrFastDie MrFastDie added the bug Something isn't working label Nov 21, 2024
@MrFastDie
Copy link
Author

When forcing pkg_format to rpm I get:

- name: add pkg
  set_fact:
      pkg_format: "rpm"
TASK [sva.sentinelone.install_agent : Linux: Install python bindings for package managers] ************************************************************
fatal: [daniel-test]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper", "--quiet", "--non-interactive", "--xmlout", "install", "--type", "package", "--auto-agree-with-licenses", "--no-recommends", "--", "+python3-rpm"], "msg": "Zypper run failed.", "rc": 106, "stderr": "", "stderr_lines": [], "stdout": "<?xml version='1.0'?>\n<stream>\n<message type=\"error\">Problem retrieving files from &apos;openSUSE-20241119-0&apos;.\nEmpty destination in URI: hd:/?device=/dev/disk/by-id/dm-name-ventoy\nPlease see the above error message for a hint.\n</message>\n<message type=\"warning\">Skipping repository &apos;openSUSE-20241119-0&apos; because of the above error.</message>\n<message type=\"error\">Some of the repositories have not been refreshed because of an error.</message>\n<install-summary download-size=\"0\" space-usage-diff=\"0\" space-usage-installed=\"0\" space-usage-removed=\"0\" packages-to-change=\"0\" need-restart=\"0\" need-reboot=\"0\">\n</install-summary>\n</stream>\n", "stdout_lines": ["<?xml version='1.0'?>", "<stream>", "<message type=\"error\">Problem retrieving files from &apos;openSUSE-20241119-0&apos;.", "Empty destination in URI: hd:/?device=/dev/disk/by-id/dm-name-ventoy", "Please see the above error message for a hint.", "</message>", "<message type=\"warning\">Skipping repository &apos;openSUSE-20241119-0&apos; because of the above error.</message>", "<message type=\"error\">Some of the repositories have not been refreshed because of an error.</message>", "<install-summary download-size=\"0\" space-usage-diff=\"0\" space-usage-installed=\"0\" space-usage-removed=\"0\" packages-to-change=\"0\" need-restart=\"0\" need-reboot=\"0\">", "</install-summary>", "</stream>"]}

@mwester117
Copy link
Collaborator

mwester117 commented Nov 21, 2024

Hello @MrFastDie,

thanks for your report. You can support us by solving this issue.
The affected code is located here:

pkg_format: "{% if ansible_facts.distribution in ['RedHat', 'CentOS', 'Fedora', 'SLES', 'Suse'] %}rpm{%

and here:

when: pkg_format == 'unknown'

The content of the ansible fact "ansible_facts.distribution" is evaluated. So let's try to get some insight which value the variable has at your system.

Please add the following to your playbook before running the role with gather_facts enabled:

- name: "Debug ansible_facts.distribution"
  ansible.builtin.debug:
    var: ansible_facts.distribution

Send us the result afterwards. Thank you for your help.

@mwester117 mwester117 self-assigned this Nov 21, 2024
@MrFastDie
Copy link
Author

Thats

ok: [daniel-test] => {
    "ansible_facts.distribution": "openSUSE Tumbleweed"
}

And I guess Leap for the Leap system.

However see my previous response when I force rpm

@MrFastDie
Copy link
Author

Ok, I got that figured, for some reason after the USB install the repo was still there but the device not. The command did not fail but gave a strange return code that resolved in ansible failing.

I will make a pr when I got it running.

@mwester117
Copy link
Collaborator

Hi @MrFastDie,

okay for me this error looks like a local problem with your installation.
I tweaked your PR so that new releases of SUSE/OpenSUSE should be automatically supportet if no other breaking changes will come with the new release. Can you please confirm if the installation works with the solution privided in #55?
Then I can release a new collection version soon.

@MrFastDie
Copy link
Author

MrFastDie commented Nov 21, 2024

Hi @mwester117 I can confirm that your provided fix works on Tumbleweed. I will close this Issue then!

@mwester117
Copy link
Collaborator

@MrFastDie new version with the fix is released in ansible galaxy: v2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants