From e05e4d3d4fab4eaf462a23f5d5ee39fb57f4f0a0 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Wed, 29 Nov 2017 11:31:25 +0100 Subject: Fix syntax error caused by an extra paren --- roles/rhel_subscribe/tasks/enterprise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml index fa74c9953..796722d89 100644 --- a/roles/rhel_subscribe/tasks/enterprise.yml +++ b/roles/rhel_subscribe/tasks/enterprise.yml @@ -13,7 +13,7 @@ msg: "{{ ose_version }} is not a valid version for {{ deployment_type }} deployment type" when: - deployment_type == 'openshift-enterprise' - - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6'] ) + - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6'] - name: Enable RHEL repositories command: subscription-manager repos \ -- cgit v1.2.3 From 691179281336dcd56d17b70cdf4067a142238b83 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Wed, 29 Nov 2017 11:33:10 +0100 Subject: Fix the env lookup fallback in rhel_subscribe The role is looking for the usernames, passwords, etc. first in the shell environment and then in the Ansible vars. When the environment is empty, however, the lookup returns an empty string not an undefined variable, so the `default` fallback is never used and the ansible variables end up being ignored. By adding `True` to the end of the filter, it will work with any falsey value (including an empty string) not just undefined variables. --- roles/rhel_subscribe/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml index b06f51908..5867f0207 100644 --- a/roles/rhel_subscribe/tasks/main.yml +++ b/roles/rhel_subscribe/tasks/main.yml @@ -4,10 +4,10 @@ # to make it able to enable repositories - set_fact: - rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*')) }}" - rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True)) }}" - rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True)) }}" - rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True)) }}" + rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*'), True) }}" + rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True), True) }}" + rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True), True) }}" + rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True), True) }}" - fail: msg: "This role is only supported for Red Hat hosts" -- cgit v1.2.3 From 1c0c502988b0f1d014e5cba7f789d344c56f2d1b Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Wed, 29 Nov 2017 11:38:04 +0100 Subject: Optionally subscribe OpenStack RHEL nodes --- .../openstack/openshift-cluster/provision.yml | 10 +++++++++ .../openstack/sample-inventory/group_vars/all.yml | 25 ++++------------------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/playbooks/openstack/openshift-cluster/provision.yml b/playbooks/openstack/openshift-cluster/provision.yml index 36d8c8215..1d2680252 100644 --- a/playbooks/openstack/openshift-cluster/provision.yml +++ b/playbooks/openstack/openshift-cluster/provision.yml @@ -26,6 +26,9 @@ - name: Gather facts for the new nodes setup: +- name: set common facts + include: ../../init/facts.yml + # NOTE(shadower): the (internal) DNS must be functional at this point!! # That will have happened in provision.yml if nsupdate was configured. @@ -47,6 +50,13 @@ hosts: oo_all_hosts become: yes gather_facts: yes + roles: + - role: rhel_subscribe + when: + - ansible_distribution == "RedHat" + - lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(False, True), True) + - lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(False, True), True) + tasks: - name: Install dependencies include_role: diff --git a/playbooks/openstack/sample-inventory/group_vars/all.yml b/playbooks/openstack/sample-inventory/group_vars/all.yml index 921edb867..1019a6b3e 100644 --- a/playbooks/openstack/sample-inventory/group_vars/all.yml +++ b/playbooks/openstack/sample-inventory/group_vars/all.yml @@ -86,27 +86,10 @@ openshift_openstack_docker_volume_size: "15" openshift_openstack_subnet_prefix: "192.168.99" -## Red Hat subscription defaults to false which means we will not attempt to -## subscribe the nodes -#rhsm_register: False - -# # Using Red Hat Satellite: -#rhsm_register: True -#rhsm_satellite: 'sat-6.example.com' -#rhsm_org: 'OPENSHIFT_ORG' -#rhsm_activationkey: '' - -# # Or using RHN username, password and optionally pool: -#rhsm_register: True -#rhsm_username: '' -#rhsm_password: '' -#rhsm_pool: '' - -#rhsm_repos: -# - "rhel-7-server-rpms" -# - "rhel-7-server-ose-3.5-rpms" -# - "rhel-7-server-extras-rpms" -# - "rhel-7-fast-datapath-rpms" +## Red Hat subscription: +#rhsub_user: '' +#rhsub_pass: '' +#rhsub_pool: '' # # Roll-your-own DNS -- cgit v1.2.3 From 576e06f6d531eccafe1b3586e2c521c52706c1ec Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Fri, 1 Dec 2017 12:20:43 +0100 Subject: Revert "Fix the env lookup fallback in rhel_subscribe" The rhel_subscribe role fixes will be done in a separate pull request. This reverts commit 691179281336dcd56d17b70cdf4067a142238b83. --- roles/rhel_subscribe/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml index 5867f0207..b06f51908 100644 --- a/roles/rhel_subscribe/tasks/main.yml +++ b/roles/rhel_subscribe/tasks/main.yml @@ -4,10 +4,10 @@ # to make it able to enable repositories - set_fact: - rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*'), True) }}" - rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True), True) }}" - rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True), True) }}" - rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True), True) }}" + rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*')) }}" + rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True)) }}" + rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True)) }}" + rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True)) }}" - fail: msg: "This role is only supported for Red Hat hosts" -- cgit v1.2.3 From cbb252e64b9f4668e13512320ef943ef40a72d95 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Fri, 1 Dec 2017 12:21:32 +0100 Subject: Revert "Fix syntax error caused by an extra paren" The rhel_subscribe fixes will be done in a separate pull request. This reverts commit e05e4d3d4fab4eaf462a23f5d5ee39fb57f4f0a0. --- roles/rhel_subscribe/tasks/enterprise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml index 796722d89..fa74c9953 100644 --- a/roles/rhel_subscribe/tasks/enterprise.yml +++ b/roles/rhel_subscribe/tasks/enterprise.yml @@ -13,7 +13,7 @@ msg: "{{ ose_version }} is not a valid version for {{ deployment_type }} deployment type" when: - deployment_type == 'openshift-enterprise' - - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6'] + - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6'] ) - name: Enable RHEL repositories command: subscription-manager repos \ -- cgit v1.2.3 From bd2335ff8110f507b353fabc40b4a5e0316fc3cb Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Fri, 1 Dec 2017 12:23:59 +0100 Subject: Remove shell environment lookup --- playbooks/openstack/openshift-cluster/provision.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/openstack/openshift-cluster/provision.yml b/playbooks/openstack/openshift-cluster/provision.yml index 1d2680252..17357a8db 100644 --- a/playbooks/openstack/openshift-cluster/provision.yml +++ b/playbooks/openstack/openshift-cluster/provision.yml @@ -54,8 +54,8 @@ - role: rhel_subscribe when: - ansible_distribution == "RedHat" - - lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(False, True), True) - - lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(False, True), True) + - rhsub_user | default(False) + - rhsub_pass | default(False) tasks: - name: Install dependencies -- cgit v1.2.3