Hello All, <https://stackoverflow.com/posts/67161917/timeline>
I am using Ansible Datadog role <https://galaxy.ansible.com/Datadog/datadog> and trying to install and configure datadog agents in target servers however, i am stuck at a point where i need to use host variables and update a section of the playbook using these variables. The host variable may have multiple values separated by a space. I want to ensure that these values are added in the playbook based on the variable values. Following example will help in understanding the requirement. *Playbook:* *- hosts: servers * * roles: * * - { role: datadog.datadog, become: yes } * * vars: * * datadog_api_key: "{{ DD_API_KEY }}" * * datadog_config: tags: - "AID:"{{ AID }}" * Here, the tag value *AID* is using a host variable with the same name i.e., AID and in some cases this host variable can have values like the following: *AID: 100 101 102 103* Is there a way that the while executing tag section of the playbook is parsed based on the variable values in following format or atlease the end result in the target file has this same structure? * tags: * * - AID: 100 * * - AID: 101 * * - AID: 102 * * - AID: 103 * I believe i cannot use templates for such requirements since the configurations are used under vars in the role. Any suggests would be appreciated. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bdc67d49-6c8d-432a-bd75-9ded93158de5n%40googlegroups.com.
