93dbc5167d
The rhsm_repository is now part of the Ansible installation, however, the version used inside the redhat_subscription role contains changes the defaul module from Ansible doesn't contain. As a consequence, if in the playbook execution, some task makes use of the rhsm_repository module Ansible will locate it inside its default module libraries and when we get to the point of invoking the module from ansible-role-redhat-subscription/tasks/portal.yml it will find out that the module is already loaded and make use of the Ansible one, instead of the module stored under library/ rhsm_repository.py. This is a temporary solution until we'll update into Ansible 2.8 for queens and rocky, then both modules will be in sync and the one from ansible-role-redhat-subscription/library could be removed. Change-Id: Id53ebefff1f992781171a1e760fbf5306020cb56 Closes-Bug: #1833519
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
- block:
|
|
- import_tasks: register.yml
|
|
|
|
rescue:
|
|
- block:
|
|
- name: Manage Red Hat subscription (force)
|
|
redhat_subscription:
|
|
username: "{{ rhsm_username | default(omit) }}"
|
|
password: "{{ rhsm_password | default(omit) }}"
|
|
activationkey: "{{ rhsm_activation_key | default(omit) }}"
|
|
org_id: "{{ rhsm_org_id | default(omit) }}"
|
|
pool_ids: "{{ rhsm_pool_ids | default(omit) }}"
|
|
state: "{{ rhsm_state | default(omit) }}"
|
|
autosubscribe: "{{ rhsm_autosubscribe | default(omit) }}"
|
|
consumer_name: "{{ rhsm_consumer_hostname | default(omit) }}"
|
|
force_register: True
|
|
rhsm_baseurl: "{{ rhsm_baseurl | default(omit) }}"
|
|
register: subscrition_result
|
|
tags:
|
|
- rhsm
|
|
- rhsm_register
|
|
|
|
rescue:
|
|
- name: Clean all local subscription data
|
|
command: subscription-manager clean
|
|
|
|
- import_tasks: register.yml
|
|
|
|
- name: Configure repository subscriptions
|
|
# TODO(jfrancoa): Change back into rhsm_repository once
|
|
# we start using Ansible 2.8.
|
|
rhsm_repository_conf:
|
|
name: "{{ rhsm_repos }}"
|
|
purge: "{{ rhsm_repos_purge | default(omit) }}"
|
|
state: "{{ rhsm_repos_state | default(omit) }}"
|
|
when:
|
|
- rhsm_repos | length > 0
|
|
- rhsm_state == 'present'
|
|
- rhsm_activation_key is not defined or rhsm_method == 'portal'
|
|
tags:
|
|
- rhsm
|
|
- rhsm_repos
|