Skip to content

Instantly share code, notes, and snippets.

@anthonyinfinity
Last active March 27, 2020 00:14
Show Gist options
  • Save anthonyinfinity/8bf9b4906d9851e5cbe88fdce4d7c60d to your computer and use it in GitHub Desktop.
Save anthonyinfinity/8bf9b4906d9851e5cbe88fdce4d7c60d to your computer and use it in GitHub Desktop.
New ansible role. Add it to /usr/local/bin/newarproj and sh newarproj.sh pythonversion projectname to init a role dir.
#!/bin/sh
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# Usage: $ sh newarproj.sh pythonversion projectname
molecule init role -r $2 && \
cd $2 && CURDIR=$(PWD)\
pyenv local $1 && \
pyenv virtualenv venv-$2 && \
pyenv local venv-$2 && \
pyenv activate venv-$2
cd ${CURDIR} && \
pip install git+https://github.com/ansible/ansible.git@devel
cd ${CURDIR} && \
pip install -r https://gist.githubusercontent.com/anthonyinfinity/c2f9681209a70de0a188718ebcdc9c67/raw/6011f19a6088279ceb6d3e823321f9dfe14c0039/base-role-requirements.txt && \
pip freeze -l > requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment