diff --git a/roles/build-puppet-module/README.rst b/roles/build-puppet-module/README.rst index edf50c5e4..ec3a6dacb 100644 --- a/roles/build-puppet-module/README.rst +++ b/roles/build-puppet-module/README.rst @@ -1,5 +1,11 @@ -An ansible role to build a Puppet module. This role assumes that Puppet is -already installed on the target system (either manually or using bindep). +An Ansible role to build a Puppet module using the Puppet +Development Kit (PDK). + +.. note:: + + This role requires installed Ruby, Ruby development and build tools + (gcc/g++ and make) packages, they can be installed using the + :zuul:role:`install-pdk-dependencies` role. **Role Variables** diff --git a/roles/build-puppet-module/tasks/main.yaml b/roles/build-puppet-module/tasks/main.yaml index a8188696c..4fd62dfbf 100644 --- a/roles/build-puppet-module/tasks/main.yaml +++ b/roles/build-puppet-module/tasks/main.yaml @@ -1,4 +1,14 @@ +- name: Find out ruby gem user directory + command: ruby -e 'puts Gem.user_dir' + register: gem_user_dir + +- name: Install pdk gem + gem: + name: pdk + - name: Build puppet module - command: puppet module build . + command: pdk build --force args: chdir: "{{ puppet_module_chdir }}" + environment: + PATH: "{{ gem_user_dir.stdout }}/bin:{{ ansible_env.PATH }}"