First pass at autocloud backend stuff.

This commit is contained in:
Ralph Bean 2015-09-28 17:41:16 +00:00
parent 07169bb901
commit d96376d8e1
10 changed files with 183 additions and 19 deletions

View file

@ -189,3 +189,6 @@
service: name=openstack-cinder-api state=restarted
service: name=openstack-cinder-scheduler state=restarted
service: name=openstack-cinder-volume state=restarted
- name: restart autocloud
service: name=autocloud state=restarted

View file

@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
vmhost: virthost22.phx2.fedoraproject.org
datacenter: phx2
autocloud_specialization: libvirt

View file

@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
vmhost: virthost20.phx2.fedoraproject.org
datacenter: phx2
autocloud_specialization: libvirt

View file

@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
vmhost: virthost19.phx2.fedoraproject.org
datacenter: phx2
autocloud_specialization: virtualbox

View file

@ -12,3 +12,5 @@ volgroup: /dev/vg_virthost16
vmhost: virthost16.phx2.fedoraproject.org
datacenter: phx2
autocloud_specialization: virtualbox

View file

@ -30,24 +30,22 @@
handlers:
- include: "{{ handlers }}/restart_services.yml"
#- name: dole out the service-specific config
# hosts: autocloud-backend;autocloud-backend-stg
# user: root
# gather_facts: True
#
# roles:
# - fedmsg/hub
# - autocloud/backend
# - redis?
# - role: collectd/fedmsg-service
# process: fedmsg-hub
- name: dole out the service-specific config
hosts: autocloud-backend;autocloud-backend-stg
user: root
gather_facts: True
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
handlers:
- include: "{{ handlers }}/restart_services.yml"
roles:
- redis
- autocloud/backend
# - role: collectd/redis-something?
# process: fedmsg-hub
#
# vars_files:
# - /srv/web/infra/ansible/vars/global.yml
# - "/srv/private/ansible/vars.yml"
# - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
#
# handlers:
# - include: "{{ handlers }}/restart_services.yml"
# - fedmsg/hub
# - role: collectd/fedmsg-service
# process: fedmsg-hub

View file

@ -0,0 +1,11 @@
curl -O https://kushal.fedorapeople.org/tunirtests.tar.gz
tar -xzvf tunirtests.tar.gz
sudo python3 -m unittest tunirtests.cloudtests
sudo systemctl stop crond.service
@@ sudo systemctl disable crond.service
@@ sudo reboot
SLEEP 30
sudo python3 -m unittest tunirtests.cloudservice.TestServiceManipulation
@@ sudo reboot
SLEEP 30
sudo python3 -m unittest tunirtests.cloudservice.TestServiceAfter

View file

@ -0,0 +1,6 @@
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc

View file

@ -0,0 +1,110 @@
---
# Configuration for the Fedora Notifications webapp
- name: install needed packages
dnf: pkg={{ item }} state=present
with_items:
- autocloud-common
- autocloud-backend
- tunir
- python-sqlalchemy
- python-sqlalchemy-utils
- libsemanage-python
notify:
- restart fedmsg-hub
- restart autocloud
tags:
- autocloud
- autocloud/backend
- name: Check for the existance of a 'tunirports' redis entry
command: redis-cli get tunirports
register: tunirports
tags:
- autocloud
- autocloud/backend
- name: Run createports.py, but only if we never have done so.
command: python /usr/share/tunir/createports.py
when: tunirports.stdout != '(nil)'
tags:
- autocloud
- autocloud/backend
- name: copy autocloud backend configuration
template: >
src={{ item }} dest=/etc/autocloud/{{ item }}
owner=root group=root mode=0600
with_items:
- autocloud.cfg
notify:
- restart fedmsg-hub
- restart autocloud
tags:
- autocloud
- autocloud/backend
- name: install vagrant-libvirt for the libvirt host
dnf: pkg={{ item }} state=present
with_items:
- vagrant-libvirt
when: autocloud_specialization == 'libvirt'
notify:
- restart fedmsg-hub
- restart autocloud
tags:
- autocloud
- autocloud/backend
- name: Setup virtualbox requirements where needed
copy: src=virtualbox.repo dest=/etc/yum.repos.d/virtualbox.repo
when: autocloud_specialization == 'virtualbox'
tags:
- autocloud
- autocloud/backend
- name: install virtualbox basics where needed
dnf: pkg={{ item }} state=present
with_items:
- VirtualBox-4.3
- kernel-devel
- vagrant
register: virtualbox_installed
when: autocloud_specialization == 'virtualbox'
tags:
- autocloud
- autocloud/backend
- name: setup vbox if it was just installed.
command: /etc/init.d/vboxdrv setup
when: virtualbox_installed|changed
tags:
- autocloud
- autocloud/backend
- name: install vagrant-virtualbox for the virtualbox host
dnf: pkg={{ item }} state=present
with_items:
- vagrant-virtualbox
when: autocloud_specialization == 'virtualbox'
notify:
- restart fedmsg-hub
- restart autocloud
tags:
- autocloud
- autocloud/backend
- name: Copy the correct tunir job details
copy: src=fedora.txt dest=/etc/autocloud/fedora.txt
notify:
- restart fedmsg-hub
- restart autocloud
tags:
- autocloud
- autocloud/backend
- name: start autocloud
service: name=autocloud enabled=yes state=started
tags:
- autocloud
- autocloud/backend

View file

@ -0,0 +1,28 @@
[autocloud]
{% if env == 'staging' %}
koji_server_url = http://koji.fedoraproject.org/kojihub/
base_koji_task_url = https://kojipkgs.fedoraproject.org//work/
{% else %}
koji_server_url = http://koji.stg.fedoraproject.org/kojihub/
base_koji_task_url = https://kojipkgs.stg.fedoraproject.org//work/
{% endif %}
virtualbox = false
debug = false
# These are required, but are ignored.
host = 0.0.0.0
port = 5000
{% if autocloud_specialization == 'libvirt' %}
libvirt = true
{% endif %}
{% if autocloud_specialization == 'virtualbox' %}
virtualbox = true
{% endif %}
[sqlalchemy]
{% if env == 'staging' %}
uri = postgres://autocloud:{{autocloud_db_password_stg}}@db01.stg/autocloud
{% else %}
uri = postgres://autocloud:{{autocloud_db_password}}@db01/autocloud
{% endif %}