模拟jenkins通过shell给ansible传入变量

jenkins.sh

#!/bin/bash

name1='robin h h li'
age1='11'

declare -A dic
dic=(
[name1]="${name1}"
[age1]="${age1}"

)

run_icp.sh

#!/bin/bash

. jenkins.sh
name1=${dic['name1']}
age1=${dic['age1']}

ansible-playbook -i '127.0.0.01,' ../ansible-test/ansible-test/site.yml -e "ansible_ssh_user='root' ansible_ssh_pass='password' name1='${name1}' age1='${age1}'" -vvv

posted @ 2019-07-19 00:10  李欢欢  阅读(961)  评论(0编辑  收藏  举报