Skip to content

Instantly share code, notes, and snippets.

@mkrizek
Last active November 9, 2017 15:41
Show Gist options
  • Save mkrizek/29f8c5b4882819601578c1bb3cfa53ef to your computer and use it in GitHub Desktop.
Save mkrizek/29f8c5b4882819601578c1bb3cfa53ef to your computer and use it in GitHub Desktop.
#!/bin/bash
TMP_DIR=tmp_include_roles_repro
mkdir -p $TMP_DIR/roles/{x,y}/tasks
cat > $TMP_DIR/playbook.yml << EOF
- hosts: localhost
tasks:
- set_fact:
role_name_in_fact: "x"
- name: role name stored in a fact
include_role:
name: "{{ role_name_in_fact }}"
EOF
ansible-playbook $TMP_DIR/playbook.yml -vvv
rm -rf $TMP_DIR/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment