diff --git a/playbooks/groups/sundries.yml b/playbooks/groups/sundries.yml index 56cc53bc5e..608335f5d6 100644 --- a/playbooks/groups/sundries.yml +++ b/playbooks/groups/sundries.yml @@ -51,6 +51,9 @@ when: master_sundries_node - role: developer/build when: master_sundries_node + - role: whatcanidoforfedora/build + when: env == "staging" + #when: master_sundries_node tasks: - include: "{{ tasks_path }}/yumrepos.yml" diff --git a/roles/whatcanidoforfedora/build/files/sync-wcidff.cron b/roles/whatcanidoforfedora/build/files/sync-wcidff.cron new file mode 100644 index 0000000000..d7932f1711 --- /dev/null +++ b/roles/whatcanidoforfedora/build/files/sync-wcidff.cron @@ -0,0 +1,2 @@ +MAILTO=web-members@fedoraproject.org +15 * * * * apache /usr/local/bin/lock-wrapper sync-wcidff /usr/local/bin/sync-wcidff.sh diff --git a/roles/whatcanidoforfedora/build/files/sync-wcidff.sh b/roles/whatcanidoforfedora/build/files/sync-wcidff.sh new file mode 100644 index 0000000000..6fb4c9a3df --- /dev/null +++ b/roles/whatcanidoforfedora/build/files/sync-wcidff.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Borrowed heavily from the syncStatic cronjob script. + +if [ ! -d /srv/web/whatcanidoforfedora.org/.git ] +then + /usr/bin/git clone -q \ + https://github.com/fedora-infra/asknot-ng.git \ + /srv/web/whatcanidoforfedora.org +fi + +cd /srv/web/whatcanidoforfedora.org + +/usr/bin/git clean -q -fdx || exit 1 +/usr/bin/git reset -q --hard || exit 1 +/usr/bin/git checkout -q develop || exit 1 +/usr/bin/git pull -q --ff-only || exit 1 + +err=$( + { + ./build.sh &&\ + rsync -qa --delete-after --delay-updates build/ "/srv/web/$site/"; \ + } 2>&1 +) + +rc=$? +if [ $rc -ne 0 ]; then + echo "$site build failed" + echo "====================================" + echo "$err" + echo +fi diff --git a/roles/whatcanidoforfedora/build/tasks/main.yml b/roles/whatcanidoforfedora/build/tasks/main.yml new file mode 100644 index 0000000000..57467b8968 --- /dev/null +++ b/roles/whatcanidoforfedora/build/tasks/main.yml @@ -0,0 +1,41 @@ +- name: Install needed packages + yum: pkg={{ item }} state=present + with_items: + - PyYAML + - git + - python-mako + tags: + - packages + - whatcanidoforfedora + +- name: Create directories + file: state=directory + path=/srv/web/{{item}} + owner=apache group=apache mode=0755 + setype=httpd_sys_content_t seuser=system_u + with_items: + - whatcanidoforfedora.org + tags: + - whatcanidoforfedora + +- name: Copy syncStatic script + copy: + src: sync-wcidff.sh + dest: /usr/local/bin/sync-wcidff.sh + owner: root + group: root + mode: 0755 + tags: + - whatcanidoforfedora + - cron + +- name: Install the syncStatic and syncTranslations cronjobs + copy: + src: sync-wcidff.cron + dest: /etc/cron.d/sync-wcidff.cron + owner: root + group: root + mode: 0644 + tags: + - whatcanidoforfedora + - cron