oracle.oci.oci_os_management_managed_instance_actions – Perform actions on a ManagedInstance resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_os_management_managed_instance_actions.

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a ManagedInstance resource in Oracle Cloud Infrastructure

  • For action=attach_child_software_source, adds a child software source to a managed instance. After the software source has been added, then packages from that software source can be installed on the managed instance.

  • For action=attach_parent_software_source, adds a parent software source to a managed instance. After the software source has been added, then packages from that software source can be installed on the managed instance. Software sources that have this software source as a parent will be able to be added to this managed instance.

  • For action=detach_child_software_source, removes a child software source from a managed instance. Packages will no longer be able to be installed from these software sources.

  • For action=detach_parent_software_source, removes a software source from a managed instance. All child software sources will also be removed from the managed instance. Packages will no longer be able to be installed from these software sources.

  • For action=disable_module_stream, disables a module stream on a managed instance. After the stream is disabled, it is no longer possible to install the profiles that are contained by the stream. All installed profiles must be removed prior to disabling a module stream.

  • For action=enable_module_stream, enables a module stream on a managed instance. After the stream is enabled, it is possible to install the profiles that are contained by the stream. Enabling a stream that is already enabled will succeed. Attempting to enable a different stream for a module that already has a stream enabled results in an error.

  • For action=install_all_package_updates, install all of the available package updates for the managed instance.

  • For action=install_all_windows_updates, install all of the available Windows updates for the managed instance.

  • For action=install_module_stream_profile, installs a profile for an module stream. The stream must be enabled before a profile can be installed. If a module stream defines multiple profiles, each one can be installed independently.

  • For action=install_package, installs a package on a managed instance.

  • For action=install_package_update, updates a package on a managed instance.

  • For action=install_windows_update, installs a Windows update on a managed instance.

  • For action=manage_module_streams, perform an operation involving modules, streams, and profiles on a managed instance. Each operation may enable or disable an arbitrary amount of module streams, and install or remove an arbitrary number of module stream profiles. When the operation is complete, the state of the modules, streams, and profiles on the managed instance will match the state indicated in the operation. Each module stream specified in the list of module streams to enable will be in the “ENABLED” state upon completion of the operation. If there was already a stream of that module enabled, any work required to switch from the current stream to the new stream is performed implicitly. Each module stream specified in the list of module streams to disable will be in the “DISABLED” state upon completion of the operation. Any profiles that are installed for the module stream will be removed as part of the operation. Each module stream profile specified in the list of profiles to install will be in the “INSTALLED” state upon completion of the operation, indicating that any packages that are part of the profile are installed on the managed instance. If the module stream containing the profile is not enabled, it will be enabled as part of the operation. There is an exception when attempting to install a stream of a profile when another stream of the same module is enabled. It is an error to attempt to install a profile of another module stream, unless enabling the new module stream is explicitly included in this operation. Each module stream profile specified in the list of profiles to remove will be in the “AVAILABLE” state upon completion of the operation. The status of packages within the profile after the operation is complete is defined by the package manager on the managed instance. Operations that contain one or more elements that are not allowed are rejected. The result of this request is a WorkRequest object. The returned WorkRequest is the parent of a structure of other WorkRequests. Taken as a whole, this structure indicates the entire set of work to be performed to complete the operation. This interface can also be used to perform a dry run of the operation rather than committing it to a managed instance. If a dry run is requested, the OS Management Service will evaluate the operation against the current module, stream, and profile state on the managed instance. It will calculate the impact of the operation on all modules, streams, and profiles on the managed instance, including those that are implicitly impacted by the operation. The WorkRequest resulting from a dry run behaves differently than a WorkRequest resulting from a committable operation. Dry run WorkRequests are always singletons and never have children. The impact of the operation is returned using the log and error facilities of WorkRequests. The impact of operations that are allowed by the OS Management Service are communicated as one or more work request log entries. Operations that are not allowed by the OS Management Service are communicated as one or more work requst error entries. Each entry, for either logs or errors, contains a structured message containing the results of one or more operations.

  • For action=remove_module_stream_profile, removes a profile for a module stream that is installed on a managed instance. If a module stream is provided, rather than a fully qualified profile, all profiles that have been installed for the module stream will be removed.

  • For action=remove_package, removes an installed package from a managed instance.

  • For action=switch_module_stream, enables a new stream for a module that already has a stream enabled. If any profiles or packages from the original module are installed, switching to a new stream will remove the existing packages and install their counterparts in the new stream.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • attach_child_software_source
  • attach_parent_software_source
  • detach_child_software_source
  • detach_parent_software_source
  • disable_module_stream
  • enable_module_stream
  • install_all_package_updates
  • install_all_windows_updates
  • install_module_stream_profile
  • install_package
  • install_package_update
  • install_windows_update
  • manage_module_streams
  • remove_module_stream_profile
  • remove_package
  • switch_module_stream
The action to perform on the ManagedInstance.
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
disable
list / elements=dictionary
The set of module streams to disable.
Applicable only for action=manage_module_streams.
module_name
string / required
The name of a module
stream_name
string / required
The name of a stream of the specified module
enable
list / elements=dictionary
The set of module streams to enable.
Applicable only for action=manage_module_streams.
module_name
string / required
The name of a module
stream_name
string / required
The name of a stream of the specified module
install
list / elements=dictionary
The set of module stream profiles to install.
Applicable only for action=manage_module_streams.
module_name
string / required
The name of a module
profile_name
string / required
The name of a profile of the specified module stream
stream_name
string / required
The name of a stream of the specified module
is_dry_run
boolean
    Choices:
  • no
  • yes
Indicates if this operation is a dry run or if the operation should be commited. If set to true, the result of the operation will be evaluated but not committed. If set to false, the operation is committed to the managed instance. The default is false.
Applicable only for action=manage_module_streams.
managed_instance_id
string / required
OCID for the managed instance

aliases: id
module_name
string
The name of a module.
Required for action=disable_module_stream, action=enable_module_stream, action=install_module_stream_profile, action=remove_module_stream_profile, action=switch_module_stream.
profile_name
string
The name of the profile of the containing module stream
Applicable only for action=install_module_stream_profileaction=remove_module_stream_profile.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
remove
list / elements=dictionary
The set of module stream profiles to remove.
Applicable only for action=manage_module_streams.
module_name
string / required
The name of a module
profile_name
string / required
The name of a profile of the specified module stream
stream_name
string / required
The name of a stream of the specified module
software_package_name
string
Package name
Required for action=install_package, action=install_package_update, action=remove_package.
software_source_id
string
OCID for the Software Source
Required for action=attach_child_software_source, action=attach_parent_software_source, action=detach_child_software_source, action=detach_parent_software_source.
stream_name
string
The name of the stream of the containing module. This parameter is required if a profileName is specified.
Applicable only for action=disable_module_streamaction=enable_module_streamaction=install_module_stream_profileaction=remove_module_str eam_profileaction=switch_module_stream.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
update_type
string
    Choices:
  • SECURITY
  • BUGFIX
  • ENHANCEMENT
  • OTHER
  • KSPLICE
  • ALL
The type of updates to be applied
Applicable only for action=install_all_package_updatesaction=install_all_windows_updates.
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.
windows_update_name
string
Unique identifier for the Windows update. NOTE - This is not an OCID, but is a unique identifier assigned by Microsoft. Example: `6981d463-cd91-4a26-b7c4-ea4ded9183ed`
Required for action=install_windows_update.

Examples

- name: Perform action attach_child_software_source on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_source_id: "ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx"
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: attach_child_software_source

- name: Perform action attach_parent_software_source on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_source_id: "ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx"
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: attach_parent_software_source

- name: Perform action detach_child_software_source on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_source_id: "ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx"
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: detach_child_software_source

- name: Perform action detach_parent_software_source on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_source_id: "ocid1.softwaresource.oc1..xxxxxxEXAMPLExxxxxx"
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: detach_parent_software_source

- name: Perform action disable_module_stream on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    module_name: module_name_example
    action: disable_module_stream

    # optional
    stream_name: stream_name_example

- name: Perform action enable_module_stream on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    module_name: module_name_example
    action: enable_module_stream

    # optional
    stream_name: stream_name_example

- name: Perform action install_all_package_updates on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: install_all_package_updates

    # optional
    update_type: SECURITY

- name: Perform action install_all_windows_updates on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: install_all_windows_updates

    # optional
    update_type: SECURITY

- name: Perform action install_module_stream_profile on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    module_name: module_name_example
    action: install_module_stream_profile

    # optional
    profile_name: profile_name_example
    stream_name: stream_name_example

- name: Perform action install_package on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_package_name: software_package_name_example
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: install_package

- name: Perform action install_package_update on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_package_name: software_package_name_example
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: install_package_update

- name: Perform action install_windows_update on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    windows_update_name: windows_update_name_example
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: install_windows_update

- name: Perform action manage_module_streams on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: manage_module_streams

    # optional
    is_dry_run: true
    enable:
    - # required
      module_name: module_name_example
      stream_name: stream_name_example
    disable:
    - # required
      module_name: module_name_example
      stream_name: stream_name_example
    install:
    - # required
      module_name: module_name_example
      stream_name: stream_name_example
      profile_name: profile_name_example
    remove:
    - # required
      module_name: module_name_example
      stream_name: stream_name_example
      profile_name: profile_name_example

- name: Perform action remove_module_stream_profile on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    module_name: module_name_example
    action: remove_module_stream_profile

    # optional
    profile_name: profile_name_example
    stream_name: stream_name_example

- name: Perform action remove_package on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    software_package_name: software_package_name_example
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    action: remove_package

- name: Perform action switch_module_stream on managed_instance
  oci_os_management_managed_instance_actions:
    # required
    managed_instance_id: "ocid1.managedinstance.oc1..xxxxxxEXAMPLExxxxxx"
    module_name: module_name_example
    action: switch_module_stream

    # optional
    stream_name: stream_name_example

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
managed_instance
complex
on success
Details of the ManagedInstance resource acted upon by the current operation

Sample:
{'autonomous': {'is_auto_update_enabled': True}, 'bug_updates_available': 56, 'child_software_sources': [{'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'name': 'name_example'}], 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'description': 'description_example', 'display_name': 'display_name_example', 'enhancement_updates_available': 56, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_data_collection_authorized': True, 'is_reboot_required': True, 'ksplice_effective_kernel_version': 'ksplice_effective_kernel_version_example', 'last_boot': 'last_boot_example', 'last_checkin': 'last_checkin_example', 'managed_instance_groups': [{'display_name': 'display_name_example', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx'}], 'notification_topic_id': 'ocid1.notificationtopic.oc1..xxxxxxEXAMPLExxxxxx', 'os_family': 'LINUX', 'os_kernel_version': 'os_kernel_version_example', 'os_name': 'os_name_example', 'os_version': 'os_version_example', 'other_updates_available': 56, 'parent_software_source': {'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'name': 'name_example'}, 'scheduled_job_count': 56, 'security_updates_available': 56, 'status': 'NORMAL', 'updates_available': 56, 'work_request_count': 56}
 
autonomous
complex
on success
if present, indicates the Managed Instance is an autonomous instance. Holds all the Autonomous specific information

   
is_auto_update_enabled
boolean
on success
True if daily updates are enabled

Sample:
True
 
bug_updates_available
integer
on success
Number of bug fix type updates available to be installed

Sample:
56
 
child_software_sources
complex
on success
list of child Software Sources attached to the Managed Instance

   
id
string
on success
software source identifier

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
   
name
string
on success
software source name

Sample:
name_example
 
compartment_id
string
on success
OCID for the Compartment

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
description
string
on success
Information specified by the user about the managed instance

Sample:
description_example
 
display_name
string
on success
Managed Instance identifier

Sample:
display_name_example
 
enhancement_updates_available
integer
on success
Number of enhancement type updates available to be installed

Sample:
56
 
id
string
on success
OCID for the managed instance

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_data_collection_authorized
boolean
on success
True if user allow data collection for this instance

Sample:
True
 
is_reboot_required
boolean
on success
Indicates whether a reboot is required to complete installation of updates.

Sample:
True
 
ksplice_effective_kernel_version
string
on success
The ksplice effective kernel version

Sample:
ksplice_effective_kernel_version_example
 
last_boot
string
on success
Time at which the instance last booted

Sample:
last_boot_example
 
last_checkin
string
on success
Time at which the instance last checked in

Sample:
last_checkin_example
 
managed_instance_groups
complex
on success
The ids of the managed instance groups of which this instance is a member.

   
display_name
string
on success
User friendly name

Sample:
display_name_example
   
id
string
on success
unique identifier that is immutable on creation

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
notification_topic_id
string
on success
OCID of the ONS topic used to send notification to users

Sample:
ocid1.notificationtopic.oc1..xxxxxxEXAMPLExxxxxx
 
os_family
string
on success
The Operating System type of the managed instance.

Sample:
LINUX
 
os_kernel_version
string
on success
Operating System Kernel Version

Sample:
os_kernel_version_example
 
os_name
string
on success
Operating System Name

Sample:
os_name_example
 
os_version
string
on success
Operating System Version

Sample:
os_version_example
 
other_updates_available
integer
on success
Number of non-classified updates available to be installed

Sample:
56
 
parent_software_source
complex
on success
the parent (base) Software Source attached to the Managed Instance

   
id
string
on success
software source identifier

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
   
name
string
on success
software source name

Sample:
name_example
 
scheduled_job_count
integer
on success
Number of scheduled jobs associated with this instance

Sample:
56
 
security_updates_available
integer
on success
Number of security type updates available to be installed

Sample:
56
 
status
string
on success
status of the managed instance.

Sample:
NORMAL
 
updates_available
integer
on success
Number of updates available to be installed

Sample:
56
 
work_request_count
integer
on success
Number of work requests associated with this instance

Sample:
56


Authors

  • Oracle (@oracle)