Coder Social home page Coder Social logo

Comments (17)

mariolenz avatar mariolenz commented on August 16, 2024 2

I agree that it would be great to have this available as a Galaxy collection. After all, they seem to be the preferred distribution format for Ansible content.

I've started to re-factor this into a collection in the namespace dellemc because it already exists. There's still a lot to do, especially updating the documentation, but at least it's a start.

We don't use these modules (yet) so I couldn't do any real-world tests, but I hope it works nevertheless. Would love to get your feedback!

@jagadeeshnv @felixs88 @Sajna-Shetty
You three seem to be the only ones committing to this repo at the moment so I ask you directly: What do you think about re-factoring this into a collection? On the one hand, collections only work with Ansible >= 2.9; on the other hand, they are the native packaging format since 2.9. Would you accept my branch as a base to re-factor this into a collection if I issue a PR?

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024 1

@fxfitz These modules were released as an ansible collection today. Is that OK for you, can this issue be closed?

from dellemc-openmanage-ansible-modules.

anupamaloke avatar anupamaloke commented on August 16, 2024

@fxfitz, we would love to provide ansible roles. Any pointers into top use cases that you want us to provide as a role?

from dellemc-openmanage-ansible-modules.

fxfitz avatar fxfitz commented on August 16, 2024

Sure.

Well, overall, installing these Ansible modules seems to be a bit different than "the standard way" of installing new modules for Ansible to use. We landed up just modifying our build pipeline, but this stands out as the only 3rd party library we've had to do that for.

For example, using Ansible Galaxy is the typical way to install new modules/plugins that aren't a part of the main Ansible project. Those are provided in the form of roles, and one would do something like ansible-galaxy install -r requirements.yaml to install the roles from either galaxy.ansible.com or from some SCM (like directly from your Github repository if you didn't want to publish it to Ansible Galaxy).

The layout of the "role" would be very similar to what you have right now in your directory structure. Anything in library/* will be "installed" as a module.

A good example is Ansible-Network's network-engine role. Take a look here: https://github.com/ansible-network/network-engine

from dellemc-openmanage-ansible-modules.

luisico avatar luisico commented on August 16, 2024

Another vote for this. The current installation method modifies ansible in a global way instead of per-role.

from dellemc-openmanage-ansible-modules.

markatdxb avatar markatdxb commented on August 16, 2024

Actually would be great if you could make modules available as part of Ansible Galaxy collection, similar to other providers like VMware, F5 etc...

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

I found some time to work on re-factoring this into an ansible collection, specifically on the unit tests.

ansible-test units --requirements is quite happy now, but while 542 tests pass there is 1 that fails and 4 errors. At the moment, I don't understand why... it would be great if someone could have a look into this and give me a hint.

@jagadeeshnv @felixs88 @Sajna-Shetty
I don't fully understand the unit tests, but some look like they couldn't have worked in the past, either. But maybe I've just made a stupid mistake there. However, 542 tests that pass vs. 5 that don't is already quite good imho. Can you please have a look into my branch?

I think prio 1 would be to fix the last 5 unit tests, prio 2 updating the documentation and prio 3 having a closer look at the code with ansible-test sanity to improve the code quality.

edit:
@jagadeeshnv @felixs88 @Sajna-Shetty @rajeevarakkal
How do you run the unit tests at the moment? I didn't find this documented.

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

I got rid of one error, but there are still 3 more. But it looks like there is only one underlying problem as test_idrac_os_deployment.py tries 3 times to acces sdkinfra in module dellemc_idrac which doesn't exist:

@pytest.fixture
def idrac_mock(self, mocker):
sdkinfra_obj = mocker.patch('ansible.module_utils.remote_management.dellemc.dellemc_idrac.sdkinfra')
obj = MagicMock()
sdkinfra_obj.get_driver.return_value = obj
return sdkinfra_obj

And this one looks like a genuine failure:

[gw1] linux2 -- Python 2.7.13 /bin/python2
self = <ansible_collections.dellemc.openmanage.tests.unit.modules.test_redfish_storage_volume.TestStorageVolume object at 0x7f9fb9af5d10>

    def test_volume_payload_case_01(self):
        param = {
            "drives": ["Disk.Bay.0:Enclosure.Internal.0-0:RAID.Mezzanine.1C-1"],
            "capacity_bytes": 299439751168,
            "block_size_bytes": 512,
            "encryption_types": "NativeDriveEncryption",
            "encrypted": True,
            "volume_type": "NonRedundant",
            "name": "VD1",
            "optimum_io_size_bytes": 65536,
            "oem": {"Dell": {"DellVirtualDisk": {"BusProtocol": "SAS", "Cachecade": "NonCachecadeVD",
                                                 "DiskCachePolicy": "Disabled",
                                                 "LockStatus": "Unlocked",
                                                 "MediaType": "HardDiskDrive",
                                                 "ReadCachePolicy": "NoReadAhead",
                                                 "SpanDepth": 1,
                                                 "SpanLength": 2,
                                                 "WriteCachePolicy": "WriteThrough"}}}}
        f_module = self.get_module_mock(params=param)
>       payload = self.module.volume_payload(f_module)

tests/unit/modules/test_redfish_storage_volume.py:391:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

module = <MagicMock id='140323990970576'>

    def volume_payload(module):
        params = module.params
        drives = params.get("drives")
        capacity_bytes = params.get("capacity_bytes")
        physical_disks = []
        oem = params.get("oem")
        encrypted = params.get("encrypted")
        encryption_types = params.get("encryption_types")
        if capacity_bytes:
            capacity_bytes = int(capacity_bytes)
        if drives:
>           storage_base_uri = storage_collection_map["storage_base_uri"]
E           KeyError: 'storage_base_uri'

plugins/modules/redfish_storage_volume.py:313: KeyError

It looks like redfish_storage_volume tries to access storage_collection_map["storage_base_uri"] but this key doesn't exist.

I'm afraid I need some help here. Can someone please have a look at this?

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

@fxfitz @luisico @markatdxb @goetzk
I've issued PR #120. We don't use these modules (yet) so I couldn't do any real-world tests, but I hope it works nevertheless. Would love to get your feedback!

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

@fxfitz @luisico @markatdxb @goetzk
In case you're still interested, the DellEMC guys opened a new branch collectionsto work on this issue (hooray!) and I've created a new PR #128 for this branch instead of against the devel branch.

from dellemc-openmanage-ansible-modules.

markatdxb avatar markatdxb commented on August 16, 2024

@mariolenz That's a great news, thanks for info and all your hard work in this.

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

@markatdxb

That's a great news, thanks for info and all your hard work in this.

Actually, the work wasn't that hard... I quite enjoyed it because I've learned a lot about Ansible collections. The real problem is to make the maintainers of this project work with me on this. At the moment, they simply refuse to talk with me :-(

from dellemc-openmanage-ansible-modules.

markatdxb avatar markatdxb commented on August 16, 2024

from dellemc-openmanage-ansible-modules.

mariolenz avatar mariolenz commented on August 16, 2024

thats quite sad :(

@jagadeeshnv told me they're still reviewing my changes, so it looks like it's probably only a communication problem.

these guys need a lot of help i would say as lot of things are immature and buggy

Yep, I agree... it's a mess. I hope that re-factoring into a collection will improve things as this would mean we'll have some kind of standardization. I think the ansible guys are very good at keeping their code base healthy and a collection can ansible-test units --requirements and other stuff. There are generic tests for pylint or pep8 that this project could use, too.

from dellemc-openmanage-ansible-modules.

jhg03a avatar jhg03a commented on August 16, 2024

In my case, I wanted to embed the dell modules into an existing role so I used Python GILT to blend it in.

# Embed the offical Dell ansible modules
-   files:
    -   dst: library/
        src: deprecated/*
    -   dst: library/
        src: library/dellemc/idrac/*
    -   dst: library/
        src: library/dellemc/ome/*
    -   dst: library/
        src: library/dellemc/redfish/*
    -   dst: module_utils/
        src: utils/
    git: https://github.com/dell/dellemc-openmanage-ansible-modules.git
    # created at: e86b20e9528e9dde7e9fef1aa07b2304618ab260
    version: devel

Sofar I havn't run into any issues solong as you also ensure the running environment has omsdk available.

from dellemc-openmanage-ansible-modules.

fxfitz avatar fxfitz commented on August 16, 2024

Collection works for me! Awesome job guys! Closing the issue! :ty:

from dellemc-openmanage-ansible-modules.

markatdxb avatar markatdxb commented on August 16, 2024

from dellemc-openmanage-ansible-modules.

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.