Closed geerlingguy closed 5 years ago
Need to fix something upstream first: https://github.com/geerlingguy/ansible-role-k8s_manifests/issues/2
From https://github.com/ansible/ansible/issues/43637
Argh, I might have to finally bite the bullet and start using virtualenv, after years of pushing it off (I hate having an environment manager to manage my environment...).
I've been continually bitten by this weird behavior, even after making sure I install openshift in all the versions of Python I've installed locally. And for this particular playbook (see https://github.com/geerlingguy/raspberry-pi-dramble/issues/131), I have the playbook run against remote servers, but want to include one role and run it locally.
I might also fix this by running the k8s stuff in a separate play, with
connection: local
instead of usingimport_role
withdelegate_to: localhost
...
Switching to a separate play with connection: local
didn't seem to work either :/
Following @willthames advice here (https://github.com/ansible/ansible/issues/43637#issuecomment-447622551), I added the task:
pre_tasks:
- python_requirements_facts:
dependencies: openshift
- fail:
Then I got the output (with -vvv
) from the nodes:
ok: [kube3] => {
"changed": false,
"invocation": {
"module_args": {
"dependencies": [
"openshift"
]
}
},
"mismatched": {},
"not_found": [
"openshift"
],
"python": "/usr/bin/python",
"python_system_path": [
"/tmp/ansible_python_requirements_facts_payload_Rs_w8u/ansible_python_requirements_facts_payload.zip",
"",
"/usr/lib/python2.7",
"/usr/lib/python2.7/plat-x86_64-linux-gnu",
"/usr/lib/python2.7/lib-tk",
"/usr/lib/python2.7/lib-old",
"/usr/lib/python2.7/lib-dynload",
"/usr/local/lib/python2.7/dist-packages",
"/usr/lib/python2.7/dist-packages"
],
"python_version": "2.7.13 (default, Sep 26 2018, 18:42:22) \n[GCC 6.3.0 20170516]",
"valid": {}
}
And here's the output from local:
ok: [127.0.0.1] => changed=false
invocation:
module_args:
dependencies:
- openshift
mismatched: {}
not_found: []
python: /usr/local/opt/python@2/bin/python2.7
python_system_path:
- /var/folders/mt/rp7cb3s95qzfkrh1dk_8ckfc0000gn/T/ansible_python_requirements_facts_payload_k8WSc0/ansible_python_requirements_facts_payload.zip
- ''
- /usr/local/lib/python2.7/site-packages
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
- /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
- /Users/jgeerling/Library/Python/2.7/lib/python/site-packages
- /usr/local/lib/python2.7/site-packages
python_version: |-
2.7.15 (default, Jul 17 2018, 19:41:20)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
valid:
openshift:
desired: null
installed: 0.8.1
So... uh... wth?
Opened new upstream Ansible issue: k8s module throwing 'This module requires the OpenShift Python client. Try pip install openshift
'.
Adding debug info there.
Got it all fixed up... final test in a few minutes on the Pi cluster... which is partially disassembled right now due to my PoE HAT conversion!
PR: https://github.com/geerlingguy/raspberry-pi-dramble/pull/137
I like: +97 −249
See: https://github.com/geerlingguy/ansible-role-k8s_manifests
Shouldn't require much rearchitecture, but it should simplify things a bit.