summaryrefslogtreecommitdiffstats
path: root/roles/subscription-manager/tasks/main.yml
diff options
context:
space:
mode:
authorVinny Valdez <vvaldez@redhat.com>2016-03-30 15:46:31 -0500
committerVinny Valdez <vvaldez@redhat.com>2016-04-20 09:28:48 -0500
commit177950b76a185c20317aa0e89d356cdf8b97c4c3 (patch)
tree876ab46e2daaba35adf64e47bbcb727b6bf30f8a /roles/subscription-manager/tasks/main.yml
parent80c3d3332507fe620fcab99e65f2ffd81d48a69e (diff)
downloadopenshift-177950b76a185c20317aa0e89d356cdf8b97c4c3.tar.gz
openshift-177950b76a185c20317aa0e89d356cdf8b97c4c3.tar.bz2
openshift-177950b76a185c20317aa0e89d356cdf8b97c4c3.tar.xz
openshift-177950b76a185c20317aa0e89d356cdf8b97c4c3.zip
Refactor role to dynamically determine rhsm_method
* Removes rhsm_method * Renames rhsm_server to rhsm_satellite * Add additional pre_task checks (hosted + key) * Change conditionals from rhsm_method check to rhsm_satellite defined * Change repos disable/enable from key to if repos are defined * Update README and examples in inventory file
Diffstat (limited to 'roles/subscription-manager/tasks/main.yml')
-rw-r--r--roles/subscription-manager/tasks/main.yml20
1 files changed, 14 insertions, 6 deletions
diff --git a/roles/subscription-manager/tasks/main.yml b/roles/subscription-manager/tasks/main.yml
index 2e04a7a22..78ceaccd1 100644
--- a/roles/subscription-manager/tasks/main.yml
+++ b/roles/subscription-manager/tasks/main.yml
@@ -32,7 +32,7 @@
changed_when: no
register: check_if_registered
-- name: Set registration fact
+- name: Set registration fact if system is already registered
set_fact:
registered: true
when: check_if_registered.rc == 0
@@ -44,17 +44,21 @@
- rhsm_authentication is defined
- name: Install Satellite certificate
- command: "rpm -Uvh --force http://{{ rhsm_server }}/pub/katello-ca-consumer-latest.noarch.rpm"
+ command: "rpm -Uvh --force http://{{ rhsm_satellite }}/pub/katello-ca-consumer-latest.noarch.rpm"
when:
- not registered
- - rhsm_method == 'satellite'
+ - rhsm_satellite is defined
+ - rhsm_satellite is not none
+ - rhsm_satellite|trim != ''
- name: Register to Satellite using activation key
command: "/usr/bin/subscription-manager register --activationkey={{ rhsm_activationkey }} --org={{ rhsm_org }}"
when:
- not registered
- rhsm_authentication == 'key'
- - rhsm_method == 'satellite'
+ - rhsm_satellite is defined
+ - rhsm_satellite is not none
+ - rhsm_satellite|trim != ''
# This can apply to either Hosted or Satellite
- name: Register using username and password
@@ -80,14 +84,18 @@
command: "/usr/bin/subscription-manager repos --disable=*"
when:
- not registered
- - not rhsm_authentication == "key"
+ - rhsm_repos is defined
+ - rhsm_repos is not none
+ - rhsm_repos|trim != ''
- name: Enable specified repositories
command: "/usr/bin/subscription-manager repos --enable={{ item }}"
with_items: rhsm_repos
when:
- not registered
- - not rhsm_authentication == "key"
+ - rhsm_repos is defined
+ - rhsm_repos is not none
+ - rhsm_repos|trim != ''
- name: Cleaning yum repositories
command: "yum clean all"