Re: [ansible-devel] Enhancement idea - passing module args in loop

2023-11-07 Thread Sloane Hertel
You could use module_defaults 
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_module_defaults.html

  - template:
  owner: root
  group: radiusd
  mode: "0640"
module_defaults:
  template: "{{ item }}"
loop:
- { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
- { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }

Or/additionally arg splatting (which can be unsafe in some cases if 
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars
 
is True):

  - template:  "{{ item }}"
module_defaults:
  template:
owner: root
group: radiusd
mode: "0640"
loop:
- { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
- { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
On Wednesday, November 1, 2023 at 7:08:10 PM UTC-4 or...@nwra.com wrote:

> I'm not sure what you are trying to say. This doesn't work because what I'm
> proposing doesn't exist.
>
> But I'm wondering if it is worth proposing it as an enhancement.
>
> On 10/31/23 13:23, Avinash Jadhav wrote:
> > Please try this one
> > 
> > - template:
> > args_var: item
> > owner: root
> > group: radiusd
> > mode: "0640"
> >   loop:
> > - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
> > - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> > 
> > 
> > On Wed, 1 Nov, 2023, 00:50 Orion Poplawski,  > > wrote:
> > 
> > I find myself writing this over and over again:
> > 
> > - template:
> > src: "{{ item.src }}"
> > dest: "{{ item.dest }}"
> > owner: root
> > group: radiusd
> > mode: "0640"
> >   loop:
> > - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
> > - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> > 
> > 
> > What about being able to do something like:
> > 
> > - template:
> > args_var: item
> > owner: root
> > group: radiusd
> > mode: "0640"
> >   loop:
> > - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
> > - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> > 
> > Not so dramatic with only two parameters, but I have some with 5 or moe.
> > 
> > -- 
> > Orion Poplawski
> > IT Systems Manager 720-772-5637 
> <(720)%20772-5637>
> > NWRA, Boulder/CoRA Office FAX: 303-415-9702 
> <(303)%20415-9702>
> > 3380 Mitchell Lane   or...@nwra.com
> > 
> > Boulder, CO 80301 https://www.nwra.com/
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups
> > "Ansible Development" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to ansible-deve...@googlegroups.com
> > .
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/ansible-devel/35765b61-39cc-46e2-aa5c-b3b728a0ddf8%40nwra.com
>  
> <
> https://groups.google.com/d/msgid/ansible-devel/35765b61-39cc-46e2-aa5c-b3b728a0ddf8%40nwra.com
> >.
> > 
>
> -- 
> Orion Poplawski
> IT Systems Manager 720-772-5637 <(720)%20772-5637>
> NWRA, Boulder/CoRA Office FAX: 303-415-9702 <(303)%20415-9702>
> 3380 Mitchell Lane or...@nwra.com
> Boulder, CO 80301 https://www.nwra.com/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/f371b2e5-5b30-4d2e-bc01-f832dda9720an%40googlegroups.com.


Re: [ansible-devel] Enhancement idea - passing module args in loop

2023-11-01 Thread Orion Poplawski
I'm not sure what you are trying to say.  This doesn't work because what I'm
proposing doesn't exist.

But I'm wondering if it is worth proposing it as an enhancement.

On 10/31/23 13:23, Avinash Jadhav wrote:
> Please try this one
> 
> - template:
>     args_var: item
>     owner: root
>     group: radiusd
>     mode: "0640"
>   loop:
>     - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
>     - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> 
> 
> On Wed, 1 Nov, 2023, 00:50 Orion Poplawski,  > wrote:
> 
> I find myself writing this over and over again:
> 
> - template:
>     src: "{{ item.src }}"
>     dest: "{{ item.dest }}"
>     owner: root
>     group: radiusd
>     mode: "0640"
>   loop:
>     - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
>     - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> 
> 
> What about being able to do something like:
> 
> - template:
>     args_var: item
>     owner: root
>     group: radiusd
>     mode: "0640"
>   loop:
>     - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
>     - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
> 
> Not so dramatic with only two parameters, but I have some with 5 or moe.
> 
> -- 
> Orion Poplawski
> IT Systems Manager                         720-772-5637
> NWRA, Boulder/CoRA Office             FAX: 303-415-9702
> 3380 Mitchell Lane                       or...@nwra.com
> 
> Boulder, CO 80301                 https://www.nwra.com/
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-devel/35765b61-39cc-46e2-aa5c-b3b728a0ddf8%40nwra.com
>  
> .
> 

-- 
Orion Poplawski
IT Systems Manager 720-772-5637
NWRA, Boulder/CoRA Office FAX: 303-415-9702
3380 Mitchell Lane   or...@nwra.com
Boulder, CO 80301 https://www.nwra.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/541c5e07-f2e4-4e9a-8ed6-a2227b39c32e%40nwra.com.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [ansible-devel] Enhancement idea - passing module args in loop

2023-10-31 Thread Avinash Jadhav
Please try this one

- template:
args_var: item
owner: root
group: radiusd
mode: "0640"
  loop:
- { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
- { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }


On Wed, 1 Nov, 2023, 00:50 Orion Poplawski,  wrote:

> I find myself writing this over and over again:
>
> - template:
> src: "{{ item.src }}"
> dest: "{{ item.dest }}"
> owner: root
> group: radiusd
> mode: "0640"
>   loop:
> - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
> - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
>
>
> What about being able to do something like:
>
> - template:
> args_var: item
> owner: root
> group: radiusd
> mode: "0640"
>   loop:
> - { src: clients.conf.j2, dest: /etc/raddb/clients.conf }
> - { src: proxy.conf.j2, dest: /etc/raddb/proxy.conf }
>
> Not so dramatic with only two parameters, but I have some with 5 or moe.
>
> --
> Orion Poplawski
> IT Systems Manager 720-772-5637
> NWRA, Boulder/CoRA Office FAX: 303-415-9702
> 3380 Mitchell Lane   or...@nwra.com
> Boulder, CO 80301 https://www.nwra.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/35765b61-39cc-46e2-aa5c-b3b728a0ddf8%40nwra.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CABAvFDMn8xBGOv%2BZV1v9B%3D_fGqcJ5%3DJJQZaKbVrVg6JitVvuZQ%40mail.gmail.com.