system-config/playbooks/roles/grafana/tasks/main.yaml
Clark Boylan 4c4c499b8a Pin python requests when installing docker-compose
New urllib3 and python requests break python docker-compose. Pin
requests back which should use an older urllib3. Hopefully this fixes
docker-compose.

Note this should probably only be used as a temporary workaround. A more
permanent fix should change the way we install docker-compose.

Change-Id: Ib28a42c033aeccb6a13f179bb5e06e80304de528
2023-05-03 11:08:15 -07:00

121 lines
2.4 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: Ensure home panel directory exists
file:
state: directory
path: /etc/grafana/home
owner: root
group: root
mode: 0755
- name: Copy home panel
copy:
src: 'home.json'
dest: '/etc/grafana/home/home.json'
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: Wait for grafana to be up and running
wait_for:
timeout: 60
port: 3000
- name: Import dashboards to container
command: '/usr/local/bin/update-grafana-dashboards'