拓冰建站拓冰建站
首页 / 资讯中心 / 正文

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
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门