Bug 1505300 - Build AMI failed cause normalize openshift_release has no effect
Summary: Build AMI failed cause normalize openshift_release has no effect
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.11.0
Assignee: Chris Callegari
QA Contact: sheng.lao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-23 09:08 UTC by Wenkai Shi
Modified: 2018-10-11 07:19 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-11 07:19:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:2652 0 None None None 2018-10-11 07:19:41 UTC

Description Wenkai Shi 2017-10-23 09:08:20 UTC
Description of problem:
Follow steps in [1] to build an AMI. Set "openshift_release: v3.7" in provisioning_vars.yml, build AMI with command [2]. It failed cause openshift_release is invalid.
Installer could pass the TASK when remove "openshift_release: v3.7" in provisioning_vars.yml.

[1]. /usr/share/ansible/openshift-ansible/playbooks/aws/README.md
[2]. ansible-playbook -i inventory.yml /usr/share/ansible/openshift-ansible/playbooks/aws/openshift-cluster/build_ami.yml -e @provisioning_vars.yml -vvv

Version-Release number of selected component (if applicable):
openshift-ansible-3.7.0-0.174.0.git.0.01932ad.el7
ansible-2.4.0.0-5.el7

How reproducible:
100%

Steps to Reproduce:
1. Prepare configure files
# cat provisioning_vars.yml
...
# openshift_release must be specified.  Use whatever version of openshift
# that is supported by openshift-ansible that you wish.
#openshift_release: # v3.7
openshift_release: v3.7
...
2. Build AMI
# ansible-playbook -i inventory.yml /usr/share/ansible/openshift-ansible/playbooks/aws/openshift-cluster/build_ami.yml -e @provisioning_vars.yml -vvv
3.

Actual results:
# ansible-playbook -i inventory.yml /usr/share/ansible/openshift-ansible/playbooks/aws/openshift-cluster/build_ami.yml -e @provisioning_vars.yml -vvv
...
TASK [openshift_sanitize_inventory : Normalize openshift_release] ****************************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yml:35
ok: [ec2-xx-xx-xx-xx.compute-1.amazonaws.com] => {
    "ansible_facts": {
        "openshift_release": "3.7"
    }, 
    "changed": false, 
    "failed": false
}

TASK [openshift_sanitize_inventory : Abort when openshift_release is invalid] ****************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yml:45
fatal: [ec2-xx-xx-xx-xx.compute-1.amazonaws.com]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "msg": "openshift_release is \"v3.7\" which is not a valid version string.\nPlease set it to a version string like \"3.4\"."
}
	to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/aws/openshift-cluster/build_ami.retry
...

Expected results:
normalize openshift_release should has effect

Additional info:

Comment 1 Wenkai Shi 2017-10-24 09:26:37 UTC
So far I could work around by not setting "openshift_release: v3.7" in provisioning_vars.yml, if this looks good to you, it could be fix by modify the document.

# cat provisioning_vars.yml.example
...
# openshift_release must be specified.  Use whatever version of openshift
# that is supported by openshift-ansible that you wish.
#openshift_release: # v3.7

...

# cat /usr/share/ansible/openshift-ansible/playbooks/aws/README.md
...
# Minimum mandatory provisioning variables.  See provisioning_vars.yml.example.
# for more information.
openshift_deployment_type: # 'origin' or 'openshift-enterprise'
openshift_release: # example: v3.7
openshift_pkg_version: # example: -3.7.0
openshift_aws_ssh_key_name: # example: myuser_key
openshift_aws_base_ami: # example: ami-12345678
openshift_aws_iam_cert_path: # example: '/path/to/wildcard.<clusterid>.example.com.crt'
openshift_aws_iam_key_path: # example: '/path/to/wildcard.<clusterid>.example.com.key'
...

Comment 2 Kenny Woodson 2017-10-24 13:19:30 UTC
Wenkai,

Thanks for looking at this openshift_version issue.  Could you also try using 'openshift_version: 3.7'?  I think that the 'v' in 'v3.7' is causing the issue.

I generally specify 'openshift_pkg_version=-3.7.0' in my inventory file and this solves the version.

Thanks.

Comment 3 Wenkai Shi 2017-10-25 06:31:42 UTC
Kenny,

I try to use "openshift_version: 3.7" in provisioning_vars.yml, it still failed.

I'm wonder if "openshift_release: v3.7" necessary in provisioning_vars.yml? Cause "openshift_release: v3.7" could setting in inventory.yml which works very well.

# cat provisioning_vars.yml
...
# openshift_release must be specified.  Use whatever version of openshift
# that is supported by openshift-ansible that you wish.
#openshift_release: # v3.7
openshift_release: 3.7
...

# ansible-playbook -i inventory.yml /usr/share/ansible/openshift-ansible/playbooks/aws/openshift-cluster/build_ami.yml -e @provisioning_vars.yml -vvv
...
TASK [openshift_sanitize_inventory : Normalize openshift_release] ****************************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yml:35
ok: [ec2-xx-xx-xx-xx.compute-1.amazonaws.com] => {
    "ansible_facts": {
        "openshift_release": "3.7"
    }, 
    "changed": false, 
    "failed": false
}

TASK [openshift_sanitize_inventory : Abort when openshift_release is invalid] ****************************************************************************************************************
task path: /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yml:45
fatal: [ec2-xx-xx-xx-xx.compute-1.amazonaws.com]: FAILED! => {
    "failed": true, 
    "msg": "The conditional check 'not openshift_release | match('\\d+(\\.\\d+){1,3}$')' failed. The error was: Unexpected templating type error occurred on ({% if not openshift_release | match('\\d+(\\.\\d+){1,3}$') %} True {% else %} False {% endif %}): expected string or buffer\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yml': line 45, 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: Abort when openshift_release is invalid\n  ^ here\n"
}
...

Comment 6 Scott Dodson 2018-01-25 15:25:34 UTC
Kenny, Russ, and Mike to brainstorm and come up with a solution for avoiding use of extra vars. Since CI/CD/Ops teams are not blocked by this we're pushing this out to 3.10 but if we can fix it before 3.9 that's fine too.

Comment 8 sheng.lao 2018-08-10 03:21:11 UTC
1. Test result: Passed
# ansible-playbook -i inventory.yml -e @provisioning_vars.yml playbooks/aws/openshift-cluster/build_ami.yml
... ...
TASK [openshift_aws : terminate temporary instance] *********************************************************************************
Thursday 09 August 2018  11:33:58 -0400 (0:00:00.028)       0:11:00.148 ******* 
changed: [localhost]

PLAY RECAP *********************************************************************************
xxxxxxxxx : ok=144  changed=21   unreachable=0    failed=0   
localhost                  : ok=18   changed=4    unreachable=0    failed=0   

2. Environment:
# git describe
openshift-ansible-3.11.0-0.12.0-2-g44b45aa

3. Parameters:
openshift_release: '3.7' # v3.7
openshift_pkg_version: '-3.7.61' # -3.7.0

Comment 10 errata-xmlrpc 2018-10-11 07:19:06 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/RHBA-2018:2652


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