news 2026/9/13 18:48:57

ansible yaml中折叠符(>)和多行文本符号(|)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ansible yaml中折叠符(>)和多行文本符号(|)

1.yaml中有很多参数时,建议使用折叠符(>):

E.g:

- name: Configure nginx command: > ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-stream --with-http_stub_status_module args: chdir: "/tmp/nginx-{{ nginx_version }}" creates: "/tmp/nginx-{{ nginx_version }}/Makefile"

2.yaml中有多个命令要顺序执行时,建议使用多行文本符号(|),将多行内容作为一个完整字符串传递给shell模块执行

E.g:

- name: Install nginx shell: | cd /tmp tar -xzf nginx-1.28.0.tar.gz cd nginx-1.28.0 ./configure --prefix=/usr/local/nginx make make install

实际含义:

cd /tmp tar -xzf nginx-1.28.0.tar.gz cd nginx-1.28.0 ./configure --prefix=/usr/local/nginx make make install

总结:

| = 保留换行(Literal) > = 换行变空格(Folded)
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/9/13 18:48:18

LiteParse 输出空白或乱码?5 步排查法让解析结果快速恢复正常

LiteParse 输出空白或乱码?5 步排查法让解析结果快速恢复正常 【免费下载链接】liteparse A fast, helpful, and open-source document parser 项目地址: https://gitcode.com/GitHub_Trending/li/liteparse LiteParse 是本地运行的开源文档解析器&#xff0…

作者头像 李华
网站建设 2026/9/13 18:47:24

STM32/S32K UDS CAN本地刷写实战:从协议到产线落地

1. 这不是“远程升级”,而是嵌入式系统里最硬核的本地刷写实战你手头有一块STM32H7或S32K144,CAN总线接在T-Box或诊断接口上,客户现场送来一台设备,要求不拆壳、不接JTAG、不联网——只用一根诊断线,把新固件从U盘里读…

作者头像 李华
网站建设 2026/9/13 18:41:13

猫抓 cat-catch:3 分钟跑通第一次网页视频下载,M3U8 解密也不难

猫抓 cat-catch:3 分钟跑通第一次网页视频下载,M3U8 解密也不难 【免费下载链接】cat-catch 猫抓 浏览器资源嗅探扩展 / cat-catch Browser Resource Sniffing Extension 项目地址: https://gitcode.com/GitHub_Trending/ca/cat-catch 想存网页上…

作者头像 李华