Ansible自动化配置Flutter环境

安装:

python>2.6

brew install ansible

brew install http://git.io/sshpass.rb

ansible --version

 

hosts

all:
  children:
    servers:
      hosts:
        10.23.2.147:
          ansible_ssh_user: xxxx
          ansible_ssh_pass: "xxxx123"
          ansible_become_pass: "xxxx123"

 

need_copy_flutter.sh

#!/bin/sh

# 判断是否需要拉取 flutter
function NEED_COPY_HISTORY() {
	if [ -d "/Users/live/flutter/" ]; then
		cd ~/flutter
		NEED_COPY_FLUTTER=$(git status | grep v1.9.1 | wc -l)
		if [ NEED_COPY_FLUTTER > 0 ]; then 
			return
		fi
	fi 
	echo "need copy flutter"
}

NEED_COPY_HISTORY

 

 

playbook文件

xxxx.yaml

---
- hosts: servers
  remote_user: root
  tasks:
    - name: copy shell script
      copy: dest=test src=/etc/ansible/test.sh
    - name: execute shell script
      shell: sh test/test.sh

 

在所有host执行playbook

ansible-playbook xxxx.yaml

 

配置流程

手动执行xcode-select --install,权限问题

传输xcode 10g 14min30s

传输Android sdk 17.18g 20min

 

问题记录

1、执行xcode-select --install安装命令行开发工具会弹窗

解决方案:使用AppleScript点击确认

xcode-select --install
sleep 1

osascript <<EOD
  tell application "System Events"
    tell process "Install Command Line Developer Tools"
      keystroke return
      click button "Agree" of window "License Agreement"
    end tell
  end tell
EOD

AppleScript执行过程中发现需要控制权限【待解决】

点击确认之后还会有个协议需要点击同意

 

2、flutter doctor执行过程中

Agreeing to the Xcode/iOS license requires admin privileges

sudo xcodebuild -license

之后阅读证书需要space翻页到底,键入agree回车

 

 

3、flutter doctor执行过程中。

弹窗需要输入密码,点击安装软件

 

4、android证书

flutter doctor --android-licenses

需要两次y回车

 

5、测试的host机器环境是macOS Catelina 10.15.2,其他版本弹窗、权限等可能情况不完全一样。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值