iknite / cookiecutter-ansible-role Goto Github PK
View Code? Open in Web Editor NEWCookie cutter recipe to easily create ansible roles.
License: BSD 3-Clause "New" or "Revised" License
Cookie cutter recipe to easily create ansible roles.
License: BSD 3-Clause "New" or "Revised" License
Currently this cookiecutter is not following at least three of the Ansible Galaxy best practices:
Thoughts?
Found it by accident. I figured you'd like to know :)
post_gen_project.py is calling a cookiecutter function that is only found in this fork:
https://github.com/luzfcb/cookiecutter
from cookiecutter.prompt import query_yes_no
should be
from cookiecutter.prompt import read_user_yes_no
and the function calls changed accordingly. Note, you must provide a default_value in the call now.
def configure_role():
print('\n\nROLE CONFIGURATION:\n===================')
for folder_name, folder in folders.items():
if read_user_yes_no(folder['question'], default_value=u'yes'):
try:
# this file has to be there, git doesn't store empty folders.
os.remove(os.path.join(folder_name, '.empty'))
except OSError:
pass
if 'hint' in folder:
with open('{}/main.yml'.format(folder_name), 'a') as fp:
if 'pre_hint' in folder:
if read_user_yes_no(folder['pre_hint'], default_value=u'yes'):
fp.write(folder['pre_action'])
Currently generated roles do not include any test facility.
I'll provide a pull request that implements testing with Test-Kitchen configured with the kitchen-docker driver,
and kitchen-inspec.
Let's talk about this :)
Thank you for this repo, it's a terrific time saver. One issue I noticed:
if read_user_yes_no(folder['question'], default_value=u'no'):
if read_user_yes_no(folder['pre_hint'], default_value=u'no'):
Should be
if read_user_yes_no(folder['question'], default_value=u'no') == 'yes':
if read_user_yes_no(folder['pre_hint'], default_value=u'no') == 'yes':
Otherwise they always evaluate to true and we are still prompted for the values if we set the default to 'no'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.