Hi,
I’m trying to create a new puppet module using pdk (pdk new module moduleName) with ansible, but this command requires some prompts and I’m struggling to make it work.
I tried the ansible expect module, but without success.
Here’s the command from shell:
[fabiosakiyama@puppetmaster modules]$ pdk new module conf
pdk (INFO): Creating new module: conf
We need to create the metadata.json file for this module, so we're going to ask you 4 questions.
If the question is not applicable to this module, accept the default option shown after each question. You can modify any answers at any time by manually updating the metadata.json file.
[Q 1/4] If you have a Puppet Forge username, add it here.
We can use this to upload your module to the Forge when it's complete.
--> fabiosakiyama
[Q 2/4] Who wrote this module?
This is used to credit the module's author.
--> fabiosakiyama
[Q 3/4] What license does this module code fall under?
This should be an identifier from https://spdx.org/licenses/. Common values are "Apache-2.0", "MIT", or "proprietary".
--> Apache-2.0
[Q 4/4] What operating systems does this module support?
Use the up and down keys to move between the choices, space to select and enter to continue.
--> RedHat based Linux, Debian based Linux, Windows
Metadata will be generated based on this information, continue? Yes
Here’s the playbook task:
- name: Create conf module
expect:
chdir: /etc/puppetlabs/code/environments/production/modules/
command: /opt/puppetlabs/pdk/bin/pdk new module conf
responses:
.*: '\r'
.*: '\r'
.*: '\r'
.*: '\r'
.*: '\r'
I want to answer 'enter' to all answers, since there's a default answer. So i tried with '\r' and ' '.
Any help?
Thanks in advance!