rp346
rp346

Reputation: 7058

How do I create list of host in group in ansible task

I am trying to create a list of host from inventory groups into ansible task

- name: perform on one node
  command: /opt/vertica/sbin/install_vertica --hosts {{ node_list }} --rpm /tmp/vertica_7.1.x.x86_64.RHEL5.rpm --dba-user mydba
  delegate_to: "{{ groups['vertica'][0] }}"

Here I want to create node_list as list of host in groups['vertica']

anyone know how to do this ?

Thanks

Upvotes: 0

Views: 1203

Answers (1)

rp346
rp346

Reputation: 7058

Got following working

- name: perform on one node
  command: /opt/vertica/sbin/install_vertica -s {{ groups['vertica'] | join(',') }} -r {{ download_dir }}/vertica-{{ vertica_version }}.x86_64.RHEL5.rpm -u mydba
  delegate_to: "{{ groups['vertica'][0] }}"

Upvotes: 1

Related Questions