why with items is not looping properly in yml any suggestions

0 votes

This is the yml file:

 - name: Update Prometheus Configuration
        blockinfile: 
          path: "/u01/grafana/prometheus/prometheus-2.28.1/prometheus.yml"
          insertafter: "# {{ item }} BEGIN ANSIBLE MANAGED BLOCK"
          block: |
            # {{ hostn }} entry by Ansible
                - targets: ['{{ fullhost }}:9162']
                  labels:
                    instance: {{ targetdb }}
        become: yes
        with_items:
          - "DBCRITICAL"
          - "DB6H"
          - "DB1H"

But looping is happening for only - "DBCRITICAL"

output:

TASK [Update Prometheus Configuration] *****************************************18:20:49

83

changed: [hostname] => (item=DBCRITICAL)

84

ok: [hostname] => (item=DB6H)

85

ok: [hostname] => (item=DB1H)

Jun 30, 2022 in Ansible by anonymous

edited 5 days ago 7 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP