Browse Source

add listen ip and fix lookup of network

main
Felix Kronlage-Dammers 2 months ago
parent
commit
c29f769a5e
  1. 1
      defaults/main.yml
  2. 8
      tasks/main.yml

1
defaults/main.yml

@ -2,4 +2,5 @@
grafana_directory: /srv/grafana
grafana_docker_network: grafana
grafana_listen_ip: "127.0.0.1"
grafana_port: 3000

8
tasks/main.yml

@ -44,7 +44,7 @@
name: grafana
networks:
- name: "{{ grafana_docker_network }}"
published_ports: "{{ grafana_port }}:{{ grafana_port }}"
published_ports: "{{ grafana_listen_ip }}:{{ grafana_port }}:{{ grafana_port }}"
state: started
restart_policy: always
volumes:
@ -56,6 +56,10 @@
ansible.builtin.shell: "/usr/bin/docker exec -it grafana /usr/share/grafana/bin/grafana-cli admin reset-admin-password {{ grafana_admin_password }}"
when: grafana_admin_password is defined
- name: grafana | lookup container IP
command: docker inspect --format '{''{ .NetworkSettings.Networks.{{ grafana_docker_network }}.IPAddress}''}' grafana
register: _grafana_container_ip
- name: grafana | return container IP
set_fact:
grafana_internal_ip: "{{ _grafana_container.container.NetworkSettings.Networks.grafana.IPAddress }}"
grafana_internal_ip: "{{ _grafana_container_ip.stdout }}"

Loading…
Cancel
Save