summaryrefslogtreecommitdiffstats
path: root/roles/subscription-manager/pre_tasks/pre_tasks.yml
diff options
context:
space:
mode:
authorTomas Sedovic <tomas@sedovic.cz>2017-11-07 14:17:27 +1100
committerTomas Sedovic <tomas@sedovic.cz>2017-11-07 14:17:27 +1100
commit6f4d509817f200ec2a273a097f4f048da5997925 (patch)
treeebddc919d850ec5c4d308613661063b01ae89784 /roles/subscription-manager/pre_tasks/pre_tasks.yml
parent0cf8cf65a89ad7cac8c1cef1f743426b610adae0 (diff)
parent332f131e8e6457a03a4f1ab19abc8e4ceb897307 (diff)
downloadopenshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.gz
openshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.bz2
openshift-6f4d509817f200ec2a273a097f4f048da5997925.tar.xz
openshift-6f4d509817f200ec2a273a097f4f048da5997925.zip
Merge ../openshift-ansible-contrib into openstack-provider-githist
This moves all the OpenStack-related code from the -contrib[1] repo including its git history to openshift-ansible. It will then be moved around and updated to fit the rest of the project's structure. [1]: https://github.com/openshift/openshift-ansible-contrib
Diffstat (limited to 'roles/subscription-manager/pre_tasks/pre_tasks.yml')
-rw-r--r--roles/subscription-manager/pre_tasks/pre_tasks.yml45
1 files changed, 45 insertions, 0 deletions
diff --git a/roles/subscription-manager/pre_tasks/pre_tasks.yml b/roles/subscription-manager/pre_tasks/pre_tasks.yml
new file mode 100644
index 000000000..464670fc0
--- /dev/null
+++ b/roles/subscription-manager/pre_tasks/pre_tasks.yml
@@ -0,0 +1,45 @@
+---
+- name: "Set password fact"
+ set_fact:
+ rhsm_password: "{{ rhsm_password | default(None) }}"
+ no_log: true
+
+- name: "Initialize Subscription Manager fact"
+ set_fact:
+ rhsm_register: true
+
+- name: "Determine if Subscription Manager should be used"
+ set_fact:
+ rhsm_register: false
+ when:
+ - rhsm_satellite is undefined or rhsm_satellite is none or rhsm_satellite|trim == ''
+ - rhsm_username is undefined or rhsm_username is none or rhsm_username|trim == ''
+ - rhsm_password is undefined or rhsm_password is none or rhsm_password|trim == ''
+ - rhsm_org is undefined or rhsm_org is none or rhsm_org|trim == ''
+ - rhsm_activationkey is undefined or rhsm_activationkey is none or rhsm_activationkey|trim == ''
+ - rhsm_pool is undefined or rhsm_pool is none or rhsm_pool|trim == ''
+
+- name: "Validate Subscription Manager organization is set"
+ fail: msg="Cannot register to a Satellite server without a value for the Organization via 'rhsm_org'"
+ when:
+ - rhsm_org is undefined or rhsm_org is none or rhsm_org|trim == ''
+ - rhsm_satellite is defined
+ - rhsm_satellite is not none
+ - rhsm_satellite|trim != ''
+ - rhsm_register
+
+- name: "Validate Subscription Manager authentication is defined"
+ fail: msg="Cannot register without ('rhsm_username' and 'rhsm_password') or 'rhsm_activationkey' variables set. See the README.md for details on securely prompting for a password"
+ when:
+ - (rhsm_username is undefined or rhsm_username is none or rhsm_username|trim == '') or (rhsm_password is undefined or rhsm_password is none or rhsm_password|trim == '')
+ - rhsm_activationkey is undefined or rhsm_activationkey is none or rhsm_activationkey|trim == ''
+ - rhsm_register
+
+- name: "Validate activation key and Hosted are not requested together"
+ fail: msg="Cannot register to RHSM Hosted with 'rhsm_activationkey'"
+ when:
+ - rhsm_satellite is undefined or rhsm_satellite is none or rhsm_satellite|trim == ''
+ - rhsm_activationkey is defined
+ - rhsm_activationkey is not none
+ - rhsm_activationkey|trim != ''
+ - rhsm_register