Ansible - 1
yum install ansible -y
cat /etc/ansible/hosts
make an entry
[ansible_clients]
192.168.2.127 ansible_ssh_pass=simplilearn ansible_ssh_user=root
now create a playbook
vi sample.yml
---
- name: sample book
hosts: ansible_clients
remote_user: root
beocme: true
tasks:
- name: install httpd
yum:
name: httpd
state: latest
- name: run httpd
service:
name: httpd
state: started
- name: create content
copy:
content: "welcome"
dest: /var/www/html/index.html
=====================================
how to check the syntax of yaml whether is correct or not?
there is command in ansible
ansible-playbook sample.yml(name of the playbook) --syntax-check
ansible-playbook sample.yml --syntax-check = run this command
now command to execute the playbook
#ansible-playbook sample.yml
there are four state
1 ok - it is already exist
2 changed - change has been made
3 unreachable - if client is reachable or not
4 failed - if task failed or not
======================================================
docker swarm
1. docker swarm init
2.
========================================================
what all are configuration management tool available in market?
ans - chef, ansible, puppet
what is the basic difference between ansible and chef
ans - chef tool use pull method. ansible use push method.
anisble is new in the market as comparison chef and puppet
ansible work on yaml file. it is recently acquired by redhat. They have launched gui version of ansible is AnsibleTower. Its annual cost is 10000rs for enterprise edition which support 100 nodes in org. It is simple as it has drag and drop.
Define - ansible
It is an open-source IT configuration Management, Deployment and Orchestration tool. It aims to provide large productivity gains to a wide variety of automation challenges. It works as infrastructure as a code. It is agentless. It works on yaml.
History
------
-> Michael Dehaan developed ansible and the ansible project began in february 2012.
-> Redhat acquired the ansible tool in 2015
-> Ansible is available for RHEL, Debian, Centos, Oracle, Linux.
->we can use this tool whether your server are in on-premises or in the cloud.
-> It turns your code into infrastructure i.e. your computing environment has some of the same attributes as your application.
YAML -- Yet another markup language.
===============================================================
Advantages and disadvantages.
-------------------------
Advantages
----------
1) Ansible is free to use by everyone.
2)It is very consistent and lightweight and no constraints regarding the O.S. or Underlying hardware are present.
3) It is very secure due to its agentless capabilities and open ssh security features.
4) Ansible does not need any special system administrtor skills to install and use it (Yaml)
5) It works on PUSH mechanism
Disadvantages
-------------
1) Insufficient user interface, though ansible tower is GUI, but it is still in develpement stages.
2) Can not achieve full automation by ansible.
3)New to the market, therefore limited support and document is available.
========================================================
Term used in ansible.
--------------------
Ansible server->
The machine where ansible is installed and from which all tasks and playbooks will be ran.
Module ->
Basically a module is a command or set of similar commands meant to be executed on the client-side.
Task ->
A task is a section that consists of a single procedure to be completed.
Role ->
A way of organising tasks and related files to be later called in a playbook.
Fact ->
Information fetched from the client system from the global variables with the gatter-facts operation.
Inventory ->
File containing data about the ansible client servers.
Play ->
Execution of a playbook.
Handler ->
Task which is called only if a notifier is present.
Notifier ->
Section attributed to a task which calls a handler if the output is changes.
Playbook ->
It consist code in YAML format, which describes tasks to be executed.
Host ->
Nodes, which are automated by ansible.
Comments
Post a Comment