Update pre_ansible.sh

use function to apply initialization