- If an absolute path is provided, ensure it starts with /vm
- Also ensure there are no trailing slashes
This gets rid of a few locations where the same was being done.
It also fixes the cases of multiple trailing slashes, or ending up with
/vm/ instead of /vm.
The `except` block with exception matching throught
`if 'connection refused' in str(e).lower():` is funny,
but is not user-friendly.
Probably related issues:
- #15679
- #12161
- #9966
- #8221
- #7218
... and more
On Ubuntu the scriptdir gets placed into sys.path. This makes some
modules (copy) fail because the ansible module gets loaded instead of
the stdlib copy module. So we remove scriptdir there. Unfortunately,
the scriptdir code uses abspath(). When pipelining, abspath() has to
find the cwd. On OSX, finding the cwd when that directory is not
executable by the user raises an OSError. Since OSX does not suffer
from the scriptdir problem we're able to just skip scriptdir handling if
we get that exception.
Fixes#19729
In modern ansible, parameters default to string type. This causes
issues for polymorphic parameters like this module's value param. note
that this fix restores ansible-2.0 and previous behaviour but it is not
perfect. If a parameter is specified via key=value or given on the
commandline then it will be a string before it reaches the module code.
There's nothing we can do about that.
Fixes#19585
can be per run or per host, also aggregate or not
set_stats action plugin as reference implementation
added doc stub
display stats in calblack
made custom stats showing configurable
* Add new module to manage SmartOS images through imgadm(1M)
* Explain why check_mode is not supported
* Add imgadm module
* Incorporate feedback from abadger
* Reenable yum install root tests
No need for sos to test installroot. Something with less deps works
just as well.
* Fix yum installroot.
Fix module import to use fail_json when the modules aren't installed.
Remove wildcard imports
* Lsat task is supposed to remove sos so make that happen
eval can have security consequences. It doesn't look bad here but it
does introduce unnecessary complexity and would make it harder if we
ever want to use static analysis to detect and prohibit eval. So we
should get rid of it.
Note: this could be even more efficient if we combined the checks into
a single condition instead of looping but that does change the error
messages a bit. For instance:
- for arg in ('name', 'linode_id'):
- if not eval(arg):
+ if not (name and linode_id):
+ module.fail_json(msg='name and linode_id are required for active state')
This PR improves the documentation so that it is clear that this module does
not clean the repository metadata cache on removal, and add an example
notification handler to the removal example as an extra reminder.
This fixes#19730
This patch adds support for all other virtual NICs, including:
- pcnet32
- vmxnet2
- e1000e
- sriov
Without this change, VMs with one of these NICs will fail with a
fault.NicSettingMismatch.summary error as it will only add interfaces,
not edit these.
This fixes#19860
New module by @tedder for handling granting/revoking access to KMS secrets.
For example:
```
- name: grant user-style access to production secrets
kms:
args:
mode: grant
key_alias: "alias/my_production_secrets"
role_name: "prod-appServerRole-1R5AQG2BSEL6L"
grant_types: "role,role grant"
```
* Add --installroot to YUM and DNF modules, issue #11310
This continues ansible-modules-core#1558, and
ansible-modules-core#1669
Allow specifying installroot for the yum and dnf modules
to install and remove packages in a location other than /.
* Remove empty aliases
* Simpler installroot set default logic
This allows the ios_* modules to take advantage of the new network_cli
connection plugin by refactoring the ios shared module. Individual modules
need to be udpated as well
* net_config now subclasses action plugin network
* net_template now subclasses action plugin network
This will break existing modules until those modules have been refactored.
* moves parse() into the instance
* removes old Config instance and supporting code
* adds net_common shared module
* minor tweaks to NetworkConfig class for parsing config files
This commit also adds the module to DEFAULT_SQUASH_ACTIONS which is
possible with this change.
The module still calls the pkg_* tools once per name internally, so the only
difference is less invocations of the module itself when using with_items.
Couldn't find any code that does this now but left a comment so that we
don't change something in the future without seeing that it could be
a problem.
A small collection of fixes and improvements:
- Simplify should_deploy_from_template()
- Bugfix for x.config that can be None
- Bugfix for mandatory guest_id (not when using templates)
- Simplify key testing and defaults
- Fix an incorrect reference to the last network
- Duplicate alias 'folder' removed
When becoming an unprivileged user using non-sudo on a platform where
getlogin() failed in our situation we were not able to detect that the
user had switched. This meant that all of our logic to use move vs copy
if the user had switched was attempting the wrong thing. This change
tries the to do the right thing but then falls back to an acceptable
second choice if it doesn't work.
The bug wasn't easily detected because:
* sudo was not affected because sudo records that the user's have been
switched so we were able to detect that.
* getlogin() works on most platforms. RHEL5 with python-2.4 seems to be
the only platform we still care about where getlogin() fails for this
case.
* It had to be becoming an unprivileged user. When becoming
a privileged user, the user would be able to successfully perform the
best case tasks.
* Issue #19575: Adding Dest Param to win_uri
Added `dest` param to win_uri. Outputs the response body to a specified
file.
Addresses Issue #19575
* Was setting the wrong attribute
* Add a encode() to AnsibleVaultEncryptedUnicode
Without it, calling encode() on it results in a bytestring
of the encrypted !vault-encrypted string.
ssh connection plugin triggers this if ansible_password
is from a var using !vault-encrypted. That path ends up
calling .encode() instead of using the __str__.
Fixes#19795
* Fix str.encode() errors on py2.6
py2.6 str.encode() does not take keyword arguments.
os.write() needs bytes objects on python3 while python2 can work with
either a byte or unicode string. Mark the DUMMY_CA_CERT string as
a byte string so it will work.
Fixes#19265Fixes#19266
Wrap the fh.write(str) in b() to ensure the string is of the proper type in py2/py3. Otherwise, the following error occurs when using its ssh_wrapper:
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_8r299r6t/ansible_module_git.py", line 1049, in <module>
main()
File "/tmp/ansible_8r299r6t/ansible_module_git.py", line 928, in main
ssh_wrapper = write_ssh_wrapper()
File "/tmp/ansible_8r299r6t/ansible_module_git.py", line 330, in write_ssh_wrapper
fh.write(template)
TypeError: 'str' does not support the buffer interface
In some cases it is desirable to have a send only function that doesn't
wait for the response from the CLI (such as reloading a device). This
adds a new key to the command json string sendonly that will
achieve this behavior.
When the same role is listed consecutively in a play, the previous role
completion detection failed to mark it as complete as it only checked to
see if the role changed.
This patch addresses that by also keeping track of which task in the role
we are on, so that even if the same role is encountered during later passes
the task number will be less than or equal to the last noted task position.
Related to #15409
* new lookup module: mongodb lookup
* fix versionadded for MongoDB Lookup
* tests should run again
* removed use of basestring
* we don't use iteritems anymore
* run tests again
* run tests again2
* run tests again3
* run tests again4
* Added 2 modules for Packet Host: packet_device and packet_sshkey
* Fixed comments from @mmlb
* Fixed comments from @gundalow
* Fix typos pointed by @gundalow
* Mention new Packet modules in the CHANGELOG.md
* vmware_guest: various fixes, improvements & additions
* Add template_flag attribute to define if the destination machine is a
template
* Add helper class to create:
* SCSI controller
* Disks
* Network devices
* New feature: create VM without using templates
* New feature: multiple NIC
* New feature: multiple disks
* New feature: custom SCSI controller types (default: paravirtual)
* New feature: NIC can now be E1000 or VMXNet3 (default)
* New feature: customize NIC mac address
* New feature: new disk option autoselect_datastore permit to select the less used datastore. If datastore field is provided, filter the datastore list before selection
* New feature: Implement disk resizing + addition when state=present and VM exists
* New feature: when state=present and vm exists, modify the current CPU, Memory and disk space
* New feature: add guest_id support permitting to customize & change current VM guest ID in VMWare
* New feature: resource pool support
* New feature: change VM configuration without recreating it (CPU, memory, disks, network, guest ID, resource pool)
* Add 'gatherfacts' state to gather facts on a VM instead of previous 'present' state ('present' ensure the VM configuration)
* Add PyVmomiCache class to cache read only object
* Various python code fixes
* Various documentation fixes
* esxi_hostname & cluster are now exclusive
* Drop ips attribute & set ip directly into networks
* Little performance fixes by removing some duplicate calls to VMWare API
* Python 3 portability fixes
* Create many functions to make the code maintainable
* Cleanup some useless attributes
* Add 'suspended' as desired state for VM
* Make guest_id, memory & CPU number optional in reconfiguration mode
* Note: guest_id is now mandatory to create a VM from scratch (not templating)
* Bux fixes + Do network IP optinal + Add network vlan option
* Refactoring: split readkeys() into readfile() and parsekeys()
* Refactoring: split writekeys() into writefile() and serialize()
* authorized_key: support --diff
* Refactoring: remove no-longer used readkeys()/writekeys()
* Integration test for authorized_key in check mode
This module managed DHCPd hosts using OMAPI protocol
Features:
* Add a host
* Remove a host
* Modify host IP (it's impossible to modify only mac or only hostname, this doesn't have any effect)
* Add custom DHCP attributes (at creation only)