10.0.0: remove deprecated features (#8918)
* Remove pool option from redhat_subscription. * Remove proxmox_default_behavior option from proxmox_kvm. * Remove the logging option from ejabberd_user. * Remove the ack_params_state_absent option from consul. * irc: change defaults of use_tls and validate_certs to true. * rhsm_repository: remove states present and absent. * Re-add 'using'. * Fix typo.pull/8908/head
parent
84e0190eee
commit
fe18b05f08
|
@ -0,0 +1,8 @@
|
||||||
|
removed_features:
|
||||||
|
- "redhat_subscriptions - removed the ``pool`` option. Use ``pool_ids`` instead (https://github.com/ansible-collections/community.general/pull/8918)."
|
||||||
|
- "proxmox_kvm - removed the ``proxmox_default_behavior`` option. Explicitly specify the old default values if you were using ``proxmox_default_behavior=compatibility``, otherwise simply remove it (https://github.com/ansible-collections/community.general/pull/8918)."
|
||||||
|
- "ejabberd_user - removed the ``logging`` option (https://github.com/ansible-collections/community.general/pull/8918)."
|
||||||
|
- "consul - removed the ``ack_params_state_absent`` option. It had no effect anymore (https://github.com/ansible-collections/community.general/pull/8918)."
|
||||||
|
breaking_changes:
|
||||||
|
- "irc - the defaults of ``use_tls`` and ``validate_certs`` changed from ``false`` to ``true`` (https://github.com/ansible-collections/community.general/pull/8918)."
|
||||||
|
- "rhsm_repository - the states ``present`` and ``absent`` have been removed. Use ``enabled`` and ``disabled`` instead (https://github.com/ansible-collections/community.general/pull/8918)."
|
|
@ -170,10 +170,6 @@ options:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- The token key identifying an ACL rule set. May be required to register services.
|
- The token key identifying an ACL rule set. May be required to register services.
|
||||||
ack_params_state_absent:
|
|
||||||
type: bool
|
|
||||||
description:
|
|
||||||
- This parameter has no more effect and is deprecated. It will be removed in community.general 10.0.0.
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -598,11 +594,6 @@ def main():
|
||||||
timeout=dict(type='str'),
|
timeout=dict(type='str'),
|
||||||
tags=dict(type='list', elements='str'),
|
tags=dict(type='list', elements='str'),
|
||||||
token=dict(no_log=True),
|
token=dict(no_log=True),
|
||||||
ack_params_state_absent=dict(
|
|
||||||
type='bool',
|
|
||||||
removed_in_version='10.0.0',
|
|
||||||
removed_from_collection='community.general',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
mutually_exclusive=[
|
mutually_exclusive=[
|
||||||
('script', 'ttl', 'tcp', 'http'),
|
('script', 'ttl', 'tcp', 'http'),
|
||||||
|
|
|
@ -41,12 +41,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- the password to assign to the username
|
- the password to assign to the username
|
||||||
required: false
|
required: false
|
||||||
logging:
|
|
||||||
description:
|
|
||||||
- enables or disables the local syslog facility for this module
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
type: bool
|
|
||||||
state:
|
state:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
|
@ -75,8 +69,6 @@ EXAMPLES = '''
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import syslog
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||||
|
|
||||||
|
@ -91,7 +83,6 @@ class EjabberdUser(object):
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
self.logging = module.params.get('logging')
|
|
||||||
self.state = module.params.get('state')
|
self.state = module.params.get('state')
|
||||||
self.host = module.params.get('host')
|
self.host = module.params.get('host')
|
||||||
self.user = module.params.get('username')
|
self.user = module.params.get('username')
|
||||||
|
@ -125,10 +116,8 @@ class EjabberdUser(object):
|
||||||
return self.run_command('check_account', 'user host', (lambda rc, out, err: not bool(rc)))
|
return self.run_command('check_account', 'user host', (lambda rc, out, err: not bool(rc)))
|
||||||
|
|
||||||
def log(self, entry):
|
def log(self, entry):
|
||||||
""" This method will log information to the local syslog facility """
|
""" This method does nothing """
|
||||||
if self.logging:
|
pass
|
||||||
syslog.openlog('ansible-%s' % self.module._name)
|
|
||||||
syslog.syslog(syslog.LOG_NOTICE, entry)
|
|
||||||
|
|
||||||
def run_command(self, cmd, options, process=None):
|
def run_command(self, cmd, options, process=None):
|
||||||
""" This method will run the any command specified and return the
|
""" This method will run the any command specified and return the
|
||||||
|
@ -169,7 +158,6 @@ def main():
|
||||||
username=dict(required=True, type='str'),
|
username=dict(required=True, type='str'),
|
||||||
password=dict(type='str', no_log=True),
|
password=dict(type='str', no_log=True),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
logging=dict(default=False, type='bool', removed_in_version='10.0.0', removed_from_collection='community.general'),
|
|
||||||
),
|
),
|
||||||
required_if=[
|
required_if=[
|
||||||
('state', 'present', ['password']),
|
('state', 'present', ['password']),
|
||||||
|
|
|
@ -85,10 +85,9 @@ options:
|
||||||
was exlusively called O(use_ssl). The latter is now an alias of O(use_tls).
|
was exlusively called O(use_ssl). The latter is now an alias of O(use_tls).
|
||||||
- B(Note:) for security reasons, you should always set O(use_tls=true) and
|
- B(Note:) for security reasons, you should always set O(use_tls=true) and
|
||||||
O(validate_certs=true) whenever possible.
|
O(validate_certs=true) whenever possible.
|
||||||
- The option currently defaults to V(false). The default has been B(deprecated) and will
|
- The default of this option changed to V(true) in community.general 10.0.0.
|
||||||
change to V(true) in community.general 10.0.0. To avoid deprecation warnings, explicitly
|
|
||||||
set this option to a value (preferably V(true)).
|
|
||||||
type: bool
|
type: bool
|
||||||
|
default: true
|
||||||
aliases:
|
aliases:
|
||||||
- use_ssl
|
- use_ssl
|
||||||
part:
|
part:
|
||||||
|
@ -110,10 +109,9 @@ options:
|
||||||
if the network between between Ansible and the IRC server is known to be safe.
|
if the network between between Ansible and the IRC server is known to be safe.
|
||||||
- B(Note:) for security reasons, you should always set O(use_tls=true) and
|
- B(Note:) for security reasons, you should always set O(use_tls=true) and
|
||||||
O(validate_certs=true) whenever possible.
|
O(validate_certs=true) whenever possible.
|
||||||
- The option currently defaults to V(false). The default has been B(deprecated) and will
|
- The default of this option changed to V(true) in community.general 10.0.0.
|
||||||
change to V(true) in community.general 10.0.0. To avoid deprecation warnings, explicitly
|
|
||||||
set this option to a value (preferably V(true)).
|
|
||||||
type: bool
|
type: bool
|
||||||
|
default: true
|
||||||
version_added: 8.1.0
|
version_added: 8.1.0
|
||||||
|
|
||||||
# informational: requirements for nodes
|
# informational: requirements for nodes
|
||||||
|
@ -313,8 +311,8 @@ def main():
|
||||||
passwd=dict(no_log=True),
|
passwd=dict(no_log=True),
|
||||||
timeout=dict(type='int', default=30),
|
timeout=dict(type='int', default=30),
|
||||||
part=dict(type='bool', default=True),
|
part=dict(type='bool', default=True),
|
||||||
use_tls=dict(type='bool', aliases=['use_ssl']),
|
use_tls=dict(type='bool', default=True, aliases=['use_ssl']),
|
||||||
validate_certs=dict(type='bool'),
|
validate_certs=dict(type='bool', default=True),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_one_of=[['channel', 'nick_to']]
|
required_one_of=[['channel', 'nick_to']]
|
||||||
|
@ -338,25 +336,6 @@ def main():
|
||||||
style = module.params["style"]
|
style = module.params["style"]
|
||||||
validate_certs = module.params["validate_certs"]
|
validate_certs = module.params["validate_certs"]
|
||||||
|
|
||||||
if use_tls is None:
|
|
||||||
module.deprecate(
|
|
||||||
'The default of use_tls will change to true in community.general 10.0.0.'
|
|
||||||
' Set a value now (preferably true, if possible) to avoid the deprecation warning.',
|
|
||||||
version='10.0.0',
|
|
||||||
collection_name='community.general',
|
|
||||||
)
|
|
||||||
use_tls = False
|
|
||||||
|
|
||||||
if validate_certs is None:
|
|
||||||
if use_tls:
|
|
||||||
module.deprecate(
|
|
||||||
'The default of validate_certs will change to true in community.general 10.0.0.'
|
|
||||||
' Set a value now (prefarably true, if possible) to avoid the deprecation warning.',
|
|
||||||
version='10.0.0',
|
|
||||||
collection_name='community.general',
|
|
||||||
)
|
|
||||||
validate_certs = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_tls, validate_certs, part, style)
|
send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_tls, validate_certs, part, style)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -14,7 +14,7 @@ module: proxmox_kvm
|
||||||
short_description: Management of Qemu(KVM) Virtual Machines in Proxmox VE cluster
|
short_description: Management of Qemu(KVM) Virtual Machines in Proxmox VE cluster
|
||||||
description:
|
description:
|
||||||
- Allows you to create/delete/stop Qemu(KVM) Virtual Machines in Proxmox VE cluster.
|
- Allows you to create/delete/stop Qemu(KVM) Virtual Machines in Proxmox VE cluster.
|
||||||
- Since community.general 4.0.0 on, there are no more default values, see O(proxmox_default_behavior).
|
- Since community.general 4.0.0 on, there are no more default values.
|
||||||
author: "Abdoul Bah (@helldorado) <bahabdoul at gmail.com>"
|
author: "Abdoul Bah (@helldorado) <bahabdoul at gmail.com>"
|
||||||
attributes:
|
attributes:
|
||||||
check_mode:
|
check_mode:
|
||||||
|
@ -32,7 +32,6 @@ options:
|
||||||
acpi:
|
acpi:
|
||||||
description:
|
description:
|
||||||
- Specify if ACPI should be enabled/disabled.
|
- Specify if ACPI should be enabled/disabled.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
|
|
||||||
type: bool
|
type: bool
|
||||||
agent:
|
agent:
|
||||||
description:
|
description:
|
||||||
|
@ -44,19 +43,15 @@ options:
|
||||||
description:
|
description:
|
||||||
- Pass arbitrary arguments to kvm.
|
- Pass arbitrary arguments to kvm.
|
||||||
- This option is for experts only!
|
- This option is for experts only!
|
||||||
- If O(proxmox_default_behavior) is set to V(compatibility), this option has a default of
|
|
||||||
V(-serial unix:/var/run/qemu-server/<vmid>.serial,server,nowait).
|
|
||||||
type: str
|
type: str
|
||||||
autostart:
|
autostart:
|
||||||
description:
|
description:
|
||||||
- Specify if the VM should be automatically restarted after crash (currently ignored in PVE API).
|
- Specify if the VM should be automatically restarted after crash (currently ignored in PVE API).
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
|
|
||||||
type: bool
|
type: bool
|
||||||
balloon:
|
balloon:
|
||||||
description:
|
description:
|
||||||
- Specify the amount of RAM for the VM in MB.
|
- Specify the amount of RAM for the VM in MB.
|
||||||
- Using zero disables the balloon driver.
|
- Using zero disables the balloon driver.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(0).
|
|
||||||
type: int
|
type: int
|
||||||
bios:
|
bios:
|
||||||
description:
|
description:
|
||||||
|
@ -68,7 +63,6 @@ options:
|
||||||
- Specify the boot order -> boot on floppy V(a), hard disk V(c), CD-ROM V(d), or network V(n).
|
- Specify the boot order -> boot on floppy V(a), hard disk V(c), CD-ROM V(d), or network V(n).
|
||||||
- For newer versions of Proxmox VE, use a boot order like V(order=scsi0;net0;hostpci0).
|
- For newer versions of Proxmox VE, use a boot order like V(order=scsi0;net0;hostpci0).
|
||||||
- You can combine to set order.
|
- You can combine to set order.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(cnd).
|
|
||||||
type: str
|
type: str
|
||||||
bootdisk:
|
bootdisk:
|
||||||
description:
|
description:
|
||||||
|
@ -104,12 +98,10 @@ options:
|
||||||
cores:
|
cores:
|
||||||
description:
|
description:
|
||||||
- Specify number of cores per socket.
|
- Specify number of cores per socket.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1).
|
|
||||||
type: int
|
type: int
|
||||||
cpu:
|
cpu:
|
||||||
description:
|
description:
|
||||||
- Specify emulated CPU type.
|
- Specify emulated CPU type.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(kvm64).
|
|
||||||
type: str
|
type: str
|
||||||
cpulimit:
|
cpulimit:
|
||||||
description:
|
description:
|
||||||
|
@ -120,7 +112,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- Specify CPU weight for a VM.
|
- Specify CPU weight for a VM.
|
||||||
- You can disable fair-scheduler configuration by setting this to 0
|
- You can disable fair-scheduler configuration by setting this to 0
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1000).
|
|
||||||
type: int
|
type: int
|
||||||
delete:
|
delete:
|
||||||
description:
|
description:
|
||||||
|
@ -173,7 +164,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- Allow to force stop VM.
|
- Allow to force stop VM.
|
||||||
- Can be used with states V(stopped), V(restarted), and V(absent).
|
- Can be used with states V(stopped), V(restarted), and V(absent).
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
|
|
||||||
- Requires parameter O(archive).
|
- Requires parameter O(archive).
|
||||||
type: bool
|
type: bool
|
||||||
format:
|
format:
|
||||||
|
@ -184,8 +174,7 @@ options:
|
||||||
- Please refer to the Proxmox VE Administrator Guide, section Proxmox VE Storage (see
|
- Please refer to the Proxmox VE Administrator Guide, section Proxmox VE Storage (see
|
||||||
U(https://pve.proxmox.com/pve-docs/chapter-pvesm.html) for the latest version, tables 3 to 14) to find out format
|
U(https://pve.proxmox.com/pve-docs/chapter-pvesm.html) for the latest version, tables 3 to 14) to find out format
|
||||||
supported by the provided storage backend.
|
supported by the provided storage backend.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(qcow2).
|
- Not specifying this option is equivalent to setting it to V(unspecified).
|
||||||
If O(proxmox_default_behavior) is set to V(no_defaults), not specifying this option is equivalent to setting it to V(unspecified).
|
|
||||||
type: str
|
type: str
|
||||||
choices: [ "cloop", "cow", "qcow", "qcow2", "qed", "raw", "vmdk", "unspecified" ]
|
choices: [ "cloop", "cow", "qcow", "qcow2", "qed", "raw", "vmdk", "unspecified" ]
|
||||||
freeze:
|
freeze:
|
||||||
|
@ -257,7 +246,6 @@ options:
|
||||||
kvm:
|
kvm:
|
||||||
description:
|
description:
|
||||||
- Enable/disable KVM hardware virtualization.
|
- Enable/disable KVM hardware virtualization.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
|
|
||||||
type: bool
|
type: bool
|
||||||
localtime:
|
localtime:
|
||||||
description:
|
description:
|
||||||
|
@ -277,7 +265,6 @@ options:
|
||||||
memory:
|
memory:
|
||||||
description:
|
description:
|
||||||
- Memory size in MB for instance.
|
- Memory size in MB for instance.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(512).
|
|
||||||
type: int
|
type: int
|
||||||
migrate:
|
migrate:
|
||||||
description:
|
description:
|
||||||
|
@ -340,13 +327,11 @@ options:
|
||||||
onboot:
|
onboot:
|
||||||
description:
|
description:
|
||||||
- Specifies whether a VM will be started during system bootup.
|
- Specifies whether a VM will be started during system bootup.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(true).
|
|
||||||
type: bool
|
type: bool
|
||||||
ostype:
|
ostype:
|
||||||
description:
|
description:
|
||||||
- Specifies guest operating system. This is used to enable special optimization/features for specific operating systems.
|
- Specifies guest operating system. This is used to enable special optimization/features for specific operating systems.
|
||||||
- The l26 is Linux 2.6/3.X Kernel.
|
- The l26 is Linux 2.6/3.X Kernel.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(l26).
|
|
||||||
type: str
|
type: str
|
||||||
choices: ['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'win10', 'win11', 'l24', 'l26', 'solaris']
|
choices: ['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'win10', 'win11', 'l24', 'l26', 'solaris']
|
||||||
parallel:
|
parallel:
|
||||||
|
@ -439,7 +424,6 @@ options:
|
||||||
sockets:
|
sockets:
|
||||||
description:
|
description:
|
||||||
- Sets the number of CPU sockets. (1 - N).
|
- Sets the number of CPU sockets. (1 - N).
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(1).
|
|
||||||
type: int
|
type: int
|
||||||
sshkeys:
|
sshkeys:
|
||||||
description:
|
description:
|
||||||
|
@ -472,7 +456,6 @@ options:
|
||||||
tablet:
|
tablet:
|
||||||
description:
|
description:
|
||||||
- Enables/disables the USB tablet device.
|
- Enables/disables the USB tablet device.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
|
|
||||||
type: bool
|
type: bool
|
||||||
tags:
|
tags:
|
||||||
description:
|
description:
|
||||||
|
@ -494,7 +477,6 @@ options:
|
||||||
template:
|
template:
|
||||||
description:
|
description:
|
||||||
- Enables/disables the template.
|
- Enables/disables the template.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(false).
|
|
||||||
type: bool
|
type: bool
|
||||||
timeout:
|
timeout:
|
||||||
description:
|
description:
|
||||||
|
@ -553,7 +535,6 @@ options:
|
||||||
vga:
|
vga:
|
||||||
description:
|
description:
|
||||||
- Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'.
|
- Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'.
|
||||||
- This option has no default unless O(proxmox_default_behavior) is set to V(compatibility); then the default is V(std).
|
|
||||||
type: str
|
type: str
|
||||||
choices: ['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']
|
choices: ['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']
|
||||||
virtio:
|
virtio:
|
||||||
|
@ -571,24 +552,6 @@ options:
|
||||||
description:
|
description:
|
||||||
- Creates a virtual hardware watchdog device.
|
- Creates a virtual hardware watchdog device.
|
||||||
type: str
|
type: str
|
||||||
proxmox_default_behavior:
|
|
||||||
description:
|
|
||||||
- As of community.general 4.0.0, various options no longer have default values.
|
|
||||||
These default values caused problems when users expected different behavior from Proxmox
|
|
||||||
by default or filled options which caused problems when set.
|
|
||||||
- The value V(compatibility) (default before community.general 4.0.0) will ensure that the default values
|
|
||||||
are used when the values are not explicitly specified by the user. The new default is V(no_defaults),
|
|
||||||
which makes sure these options have no defaults.
|
|
||||||
- This affects the O(acpi), O(autostart), O(balloon), O(boot), O(cores), O(cpu),
|
|
||||||
O(cpuunits), O(force), O(format), O(kvm), O(memory), O(onboot), O(ostype), O(sockets),
|
|
||||||
O(tablet), O(template), and O(vga) options.
|
|
||||||
- This option is deprecated and will be removed in community.general 10.0.0.
|
|
||||||
type: str
|
|
||||||
default: no_defaults
|
|
||||||
choices:
|
|
||||||
- compatibility
|
|
||||||
- no_defaults
|
|
||||||
version_added: "1.3.0"
|
|
||||||
seealso:
|
seealso:
|
||||||
- module: community.general.proxmox_vm_info
|
- module: community.general.proxmox_vm_info
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
|
@ -1143,10 +1106,7 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
kwargs['tags'] = ",".join(kwargs['tags'])
|
kwargs['tags'] = ",".join(kwargs['tags'])
|
||||||
|
|
||||||
# -args and skiplock require root@pam user - but can not use api tokens
|
# -args and skiplock require root@pam user - but can not use api tokens
|
||||||
if self.module.params['api_user'] == "root@pam" and self.module.params['args'] is None:
|
if self.module.params['api_user'] == "root@pam" and self.module.params['args'] is not None:
|
||||||
if not update and self.module.params['proxmox_default_behavior'] == 'compatibility':
|
|
||||||
kwargs['args'] = vm_args
|
|
||||||
elif self.module.params['api_user'] == "root@pam" and self.module.params['args'] is not None:
|
|
||||||
kwargs['args'] = self.module.params['args']
|
kwargs['args'] = self.module.params['args']
|
||||||
elif self.module.params['api_user'] != "root@pam" and self.module.params['args'] is not None:
|
elif self.module.params['api_user'] != "root@pam" and self.module.params['args'] is not None:
|
||||||
self.module.fail_json(msg='args parameter require root@pam user. ')
|
self.module.fail_json(msg='args parameter require root@pam user. ')
|
||||||
|
@ -1330,11 +1290,6 @@ def main():
|
||||||
virtio=dict(type='dict'),
|
virtio=dict(type='dict'),
|
||||||
vmid=dict(type='int'),
|
vmid=dict(type='int'),
|
||||||
watchdog=dict(),
|
watchdog=dict(),
|
||||||
proxmox_default_behavior=dict(type='str',
|
|
||||||
default='no_defaults',
|
|
||||||
choices=['compatibility', 'no_defaults'],
|
|
||||||
removed_from_collection='community.general',
|
|
||||||
removed_in_version='10.0.0'),
|
|
||||||
)
|
)
|
||||||
module_args.update(kvm_args)
|
module_args.update(kvm_args)
|
||||||
|
|
||||||
|
@ -1363,28 +1318,6 @@ def main():
|
||||||
vmid = module.params['vmid']
|
vmid = module.params['vmid']
|
||||||
validate_certs = module.params['validate_certs']
|
validate_certs = module.params['validate_certs']
|
||||||
|
|
||||||
if module.params['proxmox_default_behavior'] == 'compatibility':
|
|
||||||
old_default_values = dict(
|
|
||||||
acpi=True,
|
|
||||||
autostart=False,
|
|
||||||
balloon=0,
|
|
||||||
boot='cnd',
|
|
||||||
cores=1,
|
|
||||||
cpu='kvm64',
|
|
||||||
cpuunits=1000,
|
|
||||||
format='qcow2',
|
|
||||||
kvm=True,
|
|
||||||
memory=512,
|
|
||||||
ostype='l26',
|
|
||||||
sockets=1,
|
|
||||||
tablet=False,
|
|
||||||
template=False,
|
|
||||||
vga='std',
|
|
||||||
)
|
|
||||||
for param, value in old_default_values.items():
|
|
||||||
if module.params[param] is None:
|
|
||||||
module.params[param] = value
|
|
||||||
|
|
||||||
if module.params['format'] == 'unspecified':
|
if module.params['format'] == 'unspecified':
|
||||||
module.params['format'] = None
|
module.params['format'] = None
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ notes:
|
||||||
- Since community.general 6.5.0, credentials (that is, O(username) and O(password),
|
- Since community.general 6.5.0, credentials (that is, O(username) and O(password),
|
||||||
O(activationkey), or O(token)) are needed only in case the the system is not registered,
|
O(activationkey), or O(token)) are needed only in case the the system is not registered,
|
||||||
or O(force_register) is specified; this makes it possible to use the module to tweak an
|
or O(force_register) is specified; this makes it possible to use the module to tweak an
|
||||||
already registered system, for example attaching pools to it (using O(pool), or O(pool_ids)),
|
already registered system, for example attaching pools to it (using O(pool_ids)),
|
||||||
and modifying the C(syspurpose) attributes (using O(syspurpose)).
|
and modifying the C(syspurpose) attributes (using O(syspurpose)).
|
||||||
requirements:
|
requirements:
|
||||||
- subscription-manager
|
- subscription-manager
|
||||||
|
@ -138,29 +138,14 @@ options:
|
||||||
description:
|
description:
|
||||||
- Register with a specific environment in the destination org. Used with Red Hat Satellite or Katello
|
- Register with a specific environment in the destination org. Used with Red Hat Satellite or Katello
|
||||||
type: str
|
type: str
|
||||||
pool:
|
|
||||||
description:
|
|
||||||
- |
|
|
||||||
Specify a subscription pool name to consume. Regular expressions accepted.
|
|
||||||
Mutually exclusive with O(pool_ids).
|
|
||||||
- |
|
|
||||||
Please use O(pool_ids) instead: specifying pool IDs is much faster,
|
|
||||||
and it avoids to match new pools that become available for the
|
|
||||||
system and are not explicitly wanted. Also, this option does not
|
|
||||||
support quantities.
|
|
||||||
- |
|
|
||||||
This option is deprecated for the reasons mentioned above,
|
|
||||||
and it will be removed in community.general 10.0.0.
|
|
||||||
default: '^$'
|
|
||||||
type: str
|
|
||||||
pool_ids:
|
pool_ids:
|
||||||
description:
|
description:
|
||||||
- |
|
- |
|
||||||
Specify subscription pool IDs to consume. Prefer over O(pool) when possible as it is much faster.
|
Specify subscription pool IDs to consume.
|
||||||
A pool ID may be specified as a C(string) - just the pool ID (for example V(0123456789abcdef0123456789abcdef)),
|
A pool ID may be specified as a C(string) - just the pool ID (for example V(0123456789abcdef0123456789abcdef)),
|
||||||
or as a C(dict) with the pool ID as the key, and a quantity as the value (for example
|
or as a C(dict) with the pool ID as the key, and a quantity as the value (for example
|
||||||
V(0123456789abcdef0123456789abcdef: 2). If the quantity is provided, it is used to consume multiple
|
V(0123456789abcdef0123456789abcdef: 2). If the quantity is provided, it is used to consume multiple
|
||||||
entitlements from a pool (the pool must support this). Mutually exclusive with O(pool).
|
entitlements from a pool (the pool must support this).
|
||||||
default: []
|
default: []
|
||||||
type: list
|
type: list
|
||||||
elements: raw
|
elements: raw
|
||||||
|
@ -261,20 +246,6 @@ EXAMPLES = '''
|
||||||
password: somepass
|
password: somepass
|
||||||
consumer_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
consumer_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||||
|
|
||||||
- name: Register with activationkey and consume subscriptions matching Red Hat Enterprise Server or Red Hat Virtualization
|
|
||||||
community.general.redhat_subscription:
|
|
||||||
state: present
|
|
||||||
activationkey: 1-222333444
|
|
||||||
org_id: 222333444
|
|
||||||
pool: '^(Red Hat Enterprise Server|Red Hat Virtualization)$'
|
|
||||||
|
|
||||||
- name: Update the consumed subscriptions from the previous example (remove Red Hat Virtualization subscription)
|
|
||||||
community.general.redhat_subscription:
|
|
||||||
state: present
|
|
||||||
activationkey: 1-222333444
|
|
||||||
org_id: 222333444
|
|
||||||
pool: '^Red Hat Enterprise Server$'
|
|
||||||
|
|
||||||
- name: Register as user credentials into given environment (against Red Hat Satellite or Katello), and auto-subscribe.
|
- name: Register as user credentials into given environment (against Red Hat Satellite or Katello), and auto-subscribe.
|
||||||
community.general.redhat_subscription:
|
community.general.redhat_subscription:
|
||||||
state: present
|
state: present
|
||||||
|
@ -783,42 +754,6 @@ class Rhsm(object):
|
||||||
self.update_plugin_conf('rhnplugin', False)
|
self.update_plugin_conf('rhnplugin', False)
|
||||||
self.update_plugin_conf('subscription-manager', False)
|
self.update_plugin_conf('subscription-manager', False)
|
||||||
|
|
||||||
def subscribe(self, regexp):
|
|
||||||
'''
|
|
||||||
Subscribe current system to available pools matching the specified
|
|
||||||
regular expression. It matches regexp against available pool ids first.
|
|
||||||
If any pool ids match, subscribe to those pools and return.
|
|
||||||
|
|
||||||
If no pool ids match, then match regexp against available pool product
|
|
||||||
names. Note this can still easily match many many pools. Then subscribe
|
|
||||||
to those pools.
|
|
||||||
|
|
||||||
Since a pool id is a more specific match, we only fallback to matching
|
|
||||||
against names if we didn't match pool ids.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
* Exception - if error occurs while running command
|
|
||||||
'''
|
|
||||||
# See https://github.com/ansible/ansible/issues/19466
|
|
||||||
|
|
||||||
# subscribe to pools whose pool id matches regexp (and only the pool id)
|
|
||||||
subscribed_pool_ids = self.subscribe_pool(regexp)
|
|
||||||
|
|
||||||
# If we found any matches, we are done
|
|
||||||
# Don't attempt to match pools by product name
|
|
||||||
if subscribed_pool_ids:
|
|
||||||
return subscribed_pool_ids
|
|
||||||
|
|
||||||
# We didn't match any pool ids.
|
|
||||||
# Now try subscribing to pools based on product name match
|
|
||||||
# Note: This can match lots of product names.
|
|
||||||
subscribed_by_product_pool_ids = self.subscribe_product(regexp)
|
|
||||||
if subscribed_by_product_pool_ids:
|
|
||||||
return subscribed_by_product_pool_ids
|
|
||||||
|
|
||||||
# no matches
|
|
||||||
return []
|
|
||||||
|
|
||||||
def subscribe_by_pool_ids(self, pool_ids):
|
def subscribe_by_pool_ids(self, pool_ids):
|
||||||
"""
|
"""
|
||||||
Try to subscribe to the list of pool IDs
|
Try to subscribe to the list of pool IDs
|
||||||
|
@ -837,56 +772,6 @@ class Rhsm(object):
|
||||||
self.module.fail_json(msg='Pool ID: %s not in list of available pools' % pool_id)
|
self.module.fail_json(msg='Pool ID: %s not in list of available pools' % pool_id)
|
||||||
return pool_ids
|
return pool_ids
|
||||||
|
|
||||||
def subscribe_pool(self, regexp):
|
|
||||||
'''
|
|
||||||
Subscribe current system to available pools matching the specified
|
|
||||||
regular expression
|
|
||||||
Raises:
|
|
||||||
* Exception - if error occurs while running command
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Available pools ready for subscription
|
|
||||||
available_pools = RhsmPools(self.module)
|
|
||||||
|
|
||||||
subscribed_pool_ids = []
|
|
||||||
for pool in available_pools.filter_pools(regexp):
|
|
||||||
pool.subscribe()
|
|
||||||
subscribed_pool_ids.append(pool.get_pool_id())
|
|
||||||
return subscribed_pool_ids
|
|
||||||
|
|
||||||
def subscribe_product(self, regexp):
|
|
||||||
'''
|
|
||||||
Subscribe current system to available pools matching the specified
|
|
||||||
regular expression
|
|
||||||
Raises:
|
|
||||||
* Exception - if error occurs while running command
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Available pools ready for subscription
|
|
||||||
available_pools = RhsmPools(self.module)
|
|
||||||
|
|
||||||
subscribed_pool_ids = []
|
|
||||||
for pool in available_pools.filter_products(regexp):
|
|
||||||
pool.subscribe()
|
|
||||||
subscribed_pool_ids.append(pool.get_pool_id())
|
|
||||||
return subscribed_pool_ids
|
|
||||||
|
|
||||||
def update_subscriptions(self, regexp):
|
|
||||||
changed = False
|
|
||||||
consumed_pools = RhsmPools(self.module, consumed=True)
|
|
||||||
pool_ids_to_keep = [p.get_pool_id() for p in consumed_pools.filter_pools(regexp)]
|
|
||||||
pool_ids_to_keep.extend([p.get_pool_id() for p in consumed_pools.filter_products(regexp)])
|
|
||||||
|
|
||||||
serials_to_remove = [p.Serial for p in consumed_pools if p.get_pool_id() not in pool_ids_to_keep]
|
|
||||||
serials = self.unsubscribe(serials=serials_to_remove)
|
|
||||||
|
|
||||||
subscribed_pool_ids = self.subscribe(regexp)
|
|
||||||
|
|
||||||
if subscribed_pool_ids or serials:
|
|
||||||
changed = True
|
|
||||||
return {'changed': changed, 'subscribed_pool_ids': subscribed_pool_ids,
|
|
||||||
'unsubscribed_serials': serials}
|
|
||||||
|
|
||||||
def update_subscriptions_by_pool_ids(self, pool_ids):
|
def update_subscriptions_by_pool_ids(self, pool_ids):
|
||||||
changed = False
|
changed = False
|
||||||
consumed_pools = RhsmPools(self.module, consumed=True)
|
consumed_pools = RhsmPools(self.module, consumed=True)
|
||||||
|
@ -1109,11 +994,6 @@ def main():
|
||||||
'activationkey': {'no_log': True},
|
'activationkey': {'no_log': True},
|
||||||
'org_id': {},
|
'org_id': {},
|
||||||
'environment': {},
|
'environment': {},
|
||||||
'pool': {
|
|
||||||
'default': '^$',
|
|
||||||
'removed_in_version': '10.0.0',
|
|
||||||
'removed_from_collection': 'community.general',
|
|
||||||
},
|
|
||||||
'pool_ids': {'default': [], 'type': 'list', 'elements': 'raw'},
|
'pool_ids': {'default': [], 'type': 'list', 'elements': 'raw'},
|
||||||
'consumer_type': {},
|
'consumer_type': {},
|
||||||
'consumer_name': {},
|
'consumer_name': {},
|
||||||
|
@ -1144,8 +1024,7 @@ def main():
|
||||||
['token', 'username'],
|
['token', 'username'],
|
||||||
['activationkey', 'consumer_id'],
|
['activationkey', 'consumer_id'],
|
||||||
['activationkey', 'environment'],
|
['activationkey', 'environment'],
|
||||||
['activationkey', 'auto_attach'],
|
['activationkey', 'auto_attach']],
|
||||||
['pool', 'pool_ids']],
|
|
||||||
required_if=[['force_register', True, ['username', 'activationkey', 'token'], True]],
|
required_if=[['force_register', True, ['username', 'activationkey', 'token'], True]],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1173,7 +1052,6 @@ def main():
|
||||||
if activationkey and not org_id:
|
if activationkey and not org_id:
|
||||||
module.fail_json(msg='org_id is required when using activationkey')
|
module.fail_json(msg='org_id is required when using activationkey')
|
||||||
environment = module.params['environment']
|
environment = module.params['environment']
|
||||||
pool = module.params['pool']
|
|
||||||
pool_ids = {}
|
pool_ids = {}
|
||||||
for value in module.params['pool_ids']:
|
for value in module.params['pool_ids']:
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
|
@ -1217,12 +1095,9 @@ def main():
|
||||||
rhsm.sync_syspurpose()
|
rhsm.sync_syspurpose()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="Failed to synchronize syspurpose attributes: %s" % to_native(e))
|
module.fail_json(msg="Failed to synchronize syspurpose attributes: %s" % to_native(e))
|
||||||
if pool != '^$' or pool_ids:
|
if pool_ids:
|
||||||
try:
|
try:
|
||||||
if pool_ids:
|
result = rhsm.update_subscriptions_by_pool_ids(pool_ids)
|
||||||
result = rhsm.update_subscriptions_by_pool_ids(pool_ids)
|
|
||||||
else:
|
|
||||||
result = rhsm.update_subscriptions(pool)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="Failed to update subscriptions for '%s': %s" % (server_hostname, to_native(e)))
|
module.fail_json(msg="Failed to update subscriptions for '%s': %s" % (server_hostname, to_native(e)))
|
||||||
else:
|
else:
|
||||||
|
@ -1245,8 +1120,6 @@ def main():
|
||||||
rhsm.sync_syspurpose()
|
rhsm.sync_syspurpose()
|
||||||
if pool_ids:
|
if pool_ids:
|
||||||
subscribed_pool_ids = rhsm.subscribe_by_pool_ids(pool_ids)
|
subscribed_pool_ids = rhsm.subscribe_by_pool_ids(pool_ids)
|
||||||
elif pool != '^$':
|
|
||||||
subscribed_pool_ids = rhsm.subscribe(pool)
|
|
||||||
else:
|
else:
|
||||||
subscribed_pool_ids = []
|
subscribed_pool_ids = []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -36,11 +36,9 @@ options:
|
||||||
description:
|
description:
|
||||||
- If state is equal to present or disabled, indicates the desired
|
- If state is equal to present or disabled, indicates the desired
|
||||||
repository state.
|
repository state.
|
||||||
- |
|
- In community.general 10.0.0 the states V(present) and V(absent) have been
|
||||||
Please note that V(present) and V(absent) are deprecated, and will be
|
removed. Please use V(enabled) and V(disabled) instead.
|
||||||
removed in community.general 10.0.0; please use V(enabled) and
|
choices: [enabled, disabled]
|
||||||
V(disabled) instead.
|
|
||||||
choices: [present, enabled, absent, disabled]
|
|
||||||
default: "enabled"
|
default: "enabled"
|
||||||
type: str
|
type: str
|
||||||
name:
|
name:
|
||||||
|
@ -240,7 +238,7 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
name=dict(type='list', elements='str', required=True),
|
name=dict(type='list', elements='str', required=True),
|
||||||
state=dict(choices=['enabled', 'disabled', 'present', 'absent'], default='enabled'),
|
state=dict(choices=['enabled', 'disabled'], default='enabled'),
|
||||||
purge=dict(type='bool', default=False),
|
purge=dict(type='bool', default=False),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
|
@ -257,14 +255,6 @@ def main():
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
purge = module.params['purge']
|
purge = module.params['purge']
|
||||||
|
|
||||||
if state in ['present', 'absent']:
|
|
||||||
replacement = 'enabled' if state == 'present' else 'disabled'
|
|
||||||
module.deprecate(
|
|
||||||
'state=%s is deprecated; please use state=%s instead' % (state, replacement),
|
|
||||||
version='10.0.0',
|
|
||||||
collection_name='community.general',
|
|
||||||
)
|
|
||||||
|
|
||||||
repository_modify(module, rhsm, state, name, purge)
|
repository_modify(module, rhsm, state, name, purge)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,6 @@
|
||||||
api_token_id: "{{ api_token_id | default(omit) }}"
|
api_token_id: "{{ api_token_id | default(omit) }}"
|
||||||
api_token_secret: "{{ api_token_secret | default(omit) }}"
|
api_token_secret: "{{ api_token_secret | default(omit) }}"
|
||||||
validate_certs: "{{ validate_certs }}"
|
validate_certs: "{{ validate_certs }}"
|
||||||
proxmox_default_behavior: "no_defaults"
|
|
||||||
node: "{{ node }}"
|
node: "{{ node }}"
|
||||||
vmid: "{{ vmid }}"
|
vmid: "{{ vmid }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -432,73 +432,6 @@ TEST_CASES = [
|
||||||
'msg': "System successfully registered to 'None'."
|
'msg': "System successfully registered to 'None'."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
# Test of registration using username and password and attach to pool
|
|
||||||
[
|
|
||||||
{
|
|
||||||
'state': 'present',
|
|
||||||
'username': 'admin',
|
|
||||||
'password': 'admin',
|
|
||||||
'org_id': 'admin',
|
|
||||||
'pool': 'ff8080816b8e967f016b8e99632804a6'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'test_registeration_username_password_pool',
|
|
||||||
'run_command.calls': [
|
|
||||||
(
|
|
||||||
['/testbin/subscription-manager', 'identity'],
|
|
||||||
{'check_rc': False},
|
|
||||||
(1, 'This system is not yet registered.', '')
|
|
||||||
),
|
|
||||||
(
|
|
||||||
[
|
|
||||||
'/testbin/subscription-manager',
|
|
||||||
'register',
|
|
||||||
'--org', 'admin',
|
|
||||||
'--username', 'admin',
|
|
||||||
'--password', 'admin'
|
|
||||||
],
|
|
||||||
{'check_rc': True, 'expand_user_and_vars': False},
|
|
||||||
(0, '', '')
|
|
||||||
),
|
|
||||||
(
|
|
||||||
[
|
|
||||||
'subscription-manager list --available',
|
|
||||||
{'check_rc': True, 'environ_update': {'LANG': 'C', 'LC_ALL': 'C', 'LC_MESSAGES': 'C'}},
|
|
||||||
(0,
|
|
||||||
'''
|
|
||||||
+-------------------------------------------+
|
|
||||||
Available Subscriptions
|
|
||||||
+-------------------------------------------+
|
|
||||||
Subscription Name: SP Server Premium (S: Premium, U: Production, R: SP Server)
|
|
||||||
Provides: SP Server Bits
|
|
||||||
SKU: sp-server-prem-prod
|
|
||||||
Contract: 0
|
|
||||||
Pool ID: ff8080816b8e967f016b8e99632804a6
|
|
||||||
Provides Management: Yes
|
|
||||||
Available: 5
|
|
||||||
Suggested: 1
|
|
||||||
Service Type: L1-L3
|
|
||||||
Roles: SP Server
|
|
||||||
Service Level: Premium
|
|
||||||
Usage: Production
|
|
||||||
Add-ons:
|
|
||||||
Subscription Type: Standard
|
|
||||||
Starts: 06/25/19
|
|
||||||
Ends: 06/24/20
|
|
||||||
Entitlement Type: Physical
|
|
||||||
''', ''),
|
|
||||||
]
|
|
||||||
),
|
|
||||||
(
|
|
||||||
'subscription-manager attach --pool ff8080816b8e967f016b8e99632804a6',
|
|
||||||
{'check_rc': True},
|
|
||||||
(0, '', '')
|
|
||||||
)
|
|
||||||
],
|
|
||||||
'changed': True,
|
|
||||||
'msg': "System successfully registered to 'None'."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
# Test of registration using username and password and attach to pool ID and quantities
|
# Test of registration using username and password and attach to pool ID and quantities
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
@ -648,39 +648,6 @@ TEST_CASES = [
|
||||||
'repositories': REPOS.copy().disable('awesomeos-99000'),
|
'repositories': REPOS.copy().disable('awesomeos-99000'),
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
# disable an enabled repository (using state=absent)
|
|
||||||
[
|
|
||||||
{
|
|
||||||
'name': 'awesomeos-99000',
|
|
||||||
'state': 'absent',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': 'test_disable_single_using_absent',
|
|
||||||
'run_command.calls': [
|
|
||||||
(
|
|
||||||
[
|
|
||||||
'/testbin/subscription-manager',
|
|
||||||
'repos',
|
|
||||||
'--list',
|
|
||||||
],
|
|
||||||
SUBMAN_KWARGS,
|
|
||||||
(0, REPOS_LIST_OUTPUT, '')
|
|
||||||
),
|
|
||||||
(
|
|
||||||
[
|
|
||||||
'/testbin/subscription-manager',
|
|
||||||
'repos',
|
|
||||||
'--disable',
|
|
||||||
'awesomeos-99000',
|
|
||||||
],
|
|
||||||
SUBMAN_KWARGS,
|
|
||||||
(0, '', '')
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'changed': True,
|
|
||||||
'repositories': REPOS.copy().disable('awesomeos-99000'),
|
|
||||||
}
|
|
||||||
],
|
|
||||||
# disable an already disabled repository
|
# disable an already disabled repository
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue