Clean up copr MBS role

This commit is contained in:
Jakub Kadlčík 2017-01-24 11:11:22 +01:00 committed by Miroslav Suchý
parent 4b444518af
commit f67607fa31

View file

@ -1,8 +1,17 @@
# @TODO
#
# - I am currently storing my personal token in /etc/module-build-service/copr.conf
# and also my personal login in /etc/module-build-service/config.py
#
# - I am currently running mbs-frontend manually
# - Because of issue with <Location> in httpd config. See coprs.conf
---
# @TODO need to have comment here, to explain why not to use dnf module
# Cant use the ansible dnf module here. It doesnt work without these pacakges.
# Therefore using command module
- name: Install python and deps for ansible modules
raw: dnf install --refresh -y python2 python2-dnf libselinux-python
command: dnf install --refresh -y python2 python2-dnf libselinux-python
- name: Enable copr repo
@ -44,29 +53,24 @@
- python-copr
# Install module-build-service
#- name: Enable copr-dev repo
#command: dnf -y copr enable frostyx/module-build-service
- name: Install module-build-service package
#dnf: name=module-build-service state=latest
#command: dnf -y install https://frostyx.fedorapeople.org/module-build-service-1.0.2-1.fc24.noarch.rpm
#command: dnf -y install https://kojipkgs.fedoraproject.org//packages/module-build-service/1.0.2/2.fc26/noarch/module-build-service-1.0.2-2.fc26.noarch.rpm
command: dnf -y install https://kojipkgs.fedoraproject.org//packages/module-build-service/1.1.0/1.fc26/noarch/module-build-service-1.1.0-1.fc26.noarch.rpm
# Post-install stuff
# We need to remove this file or otherwise MBS Builder code is not executed at all
- name: Remove /etc/fedmsg.d/relay.py
file: path=/etc/fedmsg.d/relay.py state=absent
# We are workarounding module-build-service package here. Ralph confirmed that it should be done by the package
- name: Install fedmsg.d/mbs-scheduler.py
#command: wget https://pagure.io/fm-orchestrator/raw/master/f/fedmsg.d/mbs-scheduler.py -P /etc/fedmsg.d
get_url: url=https://pagure.io/fm-orchestrator/raw/master/f/fedmsg.d/mbs-scheduler.py dest=/etc/fedmsg.d
# We want to run fedmsg-hub as 'mbs' user, because we don't want to rpmbuild as 'fedmsg'
# We want to run fedmsg-hub as 'mbs' user, because we don't want to rpmbuild as 'fedmsg'
- name: Copy modified fedmsg-hub.service file
copy: src=fedmsg-hub.service dest=/etc/systemd/system/fedmsg-hub.service
@ -75,24 +79,6 @@
- name: FOO
#command: grep -q '^127\.0\.0\.1 fedmsg-relay$' /etc/hosts || echo "127.0.0.1 fedmsg-relay" >> /etc/hosts
#command: echo "127.0.0.1 fedmsg-relay" >> /etc/hosts
lineinfile: dest=/etc/hosts line='127.0.0.1 fedmsg-relay'
- name: FOO
#command: echo "export KRB5CCNAME=FILE:/var/tmp/krbcc" > /etc/profile.d/module_build_service_developer_env.sh
lineinfile: dest=/etc/profile.d/module_build_service_developer_env.sh create=yes line='export KRB5CCNAME=FILE:/var/tmp/krbcc'
- name: FOO
#command: echo "export MODULE_BUILD_SERVICE_DEVELOPER_ENV=1" >> /etc/profile.d/module_build_service_developer_env.sh
lineinfile: dest=/etc/profile.d/module_build_service_developer_env.sh line='export MODULE_BUILD_SERVICE_DEVELOPER_ENV=1'
# - name: FOO
# command: source /etc/profile.d/module_build_service_developer_env.sh
# Create user and group for mbs
# @TODO use gid= and uid=
- name: Create group for mbs-frontend
@ -103,24 +89,16 @@
# @FIXME
# @FIXME but I have no idea how
- name: Export krbcc
command: echo 'export KRB5CCNAME=FILE:/var/tmp/krbcc' >> ~/.bashrc
# - name: Set properties in config
# replace:
# dest: /etc/module-build-service/config.py
# regexp: '^ {{ item.key }} = .*$'
# replace: ' {{ item.key }} = {{ item.value }}'
# backup: yes
# with_items:
# - { key: 'SYSTEM', value: '"copr"'}
# #- { key: 'REQUIRE_PACKAGER', value: 'False'}
# #- { key: 'OIDC_CLIENT_SECRETS', value: '"/etc/module-build-service/client_secrets.json"'}
#
# The config provided by MBS package is a python file
# Instead of replacing values by regex in such file, rather rename
# the original file and then install own configuration file which
# inherits the original one and then customizes it.
- name: Stat base_config
stat: path=/etc/module-build-service/base_config.py
register: base_config_stat
@ -136,24 +114,18 @@
copy: src=config.py dest=/etc/module-build-service/config.py
- name: Chown /etc/module-build-service to mbs:mbs
file: path=/etc/module-build-service owner=mbs group=mbs recurse=yes
# @TODO Should be packaged in module_build_service package? Or we need to create our own?
- name: Obtain client_secrets.json
#command: wget https://pagure.io/fm-orchestrator/raw/master/f/conf/client_secrets.json -P /etc/module-build-service/
get_url: url=https://pagure.io/fm-orchestrator/raw/master/f/conf/client_secrets.json dest=/etc/module-build-service/
# @TODO Should be packaged in module-build-service package? Or should already exist on copr-frontend instance?
- name: Copy cacert.pem
#command: wget https://pagure.io/fm-orchestrator/raw/master/f/conf/cacert.pem -O /etc/module-build-service/cacert.pem
- name: Obtain cacert.pem
get_url: url=https://pagure.io/fm-orchestrator/raw/master/f/conf/cacert.pem dest=/etc/module-build-service/cacert.pem
- name: Chown /etc/module-build-service to mbs:mbs
file: path=/etc/module-build-service owner=mbs group=mbs recurse=yes
- name: Upgrade database
command: mbs-upgradedb
@ -170,43 +142,29 @@
service: name=fedmsg-hub enabled=yes state=started
# @FIXME Use apache instead
- name: Run mbs-frontend
#service: name=mbs-frontend enabled=yes state=started
shell: nohup mbs-frontend < /dev/null >& /tmp/mbs-frontend.out &
# @FIXME Update the current coprs.conf
#- name: copy apache files to conf.d
#copy: src=httpd/mbs.conf dest=/etc/httpd/conf.d/mbs.conf
#tags:
#- config
# Prepare and run MBS frontend
- name: Create /opt/module-build-service
file: path=/opt/module-build-service state=directory
- name: Copy mbs.wsgi file
copy: src=mbs.wsgi dest=/opt/module-build-service/mbs.wsgi
# @FIXME Use apache instead
- name: Run mbs-frontend
shell: nohup mbs-frontend < /dev/null >& /tmp/mbs-frontend.out &
# Only for testing purposes
# Use it as: python submit_build.py 127.0.0.1:5000
- name: Download submit_build.py
#command: wget https://pagure.io/fm-orchestrator/raw/master/f/contrib/submit_build.py
get_url: url=https://pagure.io/fm-orchestrator/raw/master/f/contrib/submit_build.py dest=./
- name: Download submit-build.json
#command: wget https://pagure.io/fm-orchestrator/raw/master/f/contrib/submit-build.json
get_url: url=https://pagure.io/fm-orchestrator/raw/master/f/contrib/submit-build.json dest=./
# @TODO
#
# - I am currently storing my personal token in /etc/module-build-service/copr.conf
# and also my personal login in /etc/module-build-service/config.py
#
# - I am currently running mbs-frontend manually
# - Because of issue with <Location> in httpd config. See coprs.conf
#
#
# - Do not use wget, use http://docs.ansible.com/ansible/get_url_module.html instead
# - Rewrited, needs testing
# In this point personal information needs to be manually set, as described in @TODO at the beggining of the file
# The frontend process needs to be restarted. Then it is possible to submit new module build.
# Run: python submit_build.py 127.0.0.1:5000