Quick Ansible playbook for installing Sysdig

Been thinking about Sysdig, and how it can be used for troubleshooting. One thought I had was to capture events during an Ansible playbook run in the event there were any problems. Now I’m not sure how practical that is just yet, but the first task was getting Sysdig installed. Of course, that meant writing an Ansible playbook to do so (really should have been a role probably but baby steps).

You can find the sysdig.yml file for Ubuntu/Debian in my test playbooks repository on GitHubhttps://github.com/jfrappier/ansible-test-playbooks

Playbook is based on the directions from sysdig.org, and tested on Ubuntu 14.04. As always, I am still learning here but feel free to update as you see fit and take it all with a grain of salt.

---
- hosts: parent
  vars:
      package: sysdig
      sysdig_key_url: https://s3.amazonaws.com/download.draios.com
      sysdig_key: DRAIOS-GPG-KEY.public
      dl_dir: /downloads
      sysdig_repo: http://download.draios.com/stable/deb stable-$(ARCH)/
      linux_headers: linux-headers-
  remote_user: [ENTERUSER]
  sudo: yes

  tasks:
  - name: Validating download directory
    file: path= state=directory

  - name: Download Sysdig public key
    get_url: url=/ dest= validate_certs=no

  - name: Installing Sysdig public key
    apt_key: file=/ state=present

  - name: Adding Sysdig apt repository
    apt_repository: repo='deb ' state=present

  - name: Update apt repositories
    apt: update_cache=yes

  - name: Install Linux Headers
    apt: name= state=present

  - name: Install Sysdig
    apt: name= state=present

Modules used in this playbook:

  • http://docs.ansible.com/apt_repository_module.html
  • http://docs.ansible.com/apt_key_module.html
  • http://docs.ansible.com/apt_module.html
  • http://docs.ansible.com/file_module.html
  • http://docs.ansible.com/get_url_module.html