This file contains hidden or 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
| """ ansible runner demo | |
| """ | |
| from functools import reduce | |
| import operator | |
| import yaml | |
| import ansible_runner | |
| def dict_get(data_dict, keypath): | |
| map_list = keypath.split('.') |
This file contains hidden or 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
| PLAY [all] ************************************************************************************************************************************************************************* | |
| TASK [gather_states : Build a list of state gatherers] ***************************************************************************************************************************** | |
| ok: [eos101] | |
| ok: [vyos101] | |
| ok: [eos102] | |
| ok: [ios102] | |
| ok: [nxos101] |
This file contains hidden or 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
| import os | |
| from ansible.parsing.plugin_docs import read_docstring | |
| from pprint import pprint | |
| import csv | |
| import yaml | |
| path = "./ansible/" |
This file contains hidden or 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
| #!/bin/bash | |
| ############ | |
| # run this file as `source build.sh` | |
| ############ | |
| # venv | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install wheel | |
| pip install paramiko |
This file contains hidden or 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
| from datetime import datetime, timezone | |
| import dateutil.parser | |
| from github3 import GitHub | |
| GITHUB_TOKEN = os.getenv('GITHUB_TOKEN') | |
| github = GitHub(token=GITHUB_TOKEN) | |
| org = github.organization('ansible-collection-migration') |
This file contains hidden or 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
| # (venv) ➜ argspec_test python go.py | |
| # Estimated file length is 3121 | |
| # Loading python file took 0.1354 seconds | |
| # Loading yaml(python parser) file took 4.1489 seconds | |
| # Loading yaml(C parser) file took 0.4825 seconds | |
| # (venv) ➜ argspec_test | |
| import contextlib |
This file contains hidden or 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
| import astor | |
| import ast | |
| import ruamel.yaml | |
| import os | |
| import re | |
| import sys | |
| COLPATH = "./" | |
| COLLECTION = "arista.eos" | |
| SUBDIRS = ("modules", "action") |
This file contains hidden or 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
| from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( | |
| NetworkTemplate, | |
| ) | |
| class MyTemplate(NetworkTemplate): | |
| def __init__(self, lines=None): | |
| super(MyTemplate, self).__init__(lines=lines, tmplt=self) | |
| PARSERS = [ |
This file contains hidden or 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
| from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( | |
| NetworkTemplate, | |
| ) | |
| class MyTemplate(NetworkTemplate): | |
| def __init__(self, lines=None): | |
| super(MyTemplate, self).__init__(lines=lines, tmplt=self) | |
| PARSERS = [ |
This file contains hidden or 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
| (venv) ➜ parser_plugin ansible-playbook iptables.yml | |
| [WARNING]: No inventory was parsed, only implicit localhost is available | |
| [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' | |
| PLAY [localhost] ******************************************************************************************************************************************** | |
| TASK [command] ********************************************************************************************************************************************** | |
| changed: [localhost] | |
| TASK [debug] ************************************************************************************************************************************************ |