openshift-ansible: Inconsistent openshift_release values detailed in aws deployment and openshift-ansible example inventory file
Description
I have been peer reviewing AWS deployment code getting ready to integrate the procedure into the e2e reference documentation. I’ve come across a situation where we set a vars file containing key openshift_release.
I would expect this key to align with the values in an openshift-ansible inventory file so that it’s not being defined twice, overwritten or overridden and creating a race or error condition.
Version
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
$ ansible --version
ansible 2.4.1.0
config file = /home/ccallega/git/openshift-ansible/ansible.cfg
configured module search path = [u'/home/ccallega/git/openshift-ansible/library']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
$ git describe
openshift-ansible-3.9.0-0.6.0-3-g34d8433b0
Steps To Reproduce
- cd ~/git/openshift-ansible/playbooks/aws/openshift-cluster
- Use openshift-ansible config file…
ANSIBLE_CONFIG=$HOME/git/openshift-ansible/ansible.cfg
- Set AWS provisioning vars file like so…
cat > provisioning_vars.yml << EOF
# Minimum mandatory provisioning variables. See provisioning_vars.yml.example.
# for more information.
ansible_ssh_user: ec2-user
openshift_deployment_type: openshift-enterprise
openshift_release: v3.7 # This value aligns with openshift-ansible inventory file
openshift_pkg_version: -3.7.0
openshift_aws_clusterid: blah
openshift_aws_ssh_key_name: ccallegar
openshift_aws_base_ami: ami-fbc89880
rhel_subscription_user: 'user@example.com'
rhel_subscription_pass: 'abcd1234'
rhel_subscription_pool: 'abcd1234'
EOF
- Run play…
$ ansible-playbook -i inventory.yml build_ami.yml -e @provisioning_vars.yml
Expected Results
I expect build_ami.yml to complete without errors.
Observed Results
Ansible play fails…
TASK [openshift_sanitize_inventory : Abort when openshift_release is invalid] *******************************************************
Wednesday 13 December 2017 13:38:22 -0500 (0:00:00.068) 0:00:08.693 ****
fatal: [ec2-52-91-185-153.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\"."}
PLAY RECAP **************************************************************************************************************************
127.0.0.1 : ok=15 changed=1 unreachable=0 failed=0
ec2-52-91-185-153.compute-1.amazonaws.com : ok=9 changed=0 unreachable=0 failed=1
INSTALLER STATUS ********************************************************************************************************************
Initialization : In Progress (0:00:05)
Wednesday 13 December 2017 13:38:22 -0500 (0:00:00.054) 0:00:08.748 ****
===============================================================================
openshift_sanitize_inventory : Check for usage of deprecated variables ------------------------------------------------------- 1.67s
openshift_aws : create instance for ami creation ----------------------------------------------------------------------------- 0.91s
openshift_aws : fetch newly created instances -------------------------------------------------------------------------------- 0.77s
openshift_aws : fetch the default subnet id ---------------------------------------------------------------------------------- 0.62s
openshift_aws : query vpc ---------------------------------------------------------------------------------------------------- 0.60s
openshift_sanitize_inventory : conditional_set_fact -------------------------------------------------------------------------- 0.46s
openshift_sanitize_inventory : conditional_set_fact -------------------------------------------------------------------------- 0.36s
openshift_aws : wait for ssh to become available ----------------------------------------------------------------------------- 0.31s
Run openshift_sanitize_inventory to set variables ---------------------------------------------------------------------------- 0.19s
create an instance and prepare for ami --------------------------------------------------------------------------------------- 0.17s
openshift_sanitize_inventory : Assign deprecated variables to correct counterparts ------------------------------------------- 0.15s
Evaluate oo_all_hosts -------------------------------------------------------------------------------------------------------- 0.13s
Evaluate oo_etcd_to_migrate -------------------------------------------------------------------------------------------------- 0.12s
set the user to perform installation ----------------------------------------------------------------------------------------- 0.10s
openshift_sanitize_inventory : include_tasks --------------------------------------------------------------------------------- 0.10s
Evaluate oo_nodes_to_config -------------------------------------------------------------------------------------------------- 0.10s
Evaluate oo_glusterfs_to_config ---------------------------------------------------------------------------------------------- 0.09s
openshift_sanitize_inventory : set_fact -------------------------------------------------------------------------------------- 0.08s
openshift_aws : include_tasks ------------------------------------------------------------------------------------------------ 0.07s
Alert user to variables needed and their values - {{ item.name }} ------------------------------------------------------------ 0.07s
Additional Information
v3.7 IS a valid OpenShift version. openshift-ansible hosts.example inventory file advertises the correct as v3.[0-9]+. I would say that “TASK [openshift_sanitize_inventory : Abort when openshift_release is invalid” is not doing the needful.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (11 by maintainers)
The problem appears to be caused by the following file… /Users/ccallega/git/openshift-ansible/roles/openshift_sanitize_inventory/tasks/main.yaml
Scenario 1 : ‘openshift_release: v3.7’ - Fails Task ‘Normalize openshift_release’ is being casted to a string. The v gets removed but it appears the local fact isn’t being pushed up to the Ansible global inventory. Task ‘Abort when openshift_release is invalid’ causes failure because match() finds the v in the value of openshift_release.
Scenario 2 : ‘openshift_release: 3.7’ - Fails I really don’t know why we fail here. L37 & L47 look good to me. It looks like the value is getting casted to a string in task at L37. L47 fails because of a digit to string mismatch.
Scenario 3 : 'openshift_release: ‘3.7’ - Success Explicitly setting the value to a string in the inventory file isn’t advertised anywhere. We should fix the code to suit examples and documentation.