记一次ansible-playbook jenkins传空格的标量导致删除了服务的主目录
jenkins传空格的标量导致删除了服务的主目录,请看红色的部分
ansible-playbook -i /data/XXXXXXXXX/springcloud.hosts /data/XXXXXXXXX/springCloud_update.yml -v --extra-vars 'deploy_file=/XXXXXXXXXXX/dev-payment-channel-quick/payment-channel/payment-channel-quick/target/payment-channel-quick.zip host_name=dev107 server_name= XXXXX dport=18030'
最终是因为shell传值过来为空格,,,修改为判断
- name: check | var is not nil
shell: if [ {{ item }} ];then echo "ok";else echo "failed***************" && exit 1;fi
with_items:
- "{{ SERVER }}"
- "{{ deploy_port }}"