Install and work with Cloud Custodian in EC2 instance (Linux)? - linux

I have executed the following command on my Linux instance:
yum install custodian
It is installed, but I don't know how to start it and use it. Can anybody helps me how can use execute yml script.

In linux We can install custodian by using commands like :
1). virtualenv custodian
2). for starting custodian
source custodian/bin/activate
3). install cli on it
pip install cli
4). install c7n
pip install c7n
5). now configure user details as:
aws configure

Related

RequestsDependencyWarning: when running gsutil command

Im gettng the below error when i try to run this command on ubuntu 18
gsutil ls
/snap/google-cloud-sdk/161/lib/third_party/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
Tried to run gcloud components update but i got this error
(gcloud.components.update) You cannot perform this action because this Cloud SDK installation is managed by an external package manager.
Please consider using a separate installation of the Cloud SDK created through the default mechanism described at: https://cloud.google.com/sdk/
Am i missing anything ?
This is because your python interpreter and his dependencies are outdated, also, your Gcloud SDK package was installed via snap package, when Gcloud SDK is installed via apt repository or snap package the command gcloud components update will not work, instead you need to run the proper command to update your packages, in your case you need to run this command to update your snap packages
sudo snap refresh
To update the python's packages cryptography and request you need to install the OS package python-pip and after that update your outdated packages
sudo apt-get install python-pip
python -m pip install --upgrade cryptography
python -m pip install --upgrade requests
Since this is a warning message, you can continue working with gcloud/gsutil, but keeping your Python interpreter updated will allow you to use new functions in software written in Python, for example, the Gcloud SDK.

Can't install azure cli on centos

I am trying to install azure-cli on centos 7 box. I am getting this error repeatedly
Error: Package: azure-cli-2.0.80-1.el7.x86_64 (azure-cli)
Requires: libpython3.6m.so.1.0()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I tried to execute both commands but none of these worked for me.
Acturally, Azure CLI requires python3, it's even an executable Python package azure-cli which you can find in PyPI.org. So please make sure there is a Python 3 runtime installed in your CentOS 7.
If you want to fix your issue manually, you can try to download and install the related rpm package for Libpython3.6m.so.1.0()(64bit) from https://pkgs.org/download/libpython3.6m.so.1.0()(64bit), as the figure below.
However, the best way is to follow the offical tutorial Install Azure CLI with yum to install it in CentOS 7.
Otherwise, the other solution is as below to directly install its python package via pip.
Please check whether the Python 3 runtime had been installed in CentOS 7 via command python3 -V or python -V to see the Python version or system will remind you to install it.
Please check whether the pip or pip3 command for Python 3 runtime had been installed via pip3 -V or pip -V to see the pip version or system will remind you to install it.
Completed the two steps above, you can easily to install azure-cli via command sudo pip3 install azure-cli or sudo pip install azure-cli, it will help to install azure-cli to the system path, then you can try to use it via az --version.
You can install it by mentioning the repo/package URL
sudo yum install https://packages.microsoft.com/yumrepos/azure-cli/azure-cli-2.38.0-1.el7.x86_64.rpm
packages can be found here https://packages.microsoft.com/yumrepos/azure-cli/

Deploy python REST service on Ubuntu

I have started learning django and Python.
I have developed one service using Visual Studio Code on my Windows machine.
It is working as expected on Windows machine.
Now I want to deploy the same on a Ubuntu server. (But failing as there is no 'bin' folder inside virtual environment)
How can I do it? I know I am missing something basic here.
Could you please help/ point me where I can read about it?
Let's suppose you are deploying your application at path /opt/.
Follow the below steps to deploy:
To get started we need to install some packages, run the following commands:
sudo apt-get update
sudo apt-get install python3-pip python3-dev libmysqlclient-dev ufw virtualenv
Above command would install the basics python dev packages on ubuntu server.
Create a virtualenv at some path of your choice(might be at /opt/.env), following commands:
virtualenv .env
Activate the environment: source .env/bin/activate
Install all requirement packages in virtual-env that you require to run your Django application.
Test your service manually by running: python manage.py runserver (this would shows that all dependencies are installed)
After that, You can install the web server gateway i.e Gunicorn and Supervisor as process monitoring tool for your service. Please refer: http://rahmonov.me/posts/run-a-django-app-with-nginx-gunicorn-and-supervisor/
Nginx can be run on server as web server for routing request to your application port/socket file.
Above are the high level steps to deploy the Django Application.

Group Install "GNOME Desktop"

Puppet Version: 3.8.7
I have been working on building some system monitoring boxes and have ran into an issue when it comes to installing group yum packages. The normal course of installing packages of course isn't working but I figured that I would at least be able to work around this by including an exec to run the install as a command (like below):
exec { "GNOME Desktop":
command => "/usr/bin/yum -y groups install 'GNOME Desktop'",
timeout => 600,
}
There is an available module on the puppet forge that seems to do what I want but it's not compatible with our version of puppet and we are not in a place to upgrade at this time.
I also tried the setup that was listed in the below server fault question but it also did not work for me:
https://serverfault.com/questions/127460/how-do-i-install-a-yum-package-group-with-puppet
I have also manually been able to run the following command but when I exec it as a puppet command, it fails:
/usr/bin/yum -y groups install "GNOME Desktop"
Why is this? I assumed that puppet is just issuing the command in the exact same way the terminal would?
Changing the time out (or removing it) had zero effect, the issue is with the version of puppet and the ability to install group packages. I ended up installing the desktop environment in my kickstart file and ran puppet for everything else.

Ansible: ufw is not a legal parameter in an ansible task or handler

Trying to run an ansible installation on ubuntu 14.04
ansible-playbook -i hosts ruby-webapp.yml -t swap,ruby,deploy,mysql,nginx,ufw,import_data
I get
ERROR: ufw is not a legal parameter in an Ansible task or handler
and I can't go forward with the rest of the installation.
ufw was was added as a system module to Ansible 1.6 (see http://docs.ansible.com/ufw_module.html).
You are probably running an older version of Ansible on your control node (i.e., the machine where you are invoking the ansible-playbook command). Check your version with:
ansible --version
Upgrading depends on how you installed Ansible originally, but if you installed it to your system as root using pip, you can probably use:
sudo pip install -U ansible
(The -U means "update")
Edit: Just realized that you might be running Ubuntu 14.04 as your control node so I checked to see what version you get when you install Ansible with apt-get. As of this writing, it installs version 1.5.4, so if that's how you installed it, you definitely have the wrong version. You probably want to uninstall the OS package version and use one of the recommended installation techniques: http://docs.ansible.com/intro_installation.html#running-from-source
Something like:
sudo apt-get remove ansible
sudo easy_install pip
sudo pip install ansible
If you are missing easy_install, you may install it with:
sudo apt-get install python-setuptools

Resources