MAS DevOps Ansible Collection Ansible CLI
Edit on GitHub
Home Ansible Automation Platform OCP Install Cloud Pak For Data Install Core Add AIBroker Add IoT Add Manage Add Monitor Add Optimizer Add Predict Add Visual Inspection Update Upgrade Uninstall Core Backup & Restore ocp_cluster_monitoring ocp_config ocp_deprovision ocp_efs ocp_github_oauth ocp_login ocp_node_config ocp_provision ocp_roks_upgrade_registry_storage ocp_upgrade ocp_verify appconnect aws_bucket_access_point aws_documentdb_user aws_policy aws_route53 aws_user_creation aws_vpc cert_manager cis common-services configure_manage_eventstreams cos cos_bucket cp4d_admin_pwd_update cp4d cp4d_service db2 dro eck grafana ibm_catalogs kafka nvidia_gpu mongodb ocs sls turbonomic uds mirror_case_prepare mirror_extras_prepare mirror_images mirror_ocp ocp_idms ocp_simulate_disconnected_network registry suite_app_config suite_app_install suite_app_uninstall suite_app_upgrade suite_app_rollback suite_app_backup_restore suite_certs suite_config suite_db2_setup_for_manage suite_dns suite_install suite_manage_attachments_config suite_manage_birt_report_config suite_manage_bim_config suite_manage_customer_files_config suite_manage_imagestitching_config suite_manage_import_certs_config suite_manage_load_dbc_scripts suite_manage_logging_config suite_manage_pvc_config suite_uninstall suite_upgrade suite_rollback suite_verify suite_backup_restore ansible_version_check entitlement_key_rotation gencfg_jdbc gencfg_watsonstudio gencfg_workspace gencfg_mongo

entitlement_key_rotation¤

This role creates/updates the entitlement username and password that are stored in the secrets used to pull images throughout all MAS related namespaces for one or multiple clusters.

The main secret that is updated by this role is the ibm-entitlement which holds the credentials needed to pull the MAS images used by MAS Core or the MAS applications.

By default, this role will search for all MAS related namespaces that might contain the secret that holds the entitlement key to be updated.

The list of namespaces to be updated with new username/password credentials are:

Note This role uses ocp_login to login into the target clusters, therefore make sure you export the corresponding environment variables accordingly to the cluster type you want to target.

Role Variables¤

artifactory_username¤

artifactory_token¤

mas_entitlement_username¤

mas_entitlement_key¤

cluster_name¤

sls_namespace¤

Role Variables - Advanced mode¤

Use the following variables to change the default behavior of this role to only rotate the entitlement key for specific clusters or namespaces, instead of running it for all MAS related namespaces.

mas_clusters_entitlement_key_rotation_list¤

mas_namespaces_entitlement_key_rotation_list¤

Example Playbook¤

Rotate entitlement credentials across all MAS instances for a given target cluster:

- hosts: localhost
  any_errors_fatal: true
  vars:
    cluster_name: "{{ lookup('env', 'CLUSTER_NAME') }}"
    cluster_type: "{{ lookup('env', 'CLUSTER_TYPE') }}"
    ibmcloud_apikey: "{{ lookup('env', 'IBMCLOUD_APIKEY') }}"
    artifactory_username: "{{ lookup('env', 'ARTIFACTORY_USERNAME') }}"
    artifactory_token: "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"
    mas_entitlement_username: "{{ lookup('env', 'MAS_ENTITLEMENT_USERNAME') }}"
    mas_entitlement_key: "{{ lookup('env', 'MAS_ENTITLEMENT_KEY') }}"
  roles:
    - ibm.mas_devops.entitlement_key_rotation

Rotate entitlement credentials across a specific list of namespaces, targeting multiple clusters:

- hosts: localhost
  any_errors_fatal: true
  vars:
    cluster_name: "{{ lookup('env', 'CLUSTER_NAME') }}" # this is the original cluster that will keep the login session context at the end of the rotation loop.
    cluster_type: "{{ lookup('env', 'CLUSTER_TYPE') }}"
    ibmcloud_apikey: "{{ lookup('env', 'IBMCLOUD_APIKEY') }}"
    artifactory_username: "{{ lookup('env', 'ARTIFACTORY_USERNAME') }}"
    artifactory_token: "{{ lookup('env', 'ARTIFACTORY_TOKEN') }}"
    mas_entitlement_username: "{{ lookup('env', 'MAS_ENTITLEMENT_USERNAME') }}"
    mas_entitlement_key: "{{ lookup('env', 'MAS_ENTITLEMENT_KEY') }}"
    mas_clusters_entitlement_key_rotation_list: "{{ lookup('env', 'MAS_CLUSTERS_ENTITLEMENT_KEY_ROTATION_LIST') }}"
    mas_namespaces_entitlement_key_rotation_list: "{{ lookup('env', 'MAS_NAMESPACES_ENTITLEMENT_KEY_ROTATION_LIST') }}"

  roles:
    - ibm.mas_devops.entitlement_key_rotation

License¤

EPL-2.0