Skip to content

Instantly share code, notes, and snippets.

View StalkingKillah's full-sized avatar

Djordje Stojanovic StalkingKillah

  • Ursus Software
  • Nis, Serbia
View GitHub Profile
from ansible import errors, runner
def tail(lines, num_lines=1, delimiter='\n'):
if type(lines) is unicode or type(lines) is str:
lines = str(lines).split(delimiter)
# remove empty lines
lines = remove_empty_elements(lines)
end = len(lines)
start = end-num_lines
return lines[start:end]
@StalkingKillah
StalkingKillah / digitalocean
Last active January 28, 2017 17:58
Ansible Dynamic Inventory for DigitalOcean Droplets
#!/usr/bin/env python
# encoding: utf-8
"""
digitalocean
Created by Djordje Stojanovic <[email protected]>
Based on DigitalOcean inventory plugin:
https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/digital_ocean.py
"""