ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

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

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 }}/Makefile2.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
返回列表