<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create a set of different &amp;quot;provider&amp;quot; values depending on 'ansible_hostname'? in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318644#M2245</link>
    <description>&lt;P&gt;Thanks. I found out It also possible to use host_vars to separate variables for different hosts.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2020 05:59:18 GMT</pubDate>
    <dc:creator>michael082</dc:creator>
    <dc:date>2020-03-26T05:59:18Z</dc:date>
    <item>
      <title>How to create a set of different "provider" values depending on 'ansible_hostname'?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318160#M2232</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a simple playbook adding/removing tags:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;---
- name: 'Palo Alto PAN OS: Create a new tag object.'
  hosts: all
  connection: local
  gather_facts: true
  collections:
    - paloaltonetworks.panos
    
  pre_tasks:
    - name: Get the system information.
      include_vars: ./vars/provider.yml
      no_log: 'no'

  tasks:  
    - name: Create a tag object.
      when: operation == "create"
      panos_tag_object:
        provider: '{{ provider }}'
        name: '{{ tag_name }}'
        color: '{{ tag_color }}'
        comments: '{{ tag_comment }}'
        
    - name: Remove a tag object.
      when: operation == "remove"
      panos_tag_object:
        provider: '{{ provider }}'
        name: '{{ tag_name }}'
        color: '{{ tag_color }}'
        state: absent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The '/vars/provider.yml' looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;provider:
  ip_address: '2000.iaas.company.com'
  api_key: MY876API9787KEY&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have two more 'provider' values and let the playbook to make a choice depending on the "ansible_hostname" or IP address. I can't figure it out. Can someone help? Maybe there is a better approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 09:05:35 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318160#M2232</guid>
      <dc:creator>michael082</dc:creator>
      <dc:date>2020-03-24T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a set of different "provider" values depending on 'ansible_hostname'?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318618#M2239</link>
      <description>&lt;P&gt;You need to make a list of provider dicts, then loop over that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#standard-loops" target="_blank"&gt;https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#standard-loops&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 23:50:47 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318618#M2239</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2020-03-25T23:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a set of different "provider" values depending on 'ansible_hostname'?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318644#M2245</link>
      <description>&lt;P&gt;Thanks. I found out It also possible to use host_vars to separate variables for different hosts.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 05:59:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-create-a-set-of-different-quot-provider-quot-values/m-p/318644#M2245</guid>
      <dc:creator>michael082</dc:creator>
      <dc:date>2020-03-26T05:59:18Z</dc:date>
    </item>
  </channel>
</rss>

