Giter Site home page Giter Site logo

Comments (11)

tryfan avatar tryfan commented on August 24, 2024

Is there any data you can provide? Possibly some debug output, or cli testing for this issue?

from ansible-collection-morpheus-core.

eisiv avatar eisiv commented on August 24, 2024
root@S700LS001:/var/tmp# ansible-inventory -i morpheusinv.yml --list -vvvv --vau                                                                              lt-password-file /var/opt/morpheus/morpheus-ui/ansiblevault/vault.txt
ansible-inventory [core 2.11.6]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share                                                                              /ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansibl                                                                              e
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/co                                                                              llections
  executable location = /usr/local/bin/ansible-inventory
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /var/tmp/morpheusinv.yml as it did not pass its verif                                                                              y_file() method
script declined parsing /var/tmp/morpheusinv.yml as it did not pass its verify_f                                                                              ile() method
Trying secret FileVaultSecret(filename='/var/opt/morpheus/morpheus-ui/ansiblevau                                                                              lt/vault.txt') for vault_id=default
Trying secret FileVaultSecret(filename='/var/opt/morpheus/morpheus-ui/ansiblevau                                                                              lt/vault.txt') for vault_id=default
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:999: InsecureRequestWar                                                                              ning: Unverified HTTPS request is being made to host 'ais.equinor.com'. Adding c                                                                              ertificate verification is strongly advised. See: https://urllib3.readthedocs.io                                                                              /en/latest/advanced-usage.html#ssl-warnings
  warnings.warn(
Parsed /var/tmp/morpheusinv.yml inventory source with auto plugin
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "LinuxCentosPatch1",
            "LinuxLegacy",
            "UbuntuPatch1",
            "WindowsLegacy",
            "WindowsPatchGroup1",
            "WindowsPatchGroup2",
            "WindowsPatchGroup3",
            "WindowsPatchGroup4",
            "WindowsPatchGroup5",
            "WindowsPatchGroup6",
            "ungrouped"
        ]
    }
}

from ansible-collection-morpheus-core.

tryfan avatar tryfan commented on August 24, 2024

What version of Morpheus are you on? I found an issue with version detection, but I've been testing against newer builds.

from ansible-collection-morpheus-core.

eisiv avatar eisiv commented on August 24, 2024

We're on 5.4.1

from ansible-collection-morpheus-core.

tryfan avatar tryfan commented on August 24, 2024

Ok, I can test on that version. Can you share the scrubbed inventory file itself?

from ansible-collection-morpheus-core.

eisiv avatar eisiv commented on August 24, 2024

plugin: morpheus_inventory
groups:

  • name: WindowsPatchGroup1
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup1

  • name: WindowsPatchGroup2
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup2

  • name: WindowsPatchGroup3
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup3

  • name: WindowsPatchGroup4
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup4

  • name: WindowsPatchGroup5
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup5

  • name: WindowsPatchGroup6
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: PatchGroup6

  • name: LinuxCentosPatch1
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: Linux Centos Patch1

  • name: UbuntuPatch1
    searchtype: tag
    searchstring:
    tagName: Patch
    tagValue: Ubuntu Patch1

  • name: LinuxLegacy
    searchtype: tag
    searchstring:
    tagName: PatchGroup
    tagValue: Linux

  • name: WindowsLegacy
    searchtype: tag
    searchstring:
    tagName: PatchGroup
    tagValue: PatchGroup1

morpheus_url: https://URL_HERE/
morpheus_api_key:
morpheus_ssl_verify: no

from ansible-collection-morpheus-core.

tryfan avatar tryfan commented on August 24, 2024

So, there's a few issues that I've found. I tested with Ubuntu 20.04, Morpheus 5.4.1-2, ansible-core 2.11.6.

In your example, you are referencing the plugin using morpheus_inventory. In Ansible > 2.9, plugins are usually referenced by the FQCN, which in this case is morpheus.core.morpheus_inventory. You can confirm by using ansible-doc -t inventory -l as the morpheus-local user. My output for that is in the gist.

I installed the ansible collection as the morpheus-local user: ansible-galaxy collection install morpheus.core. I created an inventory file referencing tags and got a successful return.

The issue I did run into is this:

[WARNING]:  * Failed to parse /opt/morpheus/.local/inv.yml with auto plugin: Invalid value "morpheus.core.morpheus_inventory" for configuration option "plugin_type:
inventory plugin: ansible_collections.morpheus.core.plugins.inventory.morpheus_inventory setting: plugin ", valid values are: ['morpheus_inventory']

I'm going to fix that issue and update the collection. The workaround is to modify the DOCUMENTATION block on line 24 of morpheus/core/plugins/inventory/morpheus_inventory.py and add to the choices: entry:

choices: ['morpheus_inventory', 'morpheus.core.morpheus_inventory']

Gist with output: https://gist.github.com/tryfan/9ff4e68f1a9c4130db11400390d189c6

from ansible-collection-morpheus-core.

eisiv avatar eisiv commented on August 24, 2024

Tried updating that line, no errors with the FQCN atleast, but still no hosts being fetched.
I'm wondering wether this also requires the Ansible plugin to be configured on all subtenants, or shouldn't that matter?

from ansible-collection-morpheus-core.

tryfan avatar tryfan commented on August 24, 2024

The plugin is executed from the morpheus-local user, the tenant uses the same task backend, so it's all the same. My suspicion is that the morpheus-local user is using a different version of the plugin, and it's just being hidden with the path. The following can test all of that:

su - morpheus-local
mkdir collectiontesttmp
cd collectiontesttmp
virtualenv venv
source venv/bin/activate
pip install ansible-core==2.11.6 requests
ansible-galaxy collection install -p ./collections https://github.com/tryfan/ansible-collection-morpheus-core/releases/download/v0.2.2/morpheus-core-0.2.2.tar.gz
COLLECTIONS_PATHS=./collections
# make a simple inventory plugin with no vault for testing, just the api key and url
ansible-inventory -i <inventory.yml> --list -vvvv

The verbosity will confirm from where the collection is being loaded. I have sourced a patched version of the plugin in my public repo that is in testing. This is my output:

ansible-inventory [core 2.11.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ncelebic/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ncelebic/tmp/collectiontesttmp/venv/lib/python3.8/site-packages/ansible
  ansible collection location = /home/ncelebic/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ncelebic/tmp/collectiontesttmp/venv/bin/ansible-inventory
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 3.0.3
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/ncelebic/tmp/collectiontesttmp/inv.yml as it did not pass its verify_file() method
script declined parsing /home/ncelebic/tmp/collectiontesttmp/inv.yml as it did not pass its verify_file() method
Loading collection morpheus.core from /home/ncelebic/.ansible/collections/ansible_collections/morpheus/core
Parsed /home/ncelebic/tmp/collectiontesttmp/inv.yml inventory source with auto plugin
{
    "_meta": {
        "hostvars": {
            "docker-t3": {
                "ansible_host": "192.168.88.208"
            },
            "docker1": {
                "ansible_host": "192.168.88.25"
            },
            "docker2": {
                "ansible_host": "192.168.88.26"
            }
        }
    },
    "all": {
        "children": [
            "blah",
            "ungrouped"
        ]
    },
    "blah": {
        "hosts": [
            "docker-t3",
            "docker1",
            "docker2"
        ]
    }
}

from ansible-collection-morpheus-core.

eisiv avatar eisiv commented on August 24, 2024

Made sure that it's using the correct plugin version, but still no dice.

from ansible-collection-morpheus-core.

tryfan avatar tryfan commented on August 24, 2024

Issue has been resolved

from ansible-collection-morpheus-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.