Ansible on Ubuntu 16.04 error on ping command - ansible

I have a vagrant Ubuntu 16.04 VM with Ansible installed (using sudo apt install ansible) i config the /etc/ansible/hosts file and when i try to run ansible all -m ping i get this error:
Traceback (most recent call last):
File "/usr/bin/ansible", line 85, in <module>
sys.exit(cli.run())
File "/usr/lib/python2.7/dist-packages/ansible/cli/adhoc.py", line 190, in run
self._tqm.cleanup()
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 245, in cleanup
self._cleanup_processes()
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 249, in _cleanup_processes
self._result_prc.terminate()
File "/usr/lib/python2.7/dist-packages/ansible/executor/process/result.py", line 89, in terminate
super(ResultProcess, self).terminate()
File "/usr/lib/python2.7/multiprocessing/process.py", line 137, in terminate
self._popen.terminate()
AttributeError: 'NoneType' object has no attribute 'terminate'
I tried the same installations and config file on a Vagrant Centos7 image and everything works fine.
I was not able to find something similar but maybe my search skills are not so good. Does anyone encounter this? Is there something else to install on Ubuntu?
Thank you.

I have found a solution for the Ubuntu version. Don't install it by using sudo apt install ansible only, you need to install it from the ansible repo.
Run this:
sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible -y
I don't know why it works like this, I don't have time to research it but it works using the ppa:ansible/ansible. I guess the one from the apt is obsolete.
PS: thanks for the downvote whoever downvoted.

Related

rename command not found when running Ubuntu 20.04 on VirtualBox

I installed Ubuntu 20.04 on my VirtualBox on my Windows 10 PC.
One of the tasks I wanted to do, was rename a bunch of files with the .txt extension to a .html extension. After searching online, I found that using the rename command would work.
But when attempting to run rename, I get the following error:
Command 'rename' not found. Did you mean:
Command 'hrename' from deb hsfutils (3.2.6-14)
Try: sudo apt install < deb name>
Upon trying
sudo apt install rename
I get the following error:
Unable to locate package rename
I also tried
sudo apt update
But it did not work.
Could someone tell me what to do?
Open your terminal and paste the following command
sudo apt-get install rename
Same issue.
E: Unable to locate package rename
I ended up just downloaded the .deb file.
https://ubuntu.pkgs.org/22.04/ubuntu-universe-amd64/rename_1.30-1_all.deb.html
Make sure you have perl installed.
sudo apt install perl-base --upgrade
Just for the record, rename on Linux is NOT the same as rename on windows. Rename is a powerful tool for doing batch file renames with complex patterns in one line that would otherwise take multiple lines with bash, find, mv, and other commands.

pycurl macOS Install issue

I need to install pycurl in order to run a python script, but I can't find the way to do it on macOS.
I have already tried brew, update Pip but I always receive this error after did "pip install pycurl"
Collecting pycurl
Using cached https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz
Complete output from command python setup.py egg_info:
Using curl-config (libcurl 7.54.0)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/vk/f193293d0pvd2ynlcpnyx9100000gn/T/pip-install-rxidIQ/pycurl/setup.py", line 913, in <module>
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File "/private/var/folders/vk/f193293d0pvd2ynlcpnyx9100000gn/T/pip-install-rxidIQ/pycurl/setup.py", line 582, in get_extension
ext_config = ExtensionConfiguration(argv)
File "/private/var/folders/vk/f193293d0pvd2ynlcpnyx9100000gn/T/pip-install-rxidIQ/pycurl/setup.py", line 99, in __init__
self.configure()
File "/private/var/folders/vk/f193293d0pvd2ynlcpnyx9100000gn/T/pip-install-rxidIQ/pycurl/setup.py", line 316, in configure_unix
specify the SSL backend manually.''')
__main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.
Any suggestion ?
Recent versions of curl support multiple ssl backend and pycurl is not able to decide which one is used during the installation time. This is a known problem (https://github.com/pycurl/pycurl/issues/530) in 7.43.0.2. Lots of people say to install curl with openssl support, but on macos is better to use the default SecureTransport and let the system access the keychain instead of using the bundled certificates in openssl.
Try installing 7.43.0.1 to fix your problems.
pip install pycurl==7.43.0.1
If this doesn't work execute this:
brew link curl
export LDFLAGS="-L/usr/local/opt/curl/lib"
export CPPFLAGS="-I/usr/local/opt/curl/include"
and try again
pip install pycurl==7.43.0.1
In order for PycURL to find the OpenSSL headers on macOS, we need to specify which SSL backend to use and where OpenSSL can be found:
pip install --install-option="--with-openssl" --install-option="--openssl-dir=/usr/local/opt/openssl" pycurl
That OpenSSL path will vary based on your installation. On Apple Silicon, this should work:
pip install --install-option="--with-openssl" --install-option="--openssl-dir=/opt/homebrew/opt/openssl" pycurl

Let's Encrypt no interface issue

I am on AWS Ec2 Amazon Linux and trying to use Let's Encrypt. When I first installed Let's Encrypt couple month back I did not have any issues renewing the certificates. But now I receive this error and not able to renew.
# ./certbot-auto --debug
Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt:
Traceback (most recent call last):
File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module>
from certbot.main import main
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 7, in <module>
import zope.component
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/component/__init__.py", line 16, in <module>
from zope.interface import Interface
ImportError: No module named interface
I have tried unset PYTHON_INSTALL_LAYOUT and upgrading pip,virtualenv. No luck.
It seems to be simialr to this issue Letsencrypt ImportError: No module named interface on amazon linux while renewing But dirctory is different. Not sure I want to rm the /opt/eff.org/certbot/venv/bin/letsencrypt
I was able to fix this problem with:
sudo rm -rf /root/.local/share/letsencrypt/
sudo rm -rf /opt/eff.org/certbot/
Then rerun certbot-auto in user mode (ec2-user).
./certbot-auto renew -v --debug
I hit exactly this issue just now with Amazon Linux. The fix that worked for me is detailed on the certbot GitHub issue
I had the same issue from what appears to be a bad install of certbot.
I fixed it by running the following:
unset PYTHON_INSTALL_LAYOUT
/root/.local/share/letsencrypt/bin/pip install --upgrade certbot
I did not have pip installed separately on the server, it was only available as part of the certbot install, so this was the only way I could use pip to upgrade the installation properly.
If you have pip installed on your EC2 instance as I do, you can simply do this:
rm -rf /opt/eff.org/*
pip install -U certbot
certbot renew --debug
Downloading certbot-auto via wget has always caused problems for me, so the above method is preferred.

Python 2.7 - unable to upgrade/ install some packages after upgrading to El Capitan

After I have upgraded to El Capitan, Python 2.7 is unable to install/ upgrade/ uninstall some packages, but meanwhile, it still works fine for some other packages.
Below (the end) is the error message I have got when trying to upgrade numpy. Same error also raises when I tried to uninstall it.
I have tried pip install --user or pip install --ignore-installed numpy, but neither works. Even if it says numpy has been successfully installed, the version remains unchanged and it does not really upgrade.
I know other solutions may be reinstall python using brew, but I want to avoid multiple versions of Python if possible. Any help would be appreciated.
----------- Error Message -----------
40:523: execution error: The directory '/Users/-/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/init.py", line 315, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/m0/hzt3nk9d43n05bwm6zztqjkh0000gn/T/pip-HESb5m-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
(2)
The python framework you are using
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7"
is the system python that comes with your mac os. You shouldn't pip install packages as doing so may pollute your system python and potentially cause system problems. This is why other solutions suggest installing another python such as from brew brew install python#2.
The issue you are running into after upgrading to el capitan is the System Integrity Protection built-in OS X El Capitan and later
You can disable this protection by following the steps described here:
https://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html
After doing so, you will be able to install and upgrade packages using pip.
I do not recommend this, but it will work!
I suggest installing python using brew and then setup a virtual environment using pip such that you can install python packages that won’t pollute the global python.
pip install virtualenv
pip install virtualenvwrapper

Trouble downloading wxpthon

I'm very new to Python and using the terminal, and I'm having a lot of trouble downloading wxpython. I'm using Mac OS X Lion, the most recent version, and I've tried two methods:
If I try to simply download wxpython off their website, I go through the entire installation process and it says it's been installed but then I can't find it on my computer. And when I go to run the separately installed demo, it says that there's no module named wxpython on my computer.
So I turned to other methods...
If I try sudo pip install wxpython, I get:
Downloading/unpacking wxpython
Downloading wxPython2.8-win64-devel-2.8.12.1-msvc9x64.tar.bz2 (7.2Mb): 7.2Mb downloaded
Running setup.py egg_info for package wxpython
Traceback (most recent call last):
File "<string>", line 14, in <module>
IOError: [Errno 2] No such file or directory: '/Users/michelletyler1/build/wxpython/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
IOError: [Errno 2] No such file or directory: '/Users/michelletyler1/build/wxpython/setup.py'
I also tried sudo port install py27-wxpython after installing MacPorts, and got:
---> Computing dependencies for py27-wxpython
---> Building py27-wxpython
Error: org.macports.build for port py27-wxpython returned: command execution failed
Please see the log file for port py27-wxpython for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-wxpython/py27-wxpython/main.log
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port py27-wxpython failed
What can be wrong?
Also, I've been trying to figure out how to change my $PATH so that /usr/local/bin is ahead of /usr/bin (as advised by brew doctor), but when I go to edit my ~/.profile (what I've gathered I'm supposed to do from what I've found online so far), it doesn't work.
Thanks for the help!
From what I understand, you don't want to install wxPython against the preinstalled Python. Instead, you need to go to www.python.org and install a fresh Mac compatible Python. Then you can download the wxPython you want and install it against your fresh Python. By the way, wxPython does not support easy_install or pip.

Resources