
Update the docs to reflect not having grafyaml in the container. Also move the import into a separate helper script, which can be manually run on the host if the container needs to be restarted out-of-band for some reason. Change-Id: Ib1f6aea7e16180d9b122552a2aa30ce223426941
100 lines
2.0 KiB
YAML
100 lines
2.0 KiB
YAML
- name: Ensure docker-compose directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana-docker
|
|
|
|
- name: Write settings file
|
|
template:
|
|
src: docker-compose.yaml.j2
|
|
dest: /etc/grafana-docker/docker-compose.yaml
|
|
|
|
- name: Ensure config directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana
|
|
|
|
- name: Ensure secrets config directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana/secrets
|
|
|
|
- name: Make admin_password
|
|
copy:
|
|
content: '{{ grafana_admin_password }}'
|
|
dest: /etc/grafana/secrets/admin_password
|
|
|
|
- name: Make admin_user
|
|
copy:
|
|
content: '{{ grafana_admin_user }}'
|
|
dest: /etc/grafana/secrets/admin_user
|
|
|
|
- name: Make secret_key
|
|
copy:
|
|
content: '{{ grafana_secret_key }}'
|
|
dest: /etc/grafana/secrets/secret_key
|
|
|
|
- name: Write grafyaml env file
|
|
template:
|
|
src: grafyaml.env.j2
|
|
dest: /etc/grafana/secrets/grafyaml.env
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
|
|
- name: Write update script
|
|
template:
|
|
src: update-grafana-dashboards.sh.j2
|
|
dest: /usr/local/bin/update-grafana-dashboards
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Install apache2
|
|
apt:
|
|
name:
|
|
- apache2
|
|
- apache2-utils
|
|
state: present
|
|
|
|
- name: Apache modules
|
|
apache2_module:
|
|
state: present
|
|
name: "{{ item }}"
|
|
loop:
|
|
- rewrite
|
|
- proxy
|
|
- proxy_http
|
|
- ssl
|
|
- headers
|
|
- proxy_wstunnel
|
|
|
|
- name: Copy apache config
|
|
template:
|
|
src: grafana.vhost.j2
|
|
dest: /etc/apache2/sites-enabled/000-default.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: grafana Reload apache2
|
|
|
|
- name: Sync project-config
|
|
include_role:
|
|
name: sync-project-config
|
|
|
|
- name: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/grafana-docker/
|
|
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: /etc/grafana-docker/
|
|
|
|
- name: Run docker prune to cleanup unneeded images
|
|
shell:
|
|
cmd: docker image prune -f
|
|
|
|
- name: Import dashboards to container
|
|
command: '/usr/local/bin/update-grafana-dashboards'
|