For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

C4sp3R's avatar
C4sp3R
Icon for Nimbostratus rankNimbostratus
Jan 08, 2020

F5's monitor ansible module

Is there an elegant way to export/save the different types of monitors locally?

Because currently it seems you have to save the different types of monitors individually, e.g.:

- name: Saving HTTPS monitors
    copy:
      content: "{{ item | to_nice_yaml }}"
      dest: ./f5/{{inventory_hostname}}/monitors/https_monitors/{{item.name}}.yml
    loop: "{{results.https_monitors }}"


  - name: Saving HTTP monitors
    copy:
      content: "{{ item | to_nice_yaml }}"
      dest: ./f5/{{inventory_hostname}}/monitors/http_monitors/{{item.name}}.yml
    loop: "{{results.http_monitors }}"


  - name: Saving ICMP monitors
    copy:
      content: "{{ item | to_nice_yaml }}"
      dest: ./f5/{{inventory_hostname}}/monitors/icmp_monitors/{{item.name}}.yml
    loop: "{{results.icmp_monitors }}"
.
.
.

Apart from that a small sidenote (maybe i'm grasping the concept of ansible wrong), but wouldn't it be better to introduce a key with the type of monitor instead of creating a dictionary for every type, as the current approach makes automatic iterating hard if the types change for some reason.

No RepliesBe the first to reply