Publicité

Introduction to ansible

31 May 2016
Publicité

Contenu connexe

Publicité
Publicité

Introduction to ansible

  1. Introduction To Ansible Kasun Madura Rathnayaka. Senior Sys/Devops Engineer BSc (Hons) Electrical and Information, Engineering AWS Certified Solutions Architect Associate AMIE(SL),CCIP,RHCE,RHCSA,CCNA.ITIL kasunmaduraeng@gmail.com skype:kasunmadura141
  2. Continuous Integration Teams integrate their work multiple times per day. Each integration is verified by an automated build Significantly reduces integration problems Develop cohesive software more rapidly Source: Martin Fowler
  3. Continuous Integration
  4. Continuous Integration and Automation Tools ● CI Tools ○ Jenkins ,Teamcity ,Buildbot, Bamboo ● Automation Tools ○ Puppet,Chef,Ansible ● Version Control ○ svn,git,perforce ● Build Tool ○ Maven,ant,grant
  5. Ansible What is Anible ? Why we need Ansible ? Advantage and Disadvantages.. Compare with Puppet and Chef
  6. What is Ansible ● “radically simple IT automation platform” ● Describe the intended system state using playbooks written in YAML ● Requires no agent on the managed machine, only a Python interpreter and an SSH server
  7. Shell Script ● #!/bin/bash ● echo "fs.file-max=20000" | sudo tee -a /etc/sysclt.conf ● sudo apt-get -y install build-essential ● sudo mkdir -p /var/www/kasun ● sudo apt-get -y install apache2 ● sudo a2enmod rewrite ● sudo tee /etc/apache2/sites-available/mysite <<ENDOFFILE ● <VirtualHost *:80> ● DocumentRoot "/var/www/kasun/" ● ServerName www.kasun.com
  8. Ad-hoc configuration Configuration file /etc/ansible/ansible.cfg 1st ansible command :) $ cat >hosts [webservers] 192.168.1.40 ^D $ ansible -vvv all -i hosts -u root -m ping $ ansible -vvv webserver -i hosts -u root -m apt -a 'name=cowsay state=present' $ ssh 192.169.1.40 cowsay moo
  9. Playbooks Consolidate tasks and configuration knobs into a single YAML file Support templating—both in playbooks and in file templates—by way of Jinja2 Can be one file, or split up into many roles (more later!)
  10. Running a playbook • ansible-playbook playbook.yml • -i to specify a local inventory file (e.g. hosts) • -k if you have to enter a password for this run • Use authorized_key to install an SSH key for future runs
  11. Real Example Get the ball rolling :)
  12. Discussion Quiz
Publicité