1
我有一個使用可靠命令的yml文件。裏面的文件我正在附加服務的位置,以現有的環境路徑如下:如何應用檢查確認其他環境路徑是否已經存在?
-name: retreiving the path
raw: $ENV:PATH
register: path_out
- name: adding the services to the environment path
raw: SETX /M PATH "$ENV:PATH;{{item.service_path}}"
with_items:
"{{ services }}"
那麼,什麼情況是,當腳本執行的時候會追加到即使相同的服務現有的環境路徑服務路徑每次路徑是以前添加的,這會一次又一次地創建相同服務路徑的附加。因此,我想要的是檢查,以確認是否已經添加service_path它不會在最後再加上它。我試過但沒有幫助:
- name: adding the services to the environment path
raw: SETX /M PATH "$ENV:PATH;{{item.service_location}}"
with_items:
"{{ services }}"
when : ansible_env.PATH;{{item.service_location}}.exists is not defined
它不工作,請幫助如何檢查?平臺是我工作的窗口