Skip to content

Instantly share code, notes, and snippets.

@mkrizek
Created February 26, 2018 13:08
Show Gist options
  • Save mkrizek/f47bc1f4401d26487009e7f83f4edeb7 to your computer and use it in GitHub Desktop.
Save mkrizek/f47bc1f4401d26487009e7f83f4edeb7 to your computer and use it in GitHub Desktop.
36028.sh
#!/bin/bash
DIR=tmp_36028
mkdir -p $DIR/roles/my_role/{tasks,library}
cat > $DIR/playbook.yml << EOF
- hosts: localhost
gather_facts: no
pre_tasks:
- ping:
roles:
- my_role
EOF
cat > $DIR/roles/my_role/library/ping.py << EOF
#!/usr/bin/python
print('{"failed": false, "msg": "MODULE IN ROLE"}')
EOF
cat > $DIR/roles/my_role/tasks/main << EOF
- ping:
EOF
cat > $DIR/inventory << EOF
EOF
ansible-playbook -i $DIR/inventory $DIR/playbook.yml -v
rm -rf $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment