From 77c7f7dc0a2f1827d91e1a89363f4e6efe0cd35e Mon Sep 17 00:00:00 2001 From: David Galloway Date: Fri, 10 Feb 2017 16:09:05 -0500 Subject: [PATCH] public_facing: Add download.ceph.com-specific tasks Signed-off-by: David Galloway --- .../public_facing/tasks/download.ceph.com.yml | 69 +++++++++++++++++++ .../templates/download.ceph.com/logrotate.j2 | 22 ++++++ .../download.ceph.com/make_timestamp.j2 | 3 + 3 files changed, 94 insertions(+) create mode 100644 roles/public_facing/tasks/download.ceph.com.yml create mode 100644 roles/public_facing/templates/download.ceph.com/logrotate.j2 create mode 100644 roles/public_facing/templates/download.ceph.com/make_timestamp.j2 diff --git a/roles/public_facing/tasks/download.ceph.com.yml b/roles/public_facing/tasks/download.ceph.com.yml new file mode 100644 index 0000000..0d2568f --- /dev/null +++ b/roles/public_facing/tasks/download.ceph.com.yml @@ -0,0 +1,69 @@ +--- +- name: Put logrotate config in place + template: + src: templates/download.ceph.com/logrotate.j2 + dest: /etc/logrotate.d/download.ceph.com + +# Used for pushing upstream builds +# https://github.com/ceph/ceph-build/blob/master/scripts/sync-push +- name: Add signer user + user: + name: signer + +# signer_pubkey defined in inventory host_vars +- name: Update signer user's authorized_keys + authorized_key: + user: signer + state: present + key: "{{ signer_pubkey }}" + +# Used to rsync download.ceph.com http logs and compile metrics +# for metrics.ceph.com +- name: Create Bitergia user + user: + name: bitergia + groups: adm + +# bitergia_pubkey defined in inventory host_vars +- name: Update bitergia user's authorized_keys + authorized_key: + user: bitergia + state: present + key: "{{ bitergia_pubkey }}" + +- name: Create ~/bin dir for bitergia user + file: + path: /home/bitergia/bin + state: directory + owner: bitergia + group: bitergia + +# Rsync is almost certainly already installed but it's required for the next task +- name: Make sure rsync is installed + apt: + name: rsync + state: latest + +- name: Put rrsync script in place for bitergia user + shell: "gunzip /usr/share/doc/rsync/scripts/rrsync.gz --to-stdout > /home/bitergia/bin/rrsync" + changed_when: false + +- name: Set permissions for bitergia rrsync script + file: + dest: /home/bitergia/bin/rrsync + owner: bitergia + group: bitergia + mode: 0774 + +# Updates download.ceph.com/timestamp +- name: Put make_timestamp script in place + template: + src: templates/download.ceph.com/make_timestamp.j2 + dest: /usr/libexec/make_timestamp + mode: 0775 + +- name: Create cron entry for make_timestamp + cron: + name: "Update download.ceph.com/timestamp" + minute: "0" + job: "/usr/libexec/make_timestamp" diff --git a/roles/public_facing/templates/download.ceph.com/logrotate.j2 b/roles/public_facing/templates/download.ceph.com/logrotate.j2 new file mode 100644 index 0000000..1ca6a1a --- /dev/null +++ b/roles/public_facing/templates/download.ceph.com/logrotate.j2 @@ -0,0 +1,22 @@ +# +# {{ ansible_managed }} +# +/data/download.ceph.com/logs/*.log { + daily + missingok + rotate 30 + compress + delaycompress + notifempty + dateext + create 640 www-data adm + sharedscripts + prerotate + if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ + run-parts /etc/logrotate.d/httpd-prerotate; \ + fi \ + endscript + postrotate + [ -s /run/nginx.pid ] && kill -USR1 `cat /run/nginx.pid` + endscript +} diff --git a/roles/public_facing/templates/download.ceph.com/make_timestamp.j2 b/roles/public_facing/templates/download.ceph.com/make_timestamp.j2 new file mode 100644 index 0000000..3df1188 --- /dev/null +++ b/roles/public_facing/templates/download.ceph.com/make_timestamp.j2 @@ -0,0 +1,3 @@ +#!/bin/bash +# {{ ansible_managed }} +/bin/date "+%s" > /data/download.ceph.com/www/timestamp -- 2.39.5