- name: deploy | 获取branch
set_fact:
branch: "{{serviceNAME.split('-')[-2] }}"
- debug: var=branch
- name: deploy | 获取commitid
set_fact:
commitid: "{{serviceNAME.split('-')[-1] }}"
- debug: var=commitid
- name: deploy | 获取commitid
set_fact:
commitid: "{{commitid.split('.')[0]}}"
- debug: var=commitid
TASK [debug] **********************************************************************************************************************************************************
ok: [10.111.0.2] => {
"serviceNAME": "yt-sync-center-master-72b45076.zip"
}
TASK [deploy | 获取branch] **********************************************************************************************************************************************
ok: [10.111.0.2]
TASK [debug] **********************************************************************************************************************************************************
ok: [10.111.0.2] => {
"branch": "master"
}
TASK [deploy | 获取commitid] ********************************************************************************************************************************************
ok: [10.111.0.2]
TASK [debug] **********************************************************************************************************************************************************
ok: [10.111.0.2] => {
"commitid": "72b45076.zip"
}
TASK [deploy | 获取commitid] ********************************************************************************************************************************************
ok: [10.111.0.2]
TASK [debug] **********************************************************************************************************************************************************
ok: [10.111.0.2] => {
"commitid": "72b45076"
}
PLAY RECAP ************************************************************************************************************************************************************
10.111.0.2 : ok=22 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- name: deploy | 获取commitid
set_fact:
commitid: "{{commitid.split('.zip')[0]}}"
- debug: var=commitid
网友评论