Compare commits

...

2 Commits

  1. 2
      defaults/main.yml
  2. 9
      tasks/main.yml

2
defaults/main.yml

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

9
tasks/main.yml

@ -36,7 +36,6 @@
docker_network:
name: "{{ grafana_docker_network }}"
state: present
internal: "{{ grafana_docker_network_internal }}"
- name: grafana | install and start the app container
become: true
@ -45,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:
@ -57,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