Posts

Showing posts from 2017

Ansible Dynamic Inventory

Getting started with Ansible Dynamic Inventory for AWS Cloud Install Python Boto : ################## # yum install Python-pip #pip install python-boto AWS CLI  Installation  : ###################         # pip  install  awscli          AWS CLI  CONFIGURATION : ########################      # aws configure        AWS Access Key ID [****************W5UQ]:        AWS Secret Access Key [****************0QTW]:        Default region name [us-west-2]:        Default output format [None]:  Downloading  Ec2.py and  Ec2.ini  file  for Dynamic  Inventory : ################################################# #   cd  /etc/ansible/ #  wget  https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py #  wget  https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini #  chmod  +x   ec2.py  ec2.ini Exporting some variables : ####################### # export ANSIBLE_HOSTS = / etc / ansible / ec2 . py # export ANSIBLE

Cloud Provisioning

AWS Cloud Provisioning using Ansible Launching EC2 Instances Ansible Playbook  ################## /etc/ansible/playbooks/ec2_launch.yml ---   - name: Provision an EC2 Instance     hosts: local     connection: local     gather_facts: False     tags: provisioning     # Necessary Variables for creating/provisioning the EC2 Instance     vars:       instance_type: t2.micro       security_group: s2 # Change the security group name here       image: ami-b55a51cc # Change the AMI, from which you want to launch the server       region: us-west-2 # Change the Region       keypair: key1 # Change the keypair name       count: 1       hosts: webserver     # Task that will be used to Launch/Create an EC2 Instance     tasks:       - name: Launch the new EC2 Instance         local_action: ec2                        group={{ security_group }}                        instance_type={{ instance_type}}                        image={{ image }}   

Configuration using Ansible

Configure Apache Web Server(http) create file:  #vim http.yml & write the code   --- - hosts: apache   remote_user: root   vars:     http_port: 80     max_client: 300   tasks:   - name: installing apache web server(httpd)     yum:       name: httpd       state: latest - name: starting apache web server service     service:       name: httpd       state: started       enabled: yes  - name: disable selinux    lineinfile: dest=/etc/selinux/config                regexp='^SELINUX='                line='SELINUX=disabled'                state=present  - name: disable iptables    lineinfile: dest=/etc/rc.local                regexp=''                line='iptables -F'                state=present ###################### Deploy Web Application --- - hosts: apache   remote_user: root   vars:     http_port: 80     max_client: 300   tasks:   - name: copying application files     copy:       src: /var/www/cloud/adhoc.tar       dest: /var/

Ansible

Ansible is an open source automation engine that automates software provisioning, configuration management, and application deployment. DEPLOY APPS.   MANAGE SYSTEMS.   CRUSH COMPLEXITY. Ansible delivers simple IT automation that ends repetitive tasks and frees up DevOps teams for more strategic work. ANSIBLE OPEN SOURCE  SIMPLE. POWERFUL. AGENTLESS. App deployment, configuration management and orchestration - all from one system. Ansible is powerful automation that you can learn quickly. As with most configuration management software, Ansible has two types of servers: controlling machines and nodes. First, there is a single controlling machine which is where orchestration begins. Nodes are managed by a controlling machine over SSH. The controlling machine describes the location of nodes through its inventory. To orchestrate nodes, Ansible deploys modules to nodes over SSH. Modules are temporarily stored in the nodes and communicate with the controllin