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

inventory: add bare metal support #63

Merged
merged 3 commits into from
May 4, 2023
Merged

Conversation

resmo
Copy link
Collaborator

@resmo resmo commented Feb 13, 2023

Description

allow to switch between bare metal and virtual instances in inventory.

Related Issues

#61

Checklist:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you linted your code locally prior to submission?
  • Have you successfully ran tests with your changes locally?

@resmo resmo added this to the v1.8 milestone May 3, 2023
@resmo resmo force-pushed the feature/inventory-bare-metal branch from 715fe74 to bf00d8b Compare May 3, 2023 21:54
@resmo resmo changed the title inventory: add base metal support inventory: add bare metal support May 3, 2023
@resmo
Copy link
Collaborator Author

resmo commented May 3, 2023

existing bare metal instance:

 $ vultr-cli bare-metal list
ID                                      IP              TAG     MAC ADDRESS     LABEL   OS                              STATUS  REGION  CPU     RAM             DISK    FEATURES TAGS
64074686-2957-424c-af0c-9522eac68ad8    66.135.22.253           14038009313146  bare    Debian 11 x64 (bullseye)        active  ewr     4       32768 MB        2x 240GB SSD     [ipv6]          []
======================================
TOTAL   NEXT PAGE       PREV PAGE

inventory file:

# file: test.vultr.yml
---
plugin: vultr.cloud.vultr
instance_type: bare_metal

run ansible inventory list:

 $ ansible-inventory -i test.vultr.yml --list  -vvv
ansible-inventory [core 2.14.5]
  config file = /home/resmo/Projects/tmp/vultr/ansible.cfg
  configured module search path = ['/home/resmo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/resmo/Projects/tmp/vultr/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /home/resmo/Projects/resmo/ansible_collections
  executable location = /home/resmo/Projects/tmp/vultr/.venv/bin/ansible-inventory
  python version = 3.11.3 (main, Apr  5 2023, 14:15:06) [GCC 9.4.0] (/home/resmo/Projects/tmp/vultr/.venv/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
Using /home/resmo/Projects/tmp/vultr/ansible.cfg as config file
Type is: bare_metal
Querying API: https://api.vultr.com/v2/bare-metals?per_page=100
Parsed /home/resmo/Projects/tmp/vultr/test.vultr.yml inventory source with ansible_collections.vultr.cloud.plugins.inventory.vultr plugin
{
    "_meta": {
        "hostvars": {
            "bare": {
                "ansible_host": "2001:19f0:1000:131c:0ec4:7aff:fe8e:f77a",
                "vultr_id": "64074686-2957-424c-af0c-9522eac68ad8",
                "vultr_label": "bare",
                "vultr_main_ip": "66.135.22.253",
                "vultr_plan": "vbm-4c-32gb",
                "vultr_region": "ewr",
                "vultr_tags": [],
                "vultr_v6_main_ip": "2001:19f0:1000:131c:0ec4:7aff:fe8e:f77a"
            }
        }
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    },
    "ungrouped": {
        "hosts": [
            "bare"
        ]
    }
}

@resmo resmo marked this pull request as ready for review May 3, 2023 21:58
@codecov-commenter
Copy link

Codecov Report

Patch coverage has no change and project coverage change: +0.34 🎉

Comparison is base (0bf1941) 64.51% compared to head (c599640) 64.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
+ Coverage   64.51%   64.86%   +0.34%     
==========================================
  Files           3        3              
  Lines         403      407       +4     
  Branches       57       57              
==========================================
+ Hits          260      264       +4     
  Misses        142      142              
  Partials        1        1              

see 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@resmo resmo merged commit 4b35c17 into main May 4, 2023
@resmo resmo deleted the feature/inventory-bare-metal branch May 4, 2023 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants