Instantly share code, notes, and snippets.

View 00-output.txt
vars_secret_funky_json: !vault |
$ANSIBLE_VAULT;1.2;AES256;alan_host
35356666616633303337313766346562613961313262333530663432393965303736653334306433
6239666265343936343462653836386162343234353961330a306665396665353364613863316362
66646663313737393763383565333237316663666339623063646666646261643338616261633330
3634313634666264620a383632386661653330326435633861333031643334643237366430313733
3733
{
"vars_secret_funky_json": {
View AnsibleJSONDecoder-object_hook.diff
diff --git a/lib/ansible/parsing/ajson.py b/lib/ansible/parsing/ajson.py
index 7444a9f403..36c693dead 100644
--- a/lib/ansible/parsing/ajson.py
+++ b/lib/ansible/parsing/ajson.py
@@ -20,33 +20,27 @@ class AnsibleJSONDecoder(json.JSONDecoder):
_vaults = {}
+ def __init__(self, *args, **kwargs):
+ kwargs['object_hook'] = self.object_hook
View github-hashicorp-packer-6379.log
2018/06/13 10:10:05 [INFO] Packer version: 1.2.4
2018/06/13 10:10:05 Packer Target OS/Arch: darwin amd64
2018/06/13 10:10:05 Built with Go Version: go1.10.1
2018/06/13 10:10:05 Detected home directory from env var: /Users/matt
2018/06/13 10:10:05 Using internal plugin for parallels-iso
2018/06/13 10:10:05 Using internal plugin for amazon-chroot
2018/06/13 10:10:05 Using internal plugin for amazon-instance
2018/06/13 10:10:05 Using internal plugin for lxd
2018/06/13 10:10:05 Using internal plugin for null
2018/06/13 10:10:05 Using internal plugin for virtualbox-ovf
View with2loop.yml
---
- name: Playbook showcasing conversion from with_X loops to loop+filters
hosts: localhost
gather_facts: false
vars:
items:
-
- foo
-
- bar
View import_playbook_vars.diff
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 7391414949..0ec3e10e22 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -54,7 +54,7 @@ class Playbook:
pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)
return pb
- def _load_playbook_data(self, file_name, variable_manager):
+ def _load_playbook_data(self, file_name, variable_manager, vars=None):
View memrecap.py
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
View cherry-pick-pr.md

After submitting a PR to Ansible for the devel branch, and having it merged, the following instructions will help you create a pull request to backport the change to a previous stable branch

These instructions assume that stable-2.5 is the previous release branch.

  1. Update devel, to ensure you have the commit to cherry pick:

    git checkout devel
    git --fetch upstream
    git merge upstream/devel
    
View changelog.py
#!/usr/bin/env python
import os
import re
import mistune # mistune
from github import Github # PyGithub
from argparse import ArgumentParser
View duration.py
# Copyright (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import datetime
import itertools
import re
DURATION_RE = re.compile(
'(?P<sign>[-+]?)(?P<value>[0-9]*(?:\.[0-9]*)?)(?P<unit>[a-z]{1,2})'
)
View version.py
# Copyright: 2018, Matt Martz <matt@sivel.net>
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause )
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__all__ = ['Version', 'parse']
try:
from packaging.version import LegacyVersion, Version as Pep440Version, parse