diff --git a/doc/source/admin/index.rst b/doc/source/admin/index.rst
index 9e1bfa8..2aa5ec5 100644
--- a/doc/source/admin/index.rst
+++ b/doc/source/admin/index.rst
@@ -5,4 +5,12 @@ Administrators guide
 This guide describes how to build an `Ironic Python Agent`_-based image using
 the builders provided in the **ironic-python-agent-builder** project.
 
+diskimage-builder image
+-----------------------
+
+To build an image using diskimage-builder_, run::
+
+    ironic-python-agent-builder <distribution, e.g. ubuntu>
+
 .. _Ironic Python Agent: https://docs.openstack.org/ironic-python-agent
+.. _diskimage-builder: https://docs.openstack.org/diskimage-builder
diff --git a/doc/source/install/index.rst b/doc/source/install/index.rst
index 29221d5..510d2f7 100644
--- a/doc/source/install/index.rst
+++ b/doc/source/install/index.rst
@@ -4,5 +4,7 @@ Installing Ironic Python Agent Builder
 
 Download the ``ironic-python-agent-builder`` package from
 `tarballs.openstack.org
-<https://tarballs.openstack.org/ironic-python-agent-builder/>`_ or install it
-from your distribution's repositories.
+<https://tarballs.openstack.org/ironic-python-agent-builder/>`_, install it
+from your distribution's repositories or use pip::
+
+    pip install --user diskimage-builder ironic-python-agent-builder
diff --git a/ironic_python_agent_builder/__init__.py b/ironic_python_agent_builder/__init__.py
new file mode 100644
index 0000000..398e739
--- /dev/null
+++ b/ironic_python_agent_builder/__init__.py
@@ -0,0 +1,52 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import os
+import subprocess
+import sys
+
+
+LOCATIONS = [
+    '.',
+    os.path.join(sys.prefix, 'share', 'ironic-python-agent-builder'),
+]
+
+
+def find_elements_path():
+    for basedir in LOCATIONS:
+        final = os.path.join(basedir, 'dib')
+        if os.path.exists(os.path.join(final, 'ironic-python-agent-ramdisk')):
+            return final
+
+    sys.exit('ironic-python-agent-ramdisk element has not been found in any '
+             'of the following locations: %s' % ', '.join(LOCATIONS))
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("distribution", help="Distribution to use")
+    parser.add_argument("-o", "--output", help="Output base file name",
+                        default="ironic-python-agent")
+    parser.add_argument("-e", "--element", action='append', default=[],
+                        help="Additional DIB element to use")
+    # TODO(dtantsur): handle distribution == tinyipa
+    os.environ['ELEMENTS_PATH'] = find_elements_path()
+    args = parser.parse_args()
+    try:
+        subprocess.check_call(['disk-image-create', '-o', args.output,
+                               'ironic-python-agent-ramdisk',
+                               args.distribution] + args.element)
+    except (EnvironmentError, subprocess.CalledProcessError) as exc:
+        sys.exit(str(exc))
+    except KeyboardInterrupt:
+        sys.exit(127)
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..545678f
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+diskimage-builder>=1.0,!=1.6.0,!=1.7.0,!=1.7.1  # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index 621fdae..b92b75a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,6 +13,15 @@ classifier =
     License :: OSI Approved :: Apache Software License
     Operating System :: POSIX :: Linux
 
+[entry_points]
+console_scripts =
+    ironic-python-agent-builder = ironic_python_agent_builder:main
+
+[files]
+# TODO(dtantsur): figure out a sane way to distribute tinyipa scripts
+data_files =
+    share/ironic-python-agent-builder/dib = dib/*
+
 [build_sphinx]
 all-files = 1
 warning-is-error = 1
diff --git a/test-requirements.txt b/test-requirements.txt
index c574c45..92c0146 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,6 +2,10 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 
+# pep8
+hacking>=1.0.0,<1.2.0 # Apache-2.0
+flake8-import-order>=0.13 # LGPLv3
+# documentation
 doc8>=0.6.0 # Apache-2.0
 sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
 sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
diff --git a/tox.ini b/tox.ini
index 9ad8ddc..b9bae4d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,9 @@ deps = -r{toxinidir}/test-requirements.txt
 
 [testenv:pep8]
 basepython = python3
-commands = doc8 doc/source README.rst CONTRIBUTING.rst
+commands =
+    flake8 ironic_python_agent_builder
+    doc8 doc/source README.rst CONTRIBUTING.rst
 
 [testenv:venv]
 basepython = python3
@@ -27,3 +29,15 @@ commands = python setup.py build_sphinx
 basepython = python3
 commands =
   sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
+
+[flake8]
+exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,imagebuild/tinyipa/tinyipafinal,imagebuild/tinyipa/tinyipabuild
+import-order-style = pep8
+application-import-names = ironic_python_agent_builder
+# [H106] Don't put vim configuration in source files.
+# [H203] Use assertIs(Not)None to check for None.
+# [H204] Use assert(Not)Equal to check for equality.
+# [H205] Use assert(Greater|Less)(Equal) for comparison.
+# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
+# [H904] Delay string interpolations at logging calls.
+enable-extensions=H106,H203,H204,H205,H210,H904