如何在ansible task

时间:2016-02-17 22:06:14

标签: automation ansible ansible-playbook

我正在尝试从库存组创建主机列表到ansible任务

- 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] }}"

在此,我想在node_list

中创建groups['vertica']作为主持人列表 谁知道怎么做?

由于

1 个答案:

答案 0 :(得分:0)

有以下工作

- 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] }}"