---
- name: Build Azure Promtail image
  hosts: localhost
  gather_facts: no
  connection: local
  tasks:
  - name: Include loki vars
    include_vars:
      dir: roles/loki/vars
  - name: Build promtail config file
    template:
      src: roles/promtail/files/config.yaml
      dest: images/azure/config.yaml
    vars:
      ansible_host: "{{ hostvars['jumphost'].ansible_host }}"
  - name: Build azure image
    ansible.builtin.command: packer build -force promtail-image.pkr.hcl
    args:
      chdir: images/azure
  - name: Remove rendered config file
    file:
      name: images/azure/config.yaml
      state: absent
...
