AshrafHassan

Untitled

Nov 14th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. I have Ansible tower with 3.5 on RHEL 7.6 with the following setup:
  2. # python -V
  3. Python 2.7.5
  4. # ansible --version
  5. ansible 2.7.6
  6. config file = /etc/ansible/ansible.cfg
  7. configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  8. ansible python module location = /usr/lib/python2.7/site-packages/ansible
  9. executable location = /usr/bin/ansible
  10. python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
  11.  
  12. # pip freeze
  13. DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple ase upgrade your Python as Python 2.7 won't be maintained after that date. A fut ure version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/relea se-process/#python-2-support
  14. ansible==2.7.6
  15. Babel==0.9.6
  16. backports.ssl-match-hostname==3.5.0.1
  17. cffi==1.6.0
  18. chardet==2.2.1
  19. configobj==4.7.2
  20. cryptography==1.7.2
  21. decorator==3.4.0
  22. dnspython==1.12.0
  23. enum34==1.0.4
  24. ethtool==0.8
  25. futures==3.1.1
  26. httplib2==0.9.2
  27. idna==2.4
  28. iniparse==0.4
  29. insights-client==3.0.6
  30. ipaddr==2.1.11
  31. ipaddress==1.0.16
  32. javapackages==1.0.0
  33. Jinja2==2.8
  34. jmespath==0.9.0
  35. kitchen==1.1.1
  36. lxml==3.2.1
  37. M2Crypto==0.21.1
  38. Magic-file-extensions==0.2
  39. MarkupSafe==0.11
  40. meld3==0.6.10
  41. mercurial==2.6.2
  42. paramiko==2.1.1
  43. pciutils==1.7.3
  44. perf==0.1
  45. ply==3.4
  46. psycopg2==2.7.5
  47. pyasn1==0.1.9
  48. pycparser==2.14
  49. pycrypto==2.6.1
  50. pycurl==7.19.0
  51. pygobject==3.22.0
  52. pygpgme==0.3
  53. pyinotify==0.9.4
  54. pyliblzma==0.5.3
  55. pyOpenSSL==0.13.1
  56. python-dateutil==1.5
  57. python-dmidecode==3.10.13
  58. python-keyczar==0.71rc0
  59. python-linux-procfs==0.4.9
  60. python-qpid-proton==0.24.0
  61. pyudev==0.15
  62. pyxattr==0.5.1
  63. PyYAML==3.10
  64. requests==2.6.0
  65. rhnlib==2.5.65
  66. schedutils==0.4
  67. six==1.9.0
  68. slip==0.4.0
  69. slip.dbus==0.4.0
  70. subscription-manager==1.24.13
  71. supervisor==3.1.4
  72. syspurpose==1.24.13
  73. urlgrabber==3.10
  74. urllib3==1.10.2
  75. virtualenv==15.1.0
  76. yum-metadata-parser==1.1.4
  77.  
  78. And I have created a virtual environment as follow:
  79. # yum install gcc openssl-devel libffi-devel python-devel
  80. # yum install python27
  81. # scl enable python27 bash
  82. # umask 0022
  83. # mkdir /opt/new/custom-venv
  84. # chmod 0755 /opt/new/
  85. # virtualenv /opt/new/custom-venv --python=python2.7
  86. # source /opt/new/custom-venv/bin/activate
  87. (custom-venv)# /opt/new/custom-venv/bin/pip setuptools --upgrade
  88. (custom-venv)# /opt/new/custom-venv/bin/pip install --upgrade pip
  89. (custom-venv)# /opt/new/custom-venv/bin/pip install python-memcached psutil ansible==2.8.4
  90. (custom-venv)# /opt/new/custom-venv/bin/pip ovirt-engine-sdk-python==4.3.0
  91. (custom-venv)# /opt/new/custom-venv/bin/pip install hpICsp==1.0.2
  92. (custom-venv)# /opt/new/custom-venv/bin/pip install hpOneView==4.8.0
  93. (custom-venv)# rsync -avh --progress /tmp/oneview/library /opt/new/custom-venv/lib/python2.7/site-packages/ansible/oneview-ansible
  94. (custom-venv)# pip freeze
  95. DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
  96. ansible==2.8.4
  97. cffi==1.13.2
  98. cryptography==2.8
  99. enum34==1.1.6
  100. future==0.18.2
  101. hpICsp==1.0.2
  102. hpOneView==4.8.0
  103. ipaddress==1.0.23
  104. Jinja2==2.10.3
  105. MarkupSafe==1.1.1
  106. ovirt-engine-sdk-python==4.3.0
  107. psutil==5.6.5
  108. pycparser==2.19
  109. pycurl==7.43.0.3
  110. python-memcached==1.59
  111. PyYAML==5.1.2
  112. six==1.13.0
  113. (custom-venv)# python -V
  114. Python 2.7.16
  115.  
  116. And from the UI Settings-> Systems I have adjusted the virtual environment to point to /opt/new
  117.  
  118. Now when I run any Job, I am getting the following error :
  119. Traceback (most recent call last):
  120. File "/opt/new/custom-venv/bin/ansible-playbook", line 60, in
  121. import ansible.constants as C
  122. File "/opt/new/custom-venv/lib/python2.7/site-packages/ansible/constants.py", line 12, in
  123. from jinja2 import Template
  124. File "/opt/new/custom-venv/lib/python2.7/site-packages/jinja2/init.py", line 33, in
  125. from jinja2.environment import Environment, Template
  126. File "/opt/new/custom-venv/lib/python2.7/site-packages/jinja2/environment.py", line 13, in
  127. import weakref
  128. File "/opt/rh/python27/root/usr/lib64/python2.7/weakref.py", line 14, in
  129. from _weakref import (
  130. ImportError: cannot import name _remove_dead_weakref
  131.  
  132. How can I fix it so I can run jobs using the virtual environment?
Add Comment
Please, Sign In to add comment