Skip to content

Instantly share code, notes, and snippets.

@mkrizek
Created December 11, 2017 20:49
Show Gist options
  • Save mkrizek/77df149b0bb0ee6ec766a50875de0edb to your computer and use it in GitHub Desktop.
Save mkrizek/77df149b0bb0ee6ec766a50875de0edb to your computer and use it in GitHub Desktop.
#!/bin/bash
TMP_DIR=tmp_group_vars
mkdir -p $TMP_DIR/{dir,group_vars,inv}/
cat > $TMP_DIR/playbook.yml << EOF
- include: dir/playbook2.yml
EOF
cat > $TMP_DIR/group_vars/all << EOF
group_vars_variable_play: true
EOF
cat > $TMP_DIR/dir/playbook2.yml << EOF
- hosts: localhost
tasks:
- debug: var=group_vars_variable_play
EOF
touch $TMP_DIR/inventory
touch $TMP_DIR/inv/inventory
ansible-playbook -i $TMP_DIR/inv/inventory $TMP_DIR/playbook.yml
ansible-playbook -i $TMP_DIR/inventory $TMP_DIR/playbook.yml
rm -rf $TMP_DIR/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment