Bug 1633571 - Openshift-on-Openstack uninstall playbook failure in Remove RedHat subscriptions task
Summary: Openshift-on-Openstack uninstall playbook failure in Remove RedHat subscripti...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.10.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.10.z
Assignee: Jon Uriarte
QA Contact: Jon Uriarte
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-27 10:11 UTC by Jon Uriarte
Modified: 2018-11-11 16:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Remove an extra blank space in OpenStack uninstall playbook, which was causing the playbook to fail.
Clone Of:
Environment:
Last Closed: 2018-11-11 16:39:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:2709 0 None None None 2018-11-11 16:40:16 UTC

Description Jon Uriarte 2018-09-27 10:11:04 UTC
Description of problem:

There is a typo (an additional blank space) in openshift-ansible/playbooks/openstack/openshift-cluster/uninstall.yml playbook,
which makes the playbook fail when executed.

- name: Unsubscribe RHEL instances                                              
  hosts: oo_all_hosts                                                           
  become: yes                                                                   
  gather_facts: yes                                                             
  tasks:                                                                        
  - name: Unsubscribe RHEL instances                                            
    import_role:                                                                
      name: rhel_unsubscribe                                                    
    when:                                                                       
    - ansible_distribution == "RedHat"                                                                                                                                                                             
     - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is defined and rhsub_orgid is defined)    <---

   /\
   |

Version-Release number of the following components:

$ rpm -q openshift-ansible
openshift-ansible-3.10.51-1.git.0.44a646c.el7.noarch

$ rpm -q ansible
ansible-2.4.6.0-1.el7ae.noarch

$ ansible --version
ansible 2.4.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/cloud-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

How reproducible: always

Steps to Reproduce:
1. Install OSP 13
2. Install OCP 3.10.51-1 with openshift-ansible playbooks
3. Uninstall OCP:
     ansible-playbook --user openshift -i "/usr/share/ansible/openshift-ansible/playbooks/openstack/inventory.py" -i inventory "/usr/share/ansible/openshift-ansible/playbooks/openstack/openshift-cluster/uninstall.yml"

Actual results:

TASK [rhel_unsubscribe : Remove RedHat subscriptions] *************************************************************************************************************************************************************
fatal: [master-0.openshift.example.com]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is defined
and rhsub_orgid is defined)' failed. The error was: Unexpected templating type error occurred on ({% if ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is defi
ned and rhsub_orgid is defined) %} True {% else %} False {% endif %}): unsupported operand type(s) for -: 'str' and 'bool'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/rhel_un
subscribe/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Remove RedHat subscriptions\n  ^ here\n"
}
fatal: [app-node-0.openshift.example.com]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is define
d and rhsub_orgid is defined)' failed. The error was: Unexpected templating type error occurred on ({% if ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is de
fined and rhsub_orgid is defined) %} True {% else %} False {% endif %}): unsupported operand type(s) for -: 'str' and 'bool'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/rhel_
unsubscribe/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Remove RedHat subscriptions\n  ^ here\
n"}
fatal: [app-node-1.openshift.example.com]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is define
d and rhsub_orgid is defined)' failed. The error was: Unexpected templating type error occurred on ({% if ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is de
fined and rhsub_orgid is defined) %} True {% else %} False {% endif %}): unsupported operand type(s) for -: 'str' and 'bool'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/rhel_
unsubscribe/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Remove RedHat subscriptions\n  ^ here\
n"}
fatal: [infra-node-0.openshift.example.com]: FAILED! => {"failed": true, "msg": "The conditional check 'ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is defi
ned and rhsub_orgid is defined)' failed. The error was: Unexpected templating type error occurred on ({% if ansible_distribution == \"RedHat\" - (rhsub_user is defined and rhsub_pass is defined) or (rhsub_ak is
defined and rhsub_orgid is defined) %} True {% else %} False {% endif %}): unsupported operand type(s) for -: 'str' and 'bool'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/rhe
l_unsubscribe/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Remove RedHat subscriptions\n  ^ her
e\n"}

PLAY RECAP ********************************************************************************************************************************************************************************************************
app-node-0.openshift.example.com : ok=1    changed=0    unreachable=0    failed=1
app-node-1.openshift.example.com : ok=1    changed=0    unreachable=0    failed=1
infra-node-0.openshift.example.com : ok=1    changed=0    unreachable=0    failed=1
localhost                  : ok=11   changed=0    unreachable=0    failed=0
master-0.openshift.example.com : ok=1    changed=0    unreachable=0    failed=1


Expected results: Successful uninstall

Comment 1 Jon Uriarte 2018-09-27 10:15:49 UTC
Created PR in release-3.10: https://github.com/openshift/openshift-ansible/pull/10246

Comment 4 Jon Uriarte 2018-10-23 08:39:02 UTC
Verified in openshift-ansible-3.10.59-1.git.0.f9ba890.el7.noarch on OSP 13 2018-10-02.1 puddle.

Verification steps:

1. Install OSP 13
2. Install OCP 3.10.59-1 with openshift-ansible playbooks
3. Check OCP cluster is deployed

$ openstack server list
+--------------------------------------+------------------------------------+--------+------------------------------------------------------------------------+----------+-----------+
| ID                                   | Name                               | Status | Networks                                                               | Image    | Flavor    |
+--------------------------------------+------------------------------------+--------+------------------------------------------------------------------------+----------+-----------+
| a108c236-1a5c-4926-985f-7acda49e0512 | master-0.openshift.example.com     | ACTIVE | openshift-ansible-openshift.example.com-net=192.168.99.14, 10.46.23.55 | rhel-7.5 | m1.master |
| 25ec8f05-63ca-4acd-8ace-cf80a2735319 | infra-node-0.openshift.example.com | ACTIVE | openshift-ansible-openshift.example.com-net=192.168.99.5, 10.46.23.46  | rhel-7.5 | m1.node   |
| 8c5a3c5d-9348-476a-b2ae-eb2192c8b6a4 | app-node-0.openshift.example.com   | ACTIVE | openshift-ansible-openshift.example.com-net=192.168.99.10, 10.46.23.45 | rhel-7.5 | m1.node   |
| 5d09e8ca-e805-4a7f-b0fd-b4333bab43bb | app-node-1.openshift.example.com   | ACTIVE | openshift-ansible-openshift.example.com-net=192.168.99.13, 10.46.23.49 | rhel-7.5 | m1.node   |
| 3400260a-aa53-48e9-b9d9-7288dc76ce3e | ansible_host-0                     | ACTIVE | private_openshift=172.16.40.3, 10.46.23.52                             | rhel-7.5 | m1.small  |
| dc63df8f-0916-4213-9459-b4b8d42517f0 | openshift_dns-0                    | ACTIVE | openshift_dns=192.168.23.4, 10.46.23.50                                | rhel-7.5 | m1.small  |
+--------------------------------------+------------------------------------+--------+------------------------------------------------------------------------+----------+-----------+

4. Uninstall OCP:
     ansible-playbook --user openshift -i "/usr/share/ansible/openshift-ansible/playbooks/openstack/inventory.py" -i inventory "/usr/share/ansible/openshift-ansible/playbooks/openstack/openshift-cluster/uninstall.yml"

The uninstall playbook was executed successfully and the OCP resources were deleted.

$ openstack server list
+--------------------------------------+-----------------+--------+--------------------------------------------+----------+----------+
| ID                                   | Name            | Status | Networks                                   | Image    | Flavor   |
+--------------------------------------+-----------------+--------+--------------------------------------------+----------+----------+
| 3400260a-aa53-48e9-b9d9-7288dc76ce3e | ansible_host-0  | ACTIVE | private_openshift=172.16.40.3, 10.46.23.52 | rhel-7.5 | m1.small |
| dc63df8f-0916-4213-9459-b4b8d42517f0 | openshift_dns-0 | ACTIVE | openshift_dns=192.168.23.4, 10.46.23.50    | rhel-7.5 | m1.small |
+--------------------------------------+-----------------+--------+--------------------------------------------+----------+----------+

(The ansible host and DNS server are not part of the OCP cluster/stack)

$ openstack stack list

$

Comment 6 errata-xmlrpc 2018-11-11 16:39:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2709


Note You need to log in before you can comment on or make changes to this bug.