Skip to content

Instantly share code, notes, and snippets.

@johnduarte
Last active January 21, 2019 19:36
Show Gist options
  • Save johnduarte/f3b557d8c94d78c47646f7a9a6482515 to your computer and use it in GitHub Desktop.
Save johnduarte/f3b557d8c94d78c47646f7a9a6482515 to your computer and use it in GitHub Desktop.
diff --git a/.flake8 b/.flake8
new file mode 100644
index 0000000..5429527
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,16 @@
+[flake8]
+ignore = W503
+max-line-length = 80
+pytest_mark1 = name=test_id
+ value_match=uuid
+ enforce_unique_value=true
+ exclude_methods=true
+pytest_mark2 = name=jira
+ regex_match=[a-zA-Z]+-\d+
+ allow_multiple_args=true
+ exclude_methods=true
+pytest_mark3 = name=test_case_with_steps
+ exclude_methods=true
+ exclude_functions=true
+filename_check1 = filter_regex=test_.+
+ filename_regex=test_[\w-]+$
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d9a047d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,112 @@
+# Molecule
+.molecule
+
+# PyCharm / JetBrains project stuff
+.idea/
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+*.pyc
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+.static_storage/
+.media/
+local_settings.py
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..449a37c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+---
+language: python
+python:
+ - "2.7"
+install:
+ pip install -r requirements.txt
+script:
+ flake8
diff --git a/README.md b/README.md
index d2c3f4b..617a5a6 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,10 @@
Role Name
=========
-A brief description of the role goes here.
+This is a simple test repo using the [molecule framework](https://molecule.readthedocs.io/en/latest/)
+for deploying system state via [ansible](https://www.ansible.com/)
+and validating that state using
+[infratest](https://testinfra.readthedocs.io/en/latest/).
Requirements
------------
@@ -27,10 +30,31 @@ Including an example of how to use your role (for instance, with variables passe
roles:
- { role: my_molecule, x: 42 }
+Generate Molecule Config from Ansible Dynamic Inventory
+-------------------------------------------------------
+
+The `moleculerize.py` script will build molecule config files from a RPC-O Ansible dynamic inventory file. As a
+prerequisite to using the `moleculerize.py` script a dynamic inventory must be generated from a RPC-O build:
+
+```
+sudo su -
+cd /opt/openstack-ansible/playbooks/inventory
+./dynamic_inventory.py > /path/to/dynaic_inventory.json
+```
+
+Now you can generate a `molecule.yml` config file using the `moleculerize.py` script:
+
+```
+./moleculerize.py /path/to/dynaic_inventory.json
+```
+
+The above command assumes that the `templates/molecule.yml.j2` template will be used along with `molecule.yml` as
+the output file.
+
License
-------
-BSD
+Apache
Author Information
------------------
diff --git a/constraints.txt b/constraints.txt
new file mode 100644
index 0000000..6c513d7
--- /dev/null
+++ b/constraints.txt
@@ -0,0 +1,5 @@
+ansible==2.4.3
+flake8-pytest-mark>=1.0.0,<2.0.0
+magic-marker>=1.0.0,<2.0.0
+molecule~=2.14
+pytest-rpc>=0.12.0
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..348d40e
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,7 @@
+-c constraints.txt
+ansible
+flake8-filename
+flake8-pytest-mark
+magic-marker
+molecule
+pytest-rpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment