rhtconsulting / rhc-ose

OpenShift Automation and Utilities by Red Hat Consulting
42 stars 34 forks source link

Enhancements and Adjustments to support ansible 2.x #194

Closed etsauer closed 8 years ago

etsauer commented 8 years ago

What does this PR do?

Enhanced provisioning script with better error checking, diretory awareness, and improved help output

How should this be manually tested?

Begin with a run like so:

./repository/rhc-ose/rhc-ose-ansible/provision.sh -i=./repository/ose-provision

Try some different combinations of options, including things you know will break, such as no connectivity to OpenShift, or missing ansible vars and such. Script should stop if any ansible run fails.

Is there a relevant Issue open for this?

n/a

Who would you like to review this?

/cc @oybed @vvaldez @JayKayy @sabre1041

oybed commented 8 years ago

@etsauer tested this as part of my "fully automated" build in Jenkins and this change was crucial to make that work. Everything looked good from my perspective. Let me know if you'd like me to merge.

sabre1041 commented 8 years ago

@etsauer changes to the openstack-host-builder look good. We have had discussions on what to do with the openshift flavor since it is what I use to provision instances. In my testing, I ported the changes over there as well (Ansible 2x) so I can test the rest of the PR

Ran into issues while attempting to deploy an environment as shown below:

TASK [openshift_facts : Gather Cluster facts and set is_containerized if needed] ***
fatal: [casl-ablock-1467805635-master1.example.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_VFuUnK/ansible_module_openshift_facts.py\", line 2101, in <module>\r\n    main()\r\n  File \"/tmp/ansible_VFuUnK/ansible_module_openshift_facts.py\", line 2082, in main\r\n    protected_facts_to_overwrite)\r\n  File \"/tmp/ansible_VFuUnK/ansible_module_openshift_facts.py\", line 1574, in __init__\r\n    self.system_facts = ansible_facts(module)\r\nTypeError: ansible_facts() takes exactly 2 arguments (1 given)\r\n", "msg": "MODULE FAILURE", "parsed": false}
fatal: [casl-ablock-1467805635-node1.example.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_8ZgIYJ/ansible_module_openshift_facts.py\", line 2101, in <module>\r\n    main()\r\n  File \"/tmp/ansible_8ZgIYJ/ansible_module_openshift_facts.py\", line 2082, in main\r\n    protected_facts_to_overwrite)\r\n  File \"/tmp/ansible_8ZgIYJ/ansible_module_openshift_facts.py\", line 1574, in __init__\r\n    self.system_facts = ansible_facts(module)\r\nTypeError: ansible_facts() takes exactly 2 arguments (1 given)\r\n", "msg": "MODULE FAILURE", "parsed": false}
fatal: [casl-ablock-1467805635-node2.example.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_iyx6gy/ansible_module_openshift_facts.py\", line 2101, in <module>\r\n    main()\r\n  File \"/tmp/ansible_iyx6gy/ansible_module_openshift_facts.py\", line 2082, in main\r\n    protected_facts_to_overwrite)\r\n  File \"/tmp/ansible_iyx6gy/ansible_module_openshift_facts.py\", line 1574, in __init__\r\n    self.system_facts = ansible_facts(module)\r\nTypeError: ansible_facts() takes exactly 2 arguments (1 given)\r\n", "msg": "MODULE FAILURE", "parsed": false}

NO MORE HOSTS LEFT *************************************************************
    to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/byo/config.retry

PLAY RECAP *********************************************************************
casl-ablock-1467805635-master1.example.com : ok=7    changed=0    unreachable=0    failed=1   
casl-ablock-1467805635-node1.example.com : ok=7    changed=0    unreachable=0    failed=1   
casl-ablock-1467805635-node2.example.com : ok=7    changed=0    unreachable=0    failed=1   
localhost                  : ok=7    changed=6    unreachable=0    failed=0   

Ansible version information

[root@8ff3bf9cfd7f rhc-ose-ansible]# ansible --version
ansible 2.1.0.0
  config file = /root/repository/rhc-ose-ansible/ansible.cfg
  configured module search path = Default w/o overrides
detiber commented 8 years ago

@sabre1041 which version of openshift-ansible? Is this against master? @abutcher have you seen anything similar with migrating to 2.x?

etsauer commented 8 years ago

@detiber i think @sabre1041 was using the atomic-openshift-utils package for this run. he's testing with the upstream code now.

sabre1041 commented 8 years ago

@etsauer is correct. I was going against atomic-openshift-utils and working on testing against upstream now

detiber commented 8 years ago

@etsauer @sabre1041 ah, I suspect that may be the issue then. I'm just getting plugged back into the current state of things, and we are a bit behind on getting the 2.x changes out the door compared to where I'd like to be. I'm hoping to get that sorted out, but in the meantime you might want to consider adding openshift-ansible as a submodule to this repo to allow for incorporating changes from master in a more sane manner.

abutcher commented 8 years ago

The filter plugins will move from /usr/share/ansible_plugins/filter_plugins/ to /usr/share/ansible/plugins/filter/ which @dgoodwin is incorporating into our packaging.

abutcher commented 8 years ago

The line the error is pointing to was updated in https://github.com/openshift/openshift-ansible/commit/5701ba78c681e6f9efd841e76382e3aeb9853c9b for 2.1 support.

detiber commented 8 years ago

The filter plugins will move from /usr/share/ansible_plugins/filter_plugins/ to /usr/share/ansible/plugins/filter/ which @dgoodwin is incorporating into our packaging.

Fun, I'm assuming we are symlinking to avoid compatibility issues for now?

dgoodwin commented 8 years ago

I hadn't thought of that but great idea.

etsauer commented 8 years ago

@detiber yes, adding the submodule was going to be my followup to this PR.

sabre1041 commented 8 years ago

@etsauer was able to build out a successful run.

PLAY RECAP *********************************************************************
casl-ablock-1467825359-master1.example.com : ok=334  changed=76   unreachable=0    failed=0   
casl-ablock-1467825359-node1.example.com : ok=102  changed=30   unreachable=0    failed=0   
casl-ablock-1467825359-node2.example.com : ok=102  changed=30   unreachable=0    failed=0   
localhost                  : ok=15   changed=6    unreachable=0    failed=0   

Points of note for others playing along at home:

etsauer commented 8 years ago

@sabre1041 please merge if all looks good.