* Added composite var support for proxmox inventory plugin
* Composite variables support for Proxmox nodes in dynamic inventory plugin
Fixes#6640
* Composite variables support for Proxmox nodes in dynamic inventory plugin
Fixes#6640
* Added composite var support for proxmox inventory plugin
* Added composite var support for proxmox inventory plugin
* Update changelogs/fragments/6640-proxmox-composite-variables-support.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* plugins/inventory/cobbler: Add option to use system name for inventory hostname (#6492)
* plugins/inventory/cobbler: Add warning for systems with empty profiles
* Added call method to select proper response from xo server
* Added changelog fragment
* Removed excess blank lines
* Moved period in changelog fragment
* Made suggested changes
* Remove f-strings for Python 2.7 compatibility
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Adding support for `-p` option to specify port(s) to scan
* Adding changelog fragment file
* Corrected appending options
* Edit to doc section
* Correction in documentation type
* Fixed `:` use in doc breaking yaml
* Update changelogs/fragments/6165-nmap-port.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Adding usage example
* Adding comment to example that was missed
* Breaking line up, was too long for sanity test 160 char limit
* Still too long since spaces are counted
* Changed type to string to work for a single entry as well as comma separated values
* Update changelogs/fragments/6165-nmap-port.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* Suppress urllib3 InsecureRequestWarnings when validate_certs option is false
Suppress urllib3 InsecureRequestWarnings when `validate_certs` option is false.
It's clear that the user would know the possible risk when he or she chose to turn off the option, so the warning message could be ignored and make the output clean.
* Create 5915-suppress-urllib3-insecure-request-warnings.yml
* Update changelogs/fragments/5915-suppress-urllib3-insecure-request-warnings.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove extra whitespaces
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
* Provide project field for LXD inventory plugin
if field `project` exists in `lxd.yml`, the instances are searched in the
given LXD project. if project field is not defined the default project
named `default` will be used.
Signed-off-by: omani <3346207+omani@users.noreply.github.com>
* Update plugins/inventory/lxd.py
Signed-off-by: omani <3346207+omani@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Updated tags delimiter
Starting from Proxmox 7.3 tags are delimited by semicolon. For backward compatibility it needs to be splitted by both commas and semicolons.
* Added missing space
* Add changelog fragment.
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix typo disable_looups in inventory/proxmox
- resolve issue with lookups in proxmox inventory config
* add changelog fragment
* Update changelogs/fragments/5640-fix-typo-proxmox-inventory.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* remove redundant and simplify code
we already have a templar from base class
loop reuses code instead of X copies of it
* whitey
* no need to import templar again
* Add changelog fragment.
Co-authored-by: Felix Fontein <felix@fontein.de>
* remove redundant
templar is already in base class
env var is already consulted in via config resolution
* more whites
* no need to import templar again
* Add changelog fragment.
* Try to update tests.
Co-authored-by: Felix Fontein <felix@fontein.de>
* Bump version to 6.0.0.
* sender option is now required.
* Default of want_proxmox_nodes_ansible_host changed from true to false.
* username is now an alias of user, and no longer of workspace.
* Remove deprecated return values in favor of end_state.
* Remove debug option.
* Change default of ignore_volatile_options from true to false.
* gitlab_group must now always contain the full path.
* Change default of norc from false to ture.
* Remove deprecated property.
* Add PR URL.
* Adjust bitbucket unit tests.
* Adjust module_helper integration test.
* virtualbox: Fix nested data parsing
- Skip parsing values with keys that have both a value and nested data.
- Skip parsing values that are nested more than two keys deep.
* Update changelogs/fragments/5348-fix-vbox-deeply-nested-hostvars.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Move licenses to LICENSES/, run add-license.py, add LICENSES/MIT.txt.
* Replace 'Copyright:' with 'Copyright'
sed -i 's|Copyright:\(.*\)|Copyright\1|' $(rg -l 'Copyright:')
Co-authored-by: Maxwell G <gotmax@e.email>
* Update proxmox.py
* Forgot a debug print.
* pep
* Check if int, old school way.
* pep, once again.
* Create 4910-fix-for-agent-enabled.yml
* Must check the first listentry for enabled=1
* Update changelogs/fragments/4910-fix-for-agent-enabled.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added conditional to only collect qmpstatus on qemu VMs
* Processed feedback, added changelog
* Initial change to unit tests
* Made Sanity tests happy again
* Missed a function call, removed superfluous function
* Derp, no need to mock get_vm_status anymore
* Added detail checks whether hosts are mapped to the paused/prelaunch groups
* Fix sanity check
* Processed feedback
* Processed feedback - noqa
* added new statuses for qemu
* added document fragment
* lint fixes
* replaced f strings with %
* move the qmpstatus for qemu to a dedicated group
* added documentation to explain the new addition
* update changelog fragment to reflect the change correctly
* update changelog fragment to reflect the change correctly
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* added a switch to get the qemu extended status
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* groups created when qemu_extended_statuses is true and added tests to make sure they are there
* added test to make sure the groups are not present when qemu_extended_statuses is false
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Parse lxc key from api data for lxc containers
When configuring containers in the `/etc/pve/lxc/` file, the API
adds a 'lxc' key that caused the plugin to crash as it tried to
split a list on ','.
This commit introduces logic to convert the list of lists in the
returned data to a dict as with the other keys.
```
'lxc': [['lxc.apparmor.profile', 'unconfined'],
['lxc.cgroup.devices.allow', 'a']]
```
becomes
```
"proxmox_lxc": {
"apparmor.profile": "unconfined",
"cap.drop": "",
"cgroup.devices.allow": "a"
}
```
* Add changelog fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Philippe Pepos Petitclerc <peposp@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Implement contructable support for opennebula inventory plugin: keyed_groups, compose, groups
* Fixed templating mock issues in unit tests, corrected some linting errors
* trying to make the linter happy
* Now trying to make python2.7 happy
* Added changelog fragment
* changelog fragment needs pluralization
* Update changelogs/fragments/4524-update-opennebula-inventory-plugin-to-match-documentation.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* added templating to the url, user, and password
* added changelog fragment
* typo in description for url, and password
* clarify in the changelog what can you change
* update documentation and added an example
* missing quote from examples
* Apply suggestions from code review
Changed to I for option names
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/proxmox.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Proxmox inventory plugin - Fix tags parsing
* In some cases the Proxmox API returns a tags string that consists in
a single space. The Proxmox inventory plugin parsed that into a
single, empty tag. Stripping the initial string then checking
whether it actually contains something fixes that.
* Do not call `_to_safe` on the concatenation of a known safe string
and a string that was already made safe.
* Changelog fragment for Proxmox inventory plugin tags fix
* Proxmox inventory plugin - Include link to PR in fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* plugins/inventory/lxd.py: fix listing of containers without os / release
In some cases, a container might be present, that was initialized empty, therefore lacking meta information about the os or the release.
Test if the data entry is None to avoid calling lower on it.
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Create 4351-inventory-lxd-handling_metadata_wo_os_and_release.yml
* fix yaml readability of changelog fragment
* Update changelogs/fragments/4351-inventory-lxd-handling_metadata_wo_os_and_release.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Malte Kuhn <mkuhn@maxcluster.de>
* Proxmox inventory plugin - Fix string to dict conversion (#4348)
* Re-use the (defined but unused) `plaintext_configs` variable to list
configuration entries that should be ignored by the string to
dictionary conversion code. At this point, it only contains the
`description` string.
* Convert to a dictionary if the all substrings obtained by splitting
off the initial value with commas contain a `=` character
* Limit substring splitting to a single split, so that a substring
containing `a=b=c` will generate an `a` entry with value `b=c`.
* Added changelog fragment for PR #4349
* Fix changelog fragment for #4349
* Proxmox inventory plugin - Initial implementation of filters
* This is an attempt at implementing something that would satisfy
issue #3553
* A rather massive code rewrite was needed as adding the host to the
inventory, setting its variables and adding it to various groups
used to be done as soon as the information became available. This is
not possible when it is not known whether the host should be added
to the inventory before all data has been gathered.
* The code for both LXC containers and Qemu VMs was refactored into a
single loop.
* Helper functions to generate group and fact names were added.
* Proxmox inventory plugin - Warnings for filter errors
* When an error occurs while compositing a filter's value and strict
mode is disabled, display a warning.
* Proxmox inventory plugin - Fixed pool groups building
* Hosts that were excluded by the host filters were still being added
to pool groups, causing errors.
* Proxmox inventory plugin - Refactoring
* Split off the VM/container handling code from the
`_populate()` method
* Split off pool group attribution from the `_populate()` method
* Proxmox inventory filters - Changelog fragment
* proxmox inventory - Simplify _can_add_host() method
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fix linode inventory filtering
There was a regression introduced in the addition of caching. The
`_consume_options` method was added and provided the `config_data`
dictionary. This `pop`s every entry, resulting in an empty `config_data`
dict, which was then reused and expected to be populated.
After reviewing, `_consume_data` doesn't need to be called. Also, once
the ``_read_config_data` method has been called, we no longer need the
config_data dict, and can instead use the `get_option` method throughout.
Once those were removed, the filtering function seemed a bit odd, since
we were no longer using the file. I used that opportunity to move the
filter calls into the populate function directly.
* Remove tests that target removed methods
This removes tests that targeted some custom methods on configuration
file handling. These are no longer necessary since they are now handled
by the BaseInventoryPlugin `_read_config_data` method.
* Add changelog entry for linode inventory bugfix
* Revert filters back to their own method
This moves filters back into their own method, but now uses the
get_option calls to pull filter configuration items.
* Update Documentation with additional example
* Added an example to have the plugin return an IP address for a Proxmox guest, instead of the name of the guest (default behavior)
* Added an example to include a string literal to every guest (to support a playbook being able to check for variable presence to identify inventory in use)
* Update for line length readability
Co-authored-by: Felix Fontein <felix@fontein.de>
* Changed to cleaner static value
* Changed text for clarity
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added new feature for ansible_user and ansible_port
* Replaced 'try' and 'except' with 'if' condition
* Replace '!=' with 'is not'
* Fixed if condition
* Implement the constructed interface
* Correction at the suggestion of felixfontein
* Added new options in unit test for icinga2 inventory
* Added blank lines in unit test for icinga2 inventory
* Added default filter in example
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fixed variable name in example
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added a changelog fragment
* Fixed changelog fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
* Updated documentation options
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* add profile parameter for scaleway inventory
* Update doc from review and add changelog
* Update changelogs from review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* [inventory/cobbler] Add exclude/include_profile option
Also some minor cleanup
* Review suggestions
* Still must init cache_key
* Add note to exclude_profiles about include_profiles
* Add changelog fragment
* linode: Allow templating token for dynamic inventory
Template the value for the access_token if it's a Jinja template.
Allows for looking up tokens from files or pulling from secrets stores like Vault.
* add Linode changelog fragment
* Fix lookup example for newer versions of Ansible
Co-authored-by: Felix Fontein <felix@fontein.de>
* Rename test case for clarity
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Prepare for distutils.version being removed in Python 2.12.
* Fix copy'n'paste error.
* Re-add Loose prefix.
* Fix Python version typos.
* Improve formulation.
* Move message into own line.
* Fix casing, now that the object is no longer called Version.
* LXD 4.x compatibility (Containers and VMs)
* add changelog fragment
* update fixture
* update plugin options
* backwards compatible alias
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/3519-inventory-support-lxd-4.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* add lxd 4.0 requirement
* filter for type of virtualization added. due to duplication in the namespace, "type" is not used as the keyword but "nature".
* add type filter
Since the first version of this inventory plugin only supports containers,
a filter function was added to filter between containers and
virtual machines or both.
By default only containers are displayed, as in the first version of the plugin.
This behavior will change in the future.
* rename C(nature) to C(type)
The term "nature" does not fit into the lxd namespace.
Therefore i renamed nature to type.
* update changelog fragment
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* rename typefilter to type_filter
* fix tests with type_filter
* Update plugins/inventory/lxd.py
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Frank Dornheim <“dornheim@posteo.de@users.noreply.github.com”>