Code Monkey home page Code Monkey logo

ansible-collection's Introduction

Ansible Collection - maas.maas

Documentation for the collection.

ansible-playbook -i inventory sample.yml

ansible-collection's People

Contributors

polonam avatar domendobnikar avatar juremedvesek avatar cpg1111 avatar albertodonato avatar sparkiegeek avatar skatsaounis avatar troyanov avatar sk1y101 avatar

Stargazers

Jason Collier avatar Nathan Lloyd Ward avatar  avatar Quinn avatar  avatar David Heurtevent avatar Arkadiy Shinkarev avatar Jerzy Husakowski avatar

Watchers

Thorsten Merten avatar  avatar  avatar Jerzy Husakowski avatar  avatar Quinn avatar Jacopo Rota avatar stormrider avatar  avatar

ansible-collection's Issues

Namespace for collection is incorrect

I am working with getting the collection setup in AWX as part of a plugin/dynamic inventory. Currently will not work due to collection namespace being maas/maas, but inventory is searching namespace of canonical/maas.

To reproduce:

collections/requirements.yml ->

collections:

maas.maas collection from ansible-galaxy for dynamic inventory

  • name: maas.maas

maas_invnentory.yml ->
plugin: "canonical.maas.inventory"

specifies unknown plugin 'canonical.maas.inventory


If I create softlink in .ansible/collections/ansible_collections of canonical-> maas, then everything works as expected. NOTE: debug was done outside of AWX to trackdown.

Integration tests are broken

As a result of the broken integration tests new features cannot be tested and merged to main branch.

Tests should be fixed, CI should recover and the development of the Ansible collection should be resumed

Error when Creating a new Physical Interface

What

When attempting to create a new interface via maas.maas.network_interface_physical, the following error is thrown but the interface is created within MaaS.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'to_ansible'
fatal: [localhost]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/quinnm/.ansible/tmp/ansible-tmp-1690854602.0611262-30070-168320862924394/AnsiballZ_network_interface_physical.py", line 107, in <module>
        _ansiballz_main()
      File "/home/quinnm/.ansible/tmp/ansible-tmp-1690854602.0611262-30070-168320862924394/AnsiballZ_network_interface_physical.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/quinnm/.ansible/tmp/ansible-tmp-1690854602.0611262-30070-168320862924394/AnsiballZ_network_interface_physical.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.maas.maas.plugins.modules.network_interface_physical', init_globals=dict(_module_fqn='ansible_collections.maas.maas.plugins.modules.network_interface_physical', _modlib_path=modlib_path),
      File "/usr/lib/python3.10/runpy.py", line 224, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_maas.maas.network_interface_physical_payload_o0ps5ehg/ansible_maas.maas.network_interface_physical_payload.zip/ansible_collections/maas/maas/plugins/modules/network_interface_physical.py", line 259, in <module>
      File "/tmp/ansible_maas.maas.network_interface_physical_payload_o0ps5ehg/ansible_maas.maas.network_interface_physical_payload.zip/ansible_collections/maas/maas/plugins/modules/network_interface_physical.py", line 252, in main
      File "/tmp/ansible_maas.maas.network_interface_physical_payload_o0ps5ehg/ansible_maas.maas.network_interface_physical_payload.zip/ansible_collections/maas/maas/plugins/modules/network_interface_physical.py", line 210, in run
      File "/tmp/ansible_maas.maas.network_interface_physical_payload_o0ps5ehg/ansible_maas.maas.network_interface_physical_payload.zip/ansible_collections/maas/maas/plugins/modules/network_interface_physical.py", line 154, in ensure_present
    AttributeError: 'NoneType' object has no attribute 'to_ansible'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

How

Using the following task, I was attempting to create a new interface on a test system that had a status of Ready in MaaS

    - name: Create Interface
      maas.maas.network_interface_physical:
        cluster_instance:
          host: "{{ maas_api_host }}"
          token_key: "{{ maas_api_token_key }}"
          token_secret: "{{ maas_api_token_secret }}"
          customer_key: "{{ maas_api_customer_key }}"
        machine: "{{ maas_machine_name }}.{{ maas_machine_domain }}"
        state: present
        mac_address: "{{ mac_address }}"
        vlan: 5001
        name: "eno1"
      register: nic_info

Why

In my debugging (aka lots of print statements ๐Ÿ˜„ ) I've found that for whatever reason, when this tries to run

    after = updated_machine_obj.find_nic_by_mac(
        new_nic_obj.mac_address
    ).to_ansible()

The function updated_machine_obj.find_nic_by_mac() is returning None.

Initial thought was "Maybe this is happening to quick and find_nic_by_mac() is running before the API has the new Nic info recorded. After injecting some time between creation and lookup, I don't think this is the case.

I'm still poking around on this one, but so far I've not stumbled into the solution.

Error executing tests - vm-hosts empty

The tests expect certain vm hosts to exist so that machines can be created for the test environment.
However, we really shouldn't expect any defined machine state.

The vm-host needs to be created before running tests: either by the test runner (Jenkins) or the tests themselves

Integration tests are failing since default power_type cannot be fetched

When running integration tests the following error is observed:

[2024-01-17T10:07:28.063Z] 2024-01-17 10:07:14 INFO test_setup_ansible_collection: |fatal: [testhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 121, in <module>\n  File \"<stdin>\", line 113, in _ansiballz_main\n  File \"<stdin>\", line 61, in invoke_module\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_maas.maas.vm_host_payload_dbwfz2rh/ansible_maas.maas.vm_host_payload.zip/ansible_collections/maas/maas/plugins/modules/vm_host.py\", line 462, in <module>\n  File \"/tmp/ansible_maas.maas.vm_host_payload_dbwfz2rh/ansible_maas.maas.vm_host_payload.zip/ansible_collections/maas/maas/plugins/modules/vm_host.py\", line 455, in main\n  File \"/tmp/ansible_maas.maas.vm_host_payload_dbwfz2rh/ansible_maas.maas.vm_host_payload.zip/ansible_collections/maas/maas/plugins/modules/vm_host.py\", line 408, in run\n  File \"/tmp/ansible_maas.maas.vm_host_payload_dbwfz2rh/ansible_maas.maas.vm_host_payload.zip/ansible_collections/maas/maas/plugins/modules/vm_host.py\", line 336, in deploy_machine_as_vm_host\n  File \"/tmp/ansible_maas.maas.vm_host_payload_dbwfz2rh/ansible_maas.maas.vm_host_payload.zip/ansible_collections/maas/maas/plugins/modules/vm_host.py\", line 326, in data_for_deploy_machine_as_vm_host\nTypeError: 'NoneType' object is not subscriptable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

The reason is that the default power_parameters with default power_type are not picked up. As such the params["power_type"] is None.

Cannot register machine as KVM host upon deployment

When deploying a machine, you have the option of registering the host as a VM host. This cannot be done via the collection as the deployment parameters for the instance module do not allow you to set this parameter currently.

Deleting a machine that doesn't exist errors rather than reporting no change

When running the integration tests, there are initial steps such as the following:

- name: Delete machine
  canonical.maas.machine: &delete-machine
      fqdn: block-device-test.maas
      state: absent

- name: Delete block device
   canonical.maas.block_device: &delete-block-device
       machine_fqdn: block-device-test.maas
       name: my-block-device
       state: absent

- name: Delete block device updated
  canonical.maas.block_device: &delete-block-device-updated
      machine_fqdn: block-device-test.maas
      name: my-block-device-updated
      state: absent

but instead of ok: [testhost] on initial runs where the machine and block devices do not exist, it errors with the following:

fatal: [testhost]: FAILED! => {"changed": false, "msg": "No records from endpoint /api/2.0/machines/ match the {'fqdn': 'block-device-test.maas'} query."}

Support DHCP Relay in VLAN module

MAAS allow DHCP relay to forward DHCP requests to another VLAN that MAAS is managing.

Ansible Collection should support relay_vlan parameter in module canonical.maas.vlan (see PUT /MAAS/api/2.0/fabrics/{fabric_id}/vlans/{vid}/ in MAAS API reference).

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.