jenkins and ansible reference
TRANSCRIPT
INTRODUCTION
• Simple automation tool • Lightweight automation tool • Execute one-time tasks• Perform system administration tasks• Configure servers and routers• Gather information about devices
INTRODUCTION
• Written in Python- easy to read and extend
• Open source- source code on GitHub
• Easy to install and run- get started in just a few minutes
INSTALL AND CONFIGURATION• CentOS / Fedora
- enable the EPEL repository- yum install ansible
• Ubuntu / Debian - apt-add-repository ppa:ansible/ansible- apt-get install ansible
• Any operating system- create a virtualenv- pip install ansible
AD-HOC COMMANDS
- Runs a command or call a module directly from the command line, no Playbook required
ansible <inventory> <options>ansible web –a /bin/dateansible db -m pingansible web -m yum -a “name=nginx state=latest”
PLAYBOOKS
• Written in YAML - human-readable
• Variable definitions • Handlers
- take action upon changes • Reusable
- save for the future, share with colleagues, etc
PLAYBOOKS
• How it works - Playbook contain plays- Plays contain tasks- Tasks call module- Tasks run sequentially- Handlers are triggered by tasksand run once, at the end plays
PLAYBOOKS • Ansible uses the Jinja template engine
- variable substitution - conditionals and loops (if, for) - filters to transform text
• Templates are just text file- text {{ ... }} undergoes variable substitution - text {% ... %} marks conditionals and loops- everything else is passed through
PLAYBOOKS• Best practice- group_vars- host_vars- inventory- roles
- task- handlers- templates
- README
VARIABLES
• Facts- running OS
• Registered variables - Values from earlier tasks
• Host declaration - Inventory file - host_vars & group_vars
ANSIBLE-GALAXY
• Library for roles - https://galaxy.ansible.com/list#/roles- More than 11.000 roles- Not always easy to find the best role!
ansible-galaxy install author.role
ANSIBLE OVIRT MODULESovirt_auth (E) - Manage authentication ovirt_disks (E) - Manage VM and floating disksovirt_host_networks (E) - Manage host networksovirt_host_pm (E) - Manage power managementovirt_hosts (E) - Manage hosts in oVirtovirt_hosts_facts (E) - Retrieve facts about one or more oVirt hostsovirt_vms (E) - Module to manage VM
WHAT IS JENKINS?
• Continuous integration and continuous delivery• Open source • Java• Servlet• More and more features with plugin
FEATURES
• Easy installation• Easy configuration• Rich plugin ecosystem• Extensibility• Distributed builds