Look up "with_nested" for this one.

However ansible is not going to like you adding key=value arguments in
recent versions that way.  I'd try passing a hash of values instead.

Also seems the $item2 might be from a very old ansible version and you mean
"{{item2}}"

Any any case, with_nested should hook you up and let us know if you need
more info!








On Tue, Jul 29, 2014 at 1:33 PM, John Oliver <jno...@gmail.com> wrote:

> So, I want to add two lines to each of two files.  Looking to see if
> lineinfile could add multiple lines, I found a post that seemed to indicate
> it could not.
>
> 1) Is it possible to make lineinfile add multiple lines?
>
> 2) If not, is there a way to do something like:
>
>   - name: Lock accounts after 3 unsuccessful logon attempts
>     lineinfile: dest=/etc/pam.d/{{item1}}-auth-ac
>                 regexp='^auth\ [default=die]\ pam_faillock\.so\ authfail\
> deny=3\ unlock_time=604800\ fail_interval=900'
>                 insertafter='^auth.*pam_unix\.so.*'
>  line='$item2'
>     with_items2:
>     - 'auth [default=die] pam_faillock.so authfail deny=3
> unlock_time=604800 fail_interval=900'
>     - 'auth required pam_faillock.so authsucc deny=3 unlock_time=604800
> fail_interval=900'
>     with_items1:
>       - system
>       - password
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/55b1d9fd-a695-4333-af7f-55062d073d3f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/55b1d9fd-a695-4333-af7f-55062d073d3f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwVwdWh_AWHuS-LaLSvtWreHzjBS5i4pM2yyvrFLJD%3DTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to