-請問Ansible如何做到多行正規化比對刪除 - Linux
By Elvira
at 2019-12-18T21:02
at 2019-12-18T21:02
Table of Contents
剛接觸Ansible沒多久
之前使用shell script很簡單處理的東西
用Ansible處理變得不是很上手
比如用sed比對一個區塊內容並且刪除
針對檔案內容是
set private-key "-----BEGIN ENCRYPTED PRIVATE KEY-----/
aaaaaa
bbbbbb
cccccc
/-----END ENCRYPTED PRIVATE KEY-----
用以下的指令就很簡單就可以處理
sed -i '/set private-key "-----BEGIN ENCRYPTED PRIVATE KEY-----/,/-----END
ENCRYPTED PRIVATE KEY-----"/d'
但轉用ansible試了好久卻得不到相同的效果,目前有試過blockinfile,卻不是很搞的
清楚marker相關的語法要怎麼下?
--
之前使用shell script很簡單處理的東西
用Ansible處理變得不是很上手
比如用sed比對一個區塊內容並且刪除
針對檔案內容是
set private-key "-----BEGIN ENCRYPTED PRIVATE KEY-----/
aaaaaa
bbbbbb
cccccc
/-----END ENCRYPTED PRIVATE KEY-----
用以下的指令就很簡單就可以處理
sed -i '/set private-key "-----BEGIN ENCRYPTED PRIVATE KEY-----/,/-----END
ENCRYPTED PRIVATE KEY-----"/d'
但轉用ansible試了好久卻得不到相同的效果,目前有試過blockinfile,卻不是很搞的
清楚marker相關的語法要怎麼下?
--
Tags:
Linux
All Comments
By Victoria
at 2019-12-23T14:00
at 2019-12-23T14:00
By Robert
at 2019-12-24T13:52
at 2019-12-24T13:52
By Lydia
at 2019-12-27T17:55
at 2019-12-27T17:55
By Caitlin
at 2019-12-28T15:54
at 2019-12-28T15:54
By Blanche
at 2019-12-30T12:42
at 2019-12-30T12:42
By Una
at 2019-12-31T12:59
at 2019-12-31T12:59
By Anonymous
at 2020-01-05T09:08
at 2020-01-05T09:08
Related Posts
mobaXterm連X server
By Necoo
at 2019-12-18T11:53
at 2019-12-18T11:53
centos運行php腳本
By Edward Lewis
at 2019-12-17T23:14
at 2019-12-17T23:14
MSI 筆電灌Ubuntu
By Oliver
at 2019-12-17T21:30
at 2019-12-17T21:30
Raspberry Pi 4 (4GB) 跑Chrome?
By Heather
at 2019-12-17T16:49
at 2019-12-17T16:49
ubuntu鍵盤位置亂掉
By Catherine
at 2019-12-16T19:03
at 2019-12-16T19:03