OK, I found the answer (yay RTFM!) in 
http://docs.ansible.com/playbooks_variables.html#other-useful-filters

Working play is:

- name: RHELFAM | Restrict SSH on Docker hosts to specific group members
  lineinfile: dest=/etc/ssh/sshd_config
    state=present
    regexp='^AllowGroups'
    line='AllowGroups {{ ssh_allowed_groups | join(" ") }}'
    backup=yes
    validate='sshd -t -f %s'
  when: ssh_allowed_groups is defined 
  notify:
    - restart sshd
  tags: limitsshusers



Variable filters FTW!

Thanks all,
W.


On Tuesday, November 4, 2014 4:33:37 PM UTC-5, Willard Dennis wrote:
>
> Thanks, Tomasz, for the explanation -- wasn't aware that the 'lineinfile' 
> module couldn't accept list input. 
>
> Now, my question is: how to take a YAML list (such as the groups list in 
> my vars file), form a string of the format of "group1 group2", and use that 
> in lineinfile?
>

-- 
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/5590ccb3-46c4-4603-b3c9-44deede32276%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to