References:
Loop 1..26
-> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#id20
Loop over files in a directory -
> https://docs.ansible.com/ansible/2.4/playbooks_loops.html#id17
template module
-> https://docs.ansible.com/ansible/latest/modules/template_module.html
Maybe two steps?
1. Create 26 .ini files in some_dir, each numbered 1..26
2. Loop back over those 26 files with the win_command.
- name: template files 1 to 26
# use the var {{ sql_instance }} inside your .j2 template where ever you
want the values 1..26 to appear.
template:
src: /mytemplates/sql_config.j2
dest: "/some_dir/sql_config_{{ sql_instance }}.ini"
loop: "{{ range*(*1, 26) }}"
loop_control:
loop_var: sql_instance
- name: win_command with all 26 ini files
win_command: "sql_server_install.exe {{ ini_item }}"
with_fileglob:
- "/some_dir/*"
loop:
loop_control:
loop_var: ini_item
Full discloser:
1. I don't know what you run to install + specifiy the .ini file name at
the commandline, so modify the pattern win_command pattern to see if it
gets you close, or at least gives you some ideas
2. Code not tested, so buy beware :)
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f2c68a48-d708-47a5-9fda-53176a05bb57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.