With connection: network_cli, the provider dictionary is no longer necessary. Here is a quick rundown of provider keys and their variable and commandline equivalents
| provider | inventory variable | commandline |
|---|---|---|
| host | ansible_host | N/A |
| port | ansible_port | N/A |
| import sys | |
| from datetime import datetime | |
| from dateparser import parse | |
| def main(): | |
| date = parse(" ".join(sys.argv[1:])) | |
| now = datetime.now() |
| // ==UserScript== | |
| // @name Blaseball Hex Innings | |
| // @namespace http://linkybook.com | |
| // @version 0.3 | |
| // @description Rewrite extra innings in hexdecimal | |
| // @author Qalthos | |
| // @match https://blaseball.com/* | |
| // @match https://www.blaseball.com/* | |
| // ==/UserScript== |
| #!/usr/bin/env python | |
| def slurp_file(filename): | |
| with open(filename) as file_obj: | |
| return file_obj.readlines() | |
| def main(): | |
| lines = slurp_file("tests/sanity/ignore-2.9.txt") | |
| # lines = slurp_file("tests/sanity/ignore-2.10.txt") |
| #!/usr/bin/env python3 | |
| import argparse | |
| import requests | |
| TEMPLATE = """ | |
| {date} | |
| ========== | |
| {content} |
| from __future__ import unicode_literals, print_function | |
| from ansible.module_utils.basic import AnsibleModule, return_values | |
| DOCUMENTATION = ''' | |
| --- | |
| module: napalm_cli | |
| author: "Charlie Allom" | |
| version_added: "2.2" | |
| short_description: "Executes network device CLI commands and returns response using NAPALM" |
With connection: network_cli, the provider dictionary is no longer necessary. Here is a quick rundown of provider keys and their variable and commandline equivalents
| provider | inventory variable | commandline |
|---|---|---|
| host | ansible_host | N/A |
| port | ansible_port | N/A |
| #!/bin/bash | |
| BACKUP=/data/backup/$(hostname) | |
| DATE="$(date '+%Y-%m-%d--%H-%M')" | |
| OPTS='-amxHAX --partial --delete --delete-excluded --exclude-from=.exclude --rsh=ssh --link-dest=../current' | |
| IGNORE_ERROR=(0 23 24) | |
| if [ "$1" == "-v" ]; then | |
| OPTS="$OPTS -vh --progress" | |
| fi | |
| pushd ~ > /dev/null |
| # Mount drive here | |
| dd if=/dev/zero of=/path/to/mount/zero | |
| # Unmount drive here | |
| sudo dd if=/dev/whatever bs=4k | pv | 7za a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z -bd |
| #!/usr/bin/env python | |
| from __future__ import unicode_literals, print_function | |
| import os | |
| import re | |
| import mutagen | |
| for path, dirs, files in os.walk('old'): |
| import eventbrite | |
| eb_tokens = dict(app_key='APPLICATION_KEY') | |
| eb_cl = eventbrite.EventbriteClient(eb_tokens) | |
| response = eb_cl.event_list_attendees(dict(id='8645022495', | |
| only_display='first_name,last_name,answers')) | |
| attendees = list() | |
| for a_dict in response['attendees']: | |
| a_dict = a_dict['attendee'] |