First pass at autocloud backend stuff.
This commit is contained in:
parent
07169bb901
commit
d96376d8e1
10 changed files with 183 additions and 19 deletions
|
@ -189,3 +189,6 @@
|
||||||
service: name=openstack-cinder-api state=restarted
|
service: name=openstack-cinder-api state=restarted
|
||||||
service: name=openstack-cinder-scheduler state=restarted
|
service: name=openstack-cinder-scheduler state=restarted
|
||||||
service: name=openstack-cinder-volume state=restarted
|
service: name=openstack-cinder-volume state=restarted
|
||||||
|
|
||||||
|
- name: restart autocloud
|
||||||
|
service: name=autocloud state=restarted
|
||||||
|
|
|
@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
|
||||||
vmhost: virthost22.phx2.fedoraproject.org
|
vmhost: virthost22.phx2.fedoraproject.org
|
||||||
|
|
||||||
datacenter: phx2
|
datacenter: phx2
|
||||||
|
|
||||||
|
autocloud_specialization: libvirt
|
||||||
|
|
|
@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
|
||||||
vmhost: virthost20.phx2.fedoraproject.org
|
vmhost: virthost20.phx2.fedoraproject.org
|
||||||
|
|
||||||
datacenter: phx2
|
datacenter: phx2
|
||||||
|
|
||||||
|
autocloud_specialization: libvirt
|
||||||
|
|
|
@ -12,3 +12,5 @@ volgroup: /dev/vg_guests
|
||||||
vmhost: virthost19.phx2.fedoraproject.org
|
vmhost: virthost19.phx2.fedoraproject.org
|
||||||
|
|
||||||
datacenter: phx2
|
datacenter: phx2
|
||||||
|
|
||||||
|
autocloud_specialization: virtualbox
|
||||||
|
|
|
@ -12,3 +12,5 @@ volgroup: /dev/vg_virthost16
|
||||||
vmhost: virthost16.phx2.fedoraproject.org
|
vmhost: virthost16.phx2.fedoraproject.org
|
||||||
|
|
||||||
datacenter: phx2
|
datacenter: phx2
|
||||||
|
|
||||||
|
autocloud_specialization: virtualbox
|
||||||
|
|
|
@ -30,24 +30,22 @@
|
||||||
handlers:
|
handlers:
|
||||||
- include: "{{ handlers }}/restart_services.yml"
|
- include: "{{ handlers }}/restart_services.yml"
|
||||||
|
|
||||||
#- name: dole out the service-specific config
|
- name: dole out the service-specific config
|
||||||
# hosts: autocloud-backend;autocloud-backend-stg
|
hosts: autocloud-backend;autocloud-backend-stg
|
||||||
# user: root
|
user: root
|
||||||
# gather_facts: True
|
gather_facts: True
|
||||||
#
|
vars_files:
|
||||||
# roles:
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
# - fedmsg/hub
|
- "/srv/private/ansible/vars.yml"
|
||||||
# - autocloud/backend
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||||
# - redis?
|
handlers:
|
||||||
# - role: collectd/fedmsg-service
|
- include: "{{ handlers }}/restart_services.yml"
|
||||||
# process: fedmsg-hub
|
|
||||||
|
roles:
|
||||||
|
- redis
|
||||||
|
- autocloud/backend
|
||||||
# - role: collectd/redis-something?
|
# - role: collectd/redis-something?
|
||||||
# process: fedmsg-hub
|
# process: fedmsg-hub
|
||||||
#
|
# - fedmsg/hub
|
||||||
# vars_files:
|
# - role: collectd/fedmsg-service
|
||||||
# - /srv/web/infra/ansible/vars/global.yml
|
# process: fedmsg-hub
|
||||||
# - "/srv/private/ansible/vars.yml"
|
|
||||||
# - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
||||||
#
|
|
||||||
# handlers:
|
|
||||||
# - include: "{{ handlers }}/restart_services.yml"
|
|
||||||
|
|
11
roles/autocloud/backend/files/fedora.txt
Normal file
11
roles/autocloud/backend/files/fedora.txt
Normal 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
|
6
roles/autocloud/backend/files/virtualbox.repo
Normal file
6
roles/autocloud/backend/files/virtualbox.repo
Normal 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
|
110
roles/autocloud/backend/tasks/main.yml
Normal file
110
roles/autocloud/backend/tasks/main.yml
Normal 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
|
28
roles/autocloud/backend/templates/autocloud.cfg
Normal file
28
roles/autocloud/backend/templates/autocloud.cfg
Normal 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 %}
|
Loading…
Add table
Add a link
Reference in a new issue