Ansible tips & tricks

  • View
    4.208

  • Download
    0

Embed Size (px)

Text of Ansible tips & tricks

  1. 1. Tips & Tricks Not your usual usage Ansible Fest NYC 2015
  2. 2. #>whoami currently: ansible core team member (bcoca) helpdesk/application support programmer/analyst/software engineer QA, systems & network administrator release manager, DBA, information security, Tech Janitor
  3. 3. #>apropos ansible Configuration management Release management Automation framework Orchestration system Distributed batch executor ____________________ / It runs a TASK * x on a HOST * x / --------------------^__^(oo)_______ (__) )/ ||----w | || ||
  4. 4. #LIVE>multiply_shell allows you to reuse your shell magic must be non interactive plays well with traditional unix tools just multiply by ### hosts requires some work for nicer outputs -t == json file database per host
  5. 5. #LIVE>ansible_shell #>ansible webs -m shell -a "awk '{print $9}' /var/log/nginx/access.log|sort |uniq -c |sort -k1,1nr 2>/dev/null|column -t" web1 | success | rc=0 >> 204417 200 48108 304 8550 302 6541 301 1696 404 269 206 web2 | success | rc=0 >> 205807 200 43762 304 ...
  6. 24. #HACK>abstract package Redhat.yml --- apache_user: httpd apache_group: httpd apache_config: /etc/httpd/conf/httpd.conf apache_pkgs: - httpd - mod_ssl - php-fpm apache_service: httpd
  7. 25. #HACK>abstract package Debian.yml --- apache_user: www-data apache_group: www-data apache_config: /etc/apache2/httpd.conf apache_pkgs: - apache2-mpm - libapache2-mod-ssl - php5-fpm apache_service: apache2 __________________ / can break apachectl utils / ------------------ .--. |o_o | |:_/ | // (| | ) /'_ _/` ___)=(___/
  8. 26. #THE END>wait 6 && exit Ansible was born to play well with Unix Roles allow for reuse and sharing Plugins are where you code Plugins are useful to non programmers. callbacks, lookups, filters, etc are also plugins Many ways to make Ansible work for you __________ < goodbye! > ----------^__^(oo)_______ (__) )/ ||----w | || ||