Monday, March 21, 2016

How to Install and Configure Ansible on ubuntu 14.04?


Ansible builds for ubuntu are available in PPA. That means all you need to do is add PPA to you repo's and then use ubuntu's default package installer (apt-get). 

To configure the PPA on your machine and install ansible run these commands:
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible
You can also install via pip as below: 
$ sudo pip install ansible

What are Ansible Raw modules? Where and when they are used?


Ansible’s raw modules are generally used to executing commands on managed machines which does not have basic requirements for Ansible on it. 

For e.g., Running Ansible requires Python 2.4 with python-simplejson on the remote machine. If none of these are available on remote machines then how would you run Ansible on those hosts? The solution is to use Ansible’s Raw module to first install python and python-simplejson on the managed machine and then you can use all other Ansible modules/features.

Example of running a Raw module:

ansible myhost --sudo -m raw -a "yum install -y python2 python-simplejson"


What is SELinux?


SELinux is a flexible but mandatory enterprise grade security implementations (from NSA) in Linux kernel itself. This provides support for enforcing different but mandatory access control policies. 

You can see /etc/selinux/config file to see if SELinux is enabled or not for your system. The variable SELINUX in this file defines the mode (3 modes) in which SELinux has been operation. These 3 different modes of SELinux are namely:
  • Disabled: Completely disables the SELinux.
  • Permissive: enables the SELinux code, but causes it to operate in a mode where accesses that would be denied by policy are permitted but audited
  • Enforcement: Enables the SELinux code and causes it to enforce access denials as well as auditing them.

SELinux was the NSA's attempt at porting the Orange Book requirements to Linux. There are other popular solutions as well for implementing access controls in linux like AppArmor, GrSecurity etc.