Initial working configuration for docs backend

This commit is contained in:
Pete Travis 2014-05-12 15:05:03 -06:00
parent b8ef359849
commit ae492e0402
6 changed files with 117 additions and 0 deletions

View file

@ -40,6 +40,11 @@
- include: "{{ tasks }}/2fa_client.yml"
- include: "{{ tasks }}/motd.yml"
- include: "{{ tasks }}/sudo.yml"
# we want httpd for now, to examine the product directly
- include: "{{ tasks }}/apache.yml"
handlers:
- include: "{{ handlers }}/restart_services.yml"
roles:
- { role: publican_webhost, kojitag: "el6-docs", publican_brand: "fedora", site_title: "Fedora Documentation", site_host="http://docs.fedoraproject.org" }

View file

@ -0,0 +1,37 @@
---
- name: copy repo definition
template: src=koji-tag-package.repo dest="/etc/yum.repos.d/{{ kojitag }}.repo owner=root group=root
- name: install publican & brand
yum: name="publican-{{ publican-brand }}-web" state=installed
- name: use fedwatch copr
command: wget http://copr.fedoraproject.org/coprs/sochotni/fedwatch/repo/epel-6-i386/sochotni-fedwatch-epel-6-i386.repo -o /etc/yum.repos.d/sochotni-fedwatch.repo creates=/etc/yum.repos.d/sochotni-fedwatch-epel-6.repo
- name: install fedwatch
yum: name=fedwatch state=installed
# needs updating!
- name: copy fedwatch.conf
copy: src=fedwatch.conf" dest=/etc/fedwatch.conf mode=0644
# verify + test
- name: copy fedwatch triggers
template: src=20-docs-trigger.sh dest=/etc/fedwatch.d/ owner=root mode=0744
- name: turn on fedwatch.service
service: name=fedwatch enabled=yes state=started
- name: hourly check for doc updates
cron: day=* hour=* state=present job="yum -y --disablerepo=\* --enablerepo=el6-docs install \*web-[a-z][a-z]-[A-Z][A-Z]\*.noarch 2>&1 > /tmp/latest_{{ kojitag }}_update.log"
# needs inspection, web_version maybe?
# more templating?
- name: copy publican website config
template: src="{{ files }}/docs/publican_website.cfg" dest=/etc/publican-website.cfg
# verify
- name: copy empty sqlite db; publican only creates this interactively
copy: src=empty_publican_site.db dest=/var/www/html/{{ publican_brand }}.{{ kojitag }}.db
# do stuff ?

View file

@ -0,0 +1,36 @@
#!/bin/bash
if [[ "$1" == "org.fedoraproject.prod.buildsys.repo.done" && "$3" == "{{ kojitag }}" ]];then
# Let us know when the repo finishes rebuilding, so that we can install *all*
# documents (based on a slightly fragile match)
echo "Repo_done::start topic=$1; name=$2; instance=$3 " >> /tmp/fedwatch_{{ kojitag }}.log
echo "* Calling on yum to install all outstanding docs *" >> /tmp/fedwatch{{ kojitag }}.log
yum --disablerepo=\* --enablerepo={{ kojitag }} clean all 2>&1 >> /tmp/fedwatch_{{ kojitag }}.log
yum -y --disablerepo=\* --enablerepo={{ kojitag }} install \*-web-[a-z][a-z]\*-[A-Z][A-Z]\*.noarch 2>&1 >> /tmp/fedwatch{{ kojitag }}.log
echo "Repo_done::end" >> /tmp/fedwatch_{{ kojitag }}.log
elif [[ "$1" == "org.fedoraproject.prod.buildsys.tag" && "$2" == "el6-docs" ]]; then
# Let us know when packages have been tagged into the {{ kojitag }} tag, just for
# informational purposes. We can't install based on this trigger, as we have to wait
# for the createrepo process to finish
echo "Tagged::info topic=$1; tag=$2; name=$3; version=$4; release=$5; user=$6" >> /tmp/fedwatch_{{ kojitag }}.log
elif [[ "$1" == "org.fedoraproject.prod.buildsys.untag" ]]; then
echo "Untagged::start topic=$1; name=$2; version=$3; release=$4; user=$5" >> /tmp/fedwatch_{{ kojitag }}.log
# fedwatch isn't telling us which repo/tag/target the package is being untagged from, so we have to
# resort to silly shell games in order to make sure it's really a Publican document
if [[ $(locale -a | sed -e 's/_/-/' | grep -c $(echo "$2-$3-$4" | sed -r 's/.*-web-([a-z]{2,3}-[A-Z]{2})-.*/\1/')) -gt 0 ]]; then
if [[ "$5" == "oscar" ]]; then
# Do not do any removals that are triggered by "oscar", who is the
# garbage collector in Koji
echo "* Skipping the removal of $2-$3-$4, because of garbage collection *" >> /tmp/fedwatch{{ kojitag }}.log
else
echo "* Calling on yum to remove $2-$3-$4 *" >> /tmp/fedwatch{{ kojitag }}.log
yum -y remove $2-$3-$4 2>&1 >> /tmp/fedwatch{{ kojitag }}.log
fi
else
echo "* Skipping removal of $2-$3-$4, because it doesn't appear to be a docs package *" >> /tmp/fedwatch{{ kojitag }}.log
fi
echo "Untagged::end" >> /tmp/fedwatch{{ kojitag }}.log
else
# Uncomment this next line for more debugging info
echo "Unknown::info topic=$1; 2=$2; 3=$3; 4=$4; 5=$5; 6=$6; 7=$7" >> /tmp/fedwatch{{ kojitag }}.log
fi

View file

@ -0,0 +1,26 @@
{
"org.fedoraproject.prod.buildsys.repo.done": {
"args": [
"msg/tag",
"msg/instance"
]
},
"org.fedoraproject.prod.buildsys.tag": {
"args": [
"msg/tag",
"msg/name",
"msg/version",
"msg/release",
"msg/user"
]
},
"org.fedoraproject.prod.buildsys.untag" : {
"args": [
"msg/tag",
"msg/name",
"msg/version",
"msg/release",
"msg/user"
]
}
}

View file

@ -0,0 +1,7 @@
{{ ansible_managed }}
[{{ kojitag }}]
name={{ kojitag }} Repository: $releasever - $basearch
baseurl=http://kojipkgs.fedoraproject.org/repos/{{ kojitag }}/latest/$basearch/
enabled=1
gpgcheck=0
cost=1337

View file

@ -0,0 +1,6 @@
db_file: /var/www/html/{{ publican_brand }}.{{ kojitag }}.db
toc_path: /var/www/html/docs/
host: {{ site_host }}
title: "site_host"
search: '<p/>
web_style: 2