Skip to content

Commit

Permalink
Fix #37091 - Pretty print long YAML list
Browse files Browse the repository at this point in the history
  • Loading branch information
Et7f3 committed Jan 23, 2024
1 parent 415543f commit f7e2fb5
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ template_inputs:
provider_type: Ansible
kind: job_template
model: JobTemplate
%>

-%>
<% package_names = input('name') %>
# For Windows targets use the win_package module instead.
---
- hosts: all
Expand All @@ -41,7 +41,20 @@ model: JobTemplate
<%- end -%>
tasks:
- package:
name: <%= input('name') %>
<% if package_names.kind_of?(String) -%>
name: <%= package_names %>
<% elsif package_names.kind_of?(Array) -%>
<% if package_names.empty? -%>
name: []
<% else -%>
name:
<% package_names.each do |package_name| -%>
- <%= package_name %>
<% end -%>
<% end -%>
<% else -%>
<% render_error("name should be String or Array") -%>
<% end -%>
state: <%= input('state') %>
<%- if input('post_script').present? -%>
post_tasks:
Expand Down

0 comments on commit f7e2fb5

Please sign in to comment.