Following discussions with @zeljkofilipin and @dduvall, we need a diskimage-builder element to execute puppet when creating the image.
@hashar wrote a thin wrapper with https://gerrit.wikimedia.org/r/#/c/234300/ . One can fetch that patch on integration-dev.integration.eqiad.wmflabs which has all the required packages.
Then install diskimage 1.47 (and potentially other requirements):
pip install --user -rdib/requirements.txt export PATH=~/local/bin/
diskimage-builder uses debootstrap to creates a base Debian jessie system. That is rather long but cacheable using the DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE env variable. So to build an image:
cd dib DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE=1 ./build_image.py
OpenStack has a puppet element already https://github.com/openstack-infra/project-config/tree/master/nodepool/elements/puppet . You can clone it and then point diskimage-builder to it using the ELEMENTS_PATH variable.
git clone https://github.com/openstack-infra/project-config # hack build_image.py to insert the 'puppet' element ELEMENTS_PATH=project-config/nodepool/elements DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE=1 ./build_image.py
It is all hardcoded for OpenStack usage though. I have poked upstream to have the element upstreamed to diskimage-builder though I haven't insisted.
We probably want our own element in integration/config.git /dib/ based on https://github.com/openstack-infra/project-config/blob/master/nodepool/elements/puppet/bin/prepare-node . Maybe name it wikimedia-puppet.