TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Winning at Ansible: How to manipulate items in a list

2 点作者 carlosnunez大约 9 年前

1 comment

alexandrerond大约 9 年前
I don&#x27;t understand this.<p>If you need to iterate over the items you can just use &quot;with_items&quot; or &quot;with_subelements&quot; (<a href="http:&#x2F;&#x2F;docs.ansible.com&#x2F;ansible&#x2F;playbooks_loops.html#looping-over-subelements" rel="nofollow">http:&#x2F;&#x2F;docs.ansible.com&#x2F;ansible&#x2F;playbooks_loops.html#looping...</a>) and the &quot;{{ item }}_12345&quot;<p>If you need a list for a template you can always loop it in the template and access the sublements there and template them as you wish.<p>One of the strong points of Ansible is that it can be read very easily. The moment you do:<p>&quot;{{ important_files | map(attribute=&#x27;file_name&#x27;) | list | map(&#x27;regex_replace&#x27;,&#x27;(.*)&#x27;,&#x27;\\1_{{ file_suffix }}&#x27;) | list }}&quot;<p>you throw it away.
评论 #11177797 未加载