pip install -U PACKAGENAME --user
With --user they are installed in your $HOME directory in:
$HOME/.local/lib/python2.7/site-packages
Using sudo your package will be installed in:
/usr/local/lib/python2.7/dist-packages/
pip install -U PACKAGENAME --user
With --user they are installed in your $HOME directory in:
$HOME/.local/lib/python2.7/site-packages
Using sudo your package will be installed in:
/usr/local/lib/python2.7/dist-packages/
We will need python:
yum install python36
yum install ansible
Make sure ansible version >=2.4.0
Download gce.ini and gce.py from: https://github.com/ansible/ansible.git
Create service_account in gce:
IAM -> Service ACCounts -> add
Give it a name, give a role Project -> Owner. It will auto create “Service Account ID”.
Click on “Furnish a new private key”
Download pkcs12 file.
Edit gce.ini add the value to the following parameter
gce_service_account_email_address = <service account email id>
Here enter the email id which you can see on the service accounts dashboard in the column “Service Account ID” in front of “Compute Engine default service account”
Make sure you create a key for this user and download the pkcs12 key.
Execute the following to convert p12 to pem:
openssl pkcs12 -in test.p12 -passin pass:notasecret -nodes -nocerts | openssl rsa -out my_project.pem
In the gce.ini add:
gce_service_account_pem_file_path = my_project.pem
Here paste the project ID in the project dashboard.
gce_project_id = <project ID>
You may get the following error:
libcloud.common.google.GoogleBaseError: {‘domain’: ‘global’, ‘reason’: ‘forbidden’, ‘message’: “Required ‘compute.zones.list’ permission for ‘projects/xxxxxxx'”}
Do the following:
Billing is enabled on the project
The product name for the project is filled in
The compute API is enabled
You need to grant “Compute Engine/Compute Instance Admin” and “Project/Service Account Actor” to your service account.
You can add user specific roles in IAM and project specific API permissions in “APIs and Services”
pip install apache-libcloud==1.5.0
pip install PyCrypto
If it gives following error:
Error: gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-x86_64-2.7/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
error: command ‘gcc’ failed with exit status 1
Then execute the following:
yum install python36-devel
Then execute:
ansible all -i gce.py -m setup
To completely remove python you can execute:
rm -f /usr/local/bin/python2.7
rm -f /usr/local/bin/pip2.7
rm -f /usr/local/bin/pydoc
rm -rf /usr/local/bin/include/python2.7
rm -f /usr/local/lib/libpython2.7.a
rm -rf /usr/local/lib/python2.7
You might also have to do
rm -f /usr/local/share/man/python2.7.1
rm -rf /usr/local/lib/pkgconfig
rm -f /usr/local/bin/idle
rm -f /usr/local/bin/easy_install-2.7