I have a group with a large list of systems and need to grab the first 3 systems from the group. Is there a way to take a group such as this:
[webservers]
web01
web02
web03
web04
web05
And produce a quoted list similar to the following?:
- name: Pick the initial masters
lineinfile:
dest: "/bits/etc/web.conf"
state: present
regexp: 'node.masters'
line: 'node.masters: [ "web01", "web02", "web03" ]'
I may need to change the number of masters in the future so I'm hoping to use a slice if at all possible. Thanks for any insight.