0

I have the following values in a data structure:

kafka_topic:
     topic:
     - "DATA.APP_TOPIC"
     partitions:
     - "1"
     replication-factor:
     - "1"

I am retrieving the topic value and passing it to the command module:

- name: Topic Name
  set_fact:
     topic_name: "{{ kafka_topic.topic }}"

- name: Create Topic with Specific Configuration
  command: "{{ kafka_bin_dir }}/{{ kafka_config_script }}
            --zookeeper {{ prefix }}-kafka-{{ Kafka_node }}.{{ DNSDomain}}:{{ zookeeper_port }}
            --entity-type topics
            --alter
            --entity-name {{ topic_name }}
            --add-config
            {{ item.topic_property }}={{ item.value }}"
  with_items: "{{ app_kafka_topic_properties_dicts }}"

However, the actual value passed to the command module is [uDATA.APP_TOPIC].

How do I make sure just the value DATA.APP_TOPIC is passed to the command module?

SSF
  • 915
  • 5
  • 23
  • 47

1 Answers1

1

The solution was easy. I just returned the first element of the kafka_topic.topic list.

- name: Topic Name
  set_fact:
     topic_name: "{{ kafka_topic.topic[0] }}"

This returns the element as oppose to the entire list.

SSF
  • 915
  • 5
  • 23
  • 47