This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: How to create a simple Ansible module | |
author: Felix Fontein | |
abstract: | | |
A brief tutorial on how to create a simple Ansible module in Python. | |
(This talk does not touch Windows PowerShell modules.) | |
language: Slides (English), Talk (German or English) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re | |
OIDs = dict() | |
names_lookup = dict() | |
def convert_for_lookup(name): | |
return name.replace('-', '_') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Can be used in an Ansible module to check whether a certificate is revoked using OCSP. | |
# Needs filenames of certificate and intermediate certificate. | |
import base64 | |
import os | |
import re | |
import tempfile | |
import traceback | |
from ansible.module_utils.basic import AnsibleModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import binascii | |
import cryptography | |
import datetime | |
import math | |
from cryptography.hazmat.backends import default_backend | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85,126c85 | |
< | |
< """Note: We also monkey-patch subprocess for python 2.6 to | |
< give feature parity with later versions. | |
< Monkey-patch from http://pydoc.net/pep8radius/0.9.0/ with slight modifications | |
< MIT Licence | |
< | |
< Remove patch when Python 2.6 is no longer supported | |
< """ | |
< import subprocess |
NewerOlder