Similar statement in ansible - string as char value n times

8 views
Skip to first unread message

Luiz Gustavo

unread,
Aug 22, 2023, 4:52:09 PM8/22/23
to Ansible Project
hello masters,

Is there a simple way to create a variable like in the bash example?

export sep=$(printf '%0.1s' "-"{1..100})

I would need to create a variable with 100 characters '-' but I wanted it in an elegant way like in bash.

Matt Martz

unread,
Aug 22, 2023, 4:53:29 PM8/22/23
to ansible...@googlegroups.com
Just multiple the character you want, by the number of times you want it:

{{ "-" * 100 }}

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f9243b89-e66d-4057-a68c-b5de3e2032bfn%40googlegroups.com.


--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages