# How can i  include entire shell script block in ansible playbook

**URL:** <https://forum.ansible.com/t/how-can-i-include-entire-shell-script-block-in-ansible-playbook/28300>\
**Category:** Ansible Developer\
**Created:** [August 9, 2018, 3:46pm UTC](https://forum.ansible.com/t/how-can-i-include-entire-shell-script-block-in-ansible-playbook/28300 "2018-08-09T15:46:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![onenessboy](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@onenessboy](https://forum.ansible.com/u/onenessboy)\
**Post date:** [August 9, 2018, 3:46pm UTC](https://forum.ansible.com/t/how-can-i-include-entire-shell-script-block-in-ansible-playbook/28300/1 "2018-08-09T15:46:38Z")

</div>

Hi all,

I have some sample script

#!/bin/bash  
#ip=$2  
tar\_file=$1  
bkp\_name=“bkp-$$”

if [-z “${tar\_file}”]; then  
echo “Usage import.sh [tar file]”  
exit 1  
fi  
for keyspace  
do  
keyspace=$(basename “${tar\_file}” “.tar.gz”)

mkdir -p “${bkp\_name}”

tar -xvzf “${tar\_file}” -C “${bkp\_name}”

echo “Drop keyspace ${keyspace}”  
cqlsh localhost -e “drop keyspace "${keyspace}";”

echo “Create empty keyspace: ${keyspace}”  
cat “${bkp\_name}/${keyspace}.sql” | cqlsh localhost

for dir in “${bkp\_name}/${keyspace}/”\*; do  
sstableloader -d localhost${dir}"  
done  
done

How can I include entire script above in ansible-playbook …?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [August 9, 2018, 8:51pm UTC](https://forum.ansible.com/t/how-can-i-include-entire-shell-script-block-in-ansible-playbook/28300/2 "2018-08-09T20:51:09Z")

</div>

This is a question for ansible-project, in any case, use the script module
