diff --git a/inventory/host_vars/testdays.fedorainfracloud.org b/inventory/host_vars/testdays.fedorainfracloud.org new file mode 100644 index 0000000000..0e8f1e595b --- /dev/null +++ b/inventory/host_vars/testdays.fedorainfracloud.org @@ -0,0 +1,36 @@ +--- +image: rhel7-20141015 +instance_type: m1.small +keypair: fedora-admin-20130801 +security_group: ssh-anywhere-persistent,web-80-anywhere-persistent,web-443-anywhere-persistent,default +zone: nova +tcp_ports: [22, 80, 443] + +inventory_tenant: persistent +inventory_instance_name: testdays +hostbase: testdays +public_ip: 209.132.184.134 +root_auth_users: tflink jskladan +description: fedora testdays instance + +#cloud_networks: +# # persistent-net +# - net-id: "67b77354-39a4-43de-b007-bb813ac5c35f" + +resultsdb_db_host: 209.132.184.134 +resultsdb_db_port: 5432 +resultsdb_endpoint: 'resultsdb_api' +resultsdb_fe_endpoint: 'resultsdb' +resultsdb_db_name: resultsdb_testdays + +testdays_db_host: 209.132.184.134 +testdays_db_port: 5432 +testdays_endpoint: 'testdays' +testdays_db_name: testdays + +external_hostname: testdays.fedorainfracloud.org + +allowed_hosts: + - 10.5.124 + +freezes: false diff --git a/inventory/inventory b/inventory/inventory index 1e2326e54b..ac83a52f38 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -869,6 +869,8 @@ developer.fedorainfracloud.org # # These are in the new cloud # +testdays.fedorainfracloud.org + [jenkins-master] jenkins.fedorainfracloud.org diff --git a/playbooks/hosts/testdays.fedorainfracloud.org.yml b/playbooks/hosts/testdays.fedorainfracloud.org.yml new file mode 100644 index 0000000000..f18cee1bd8 --- /dev/null +++ b/playbooks/hosts/testdays.fedorainfracloud.org.yml @@ -0,0 +1,49 @@ +--- +- name: check/create instance + hosts: testdays.fedorainfracloud.org + gather_facts: False + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - /srv/private/ansible/vars.yml + - /srv/web/infra/ansible/vars/fedora-cloud.yml + - /srv/private/ansible/files/openstack/passwords.yml + + tasks: + - include: "{{ tasks }}/persistent_cloud_new.yml" + +- name: setup all the things + hosts: testdays.fedorainfracloud.org + gather_facts: True + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - /srv/private/ansible/vars.yml + - /srv/private/ansible/files/openstack/passwords.yml + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + pre_tasks: + - include: "{{ tasks }}/cloud_setup_basic.yml" + - name: set hostname (required by some services, at least postfix need it) + shell: "hostname {{inventory_hostname}}" + + roles: + - postgresql_server + +- name: configure resultsdb and testdays + hosts: testdays + 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 + + roles: + - { role: taskotron/resultsdb-backend, tags: ['resultsdb-be'] } + - { role: taskotron/resultsdb-frontend, tags: ['resultsdb-fe'] } + - { role: taskotron/testdays, tags: ['testdays'] } + + handlers: + - include: "{{ handlers }}/restart_services.yml" + diff --git a/roles/testdays/defaults/main.yml b/roles/testdays/defaults/main.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/roles/testdays/tasks/main.yml b/roles/testdays/tasks/main.yml new file mode 100644 index 0000000000..570087db29 --- /dev/null +++ b/roles/testdays/tasks/main.yml @@ -0,0 +1,33 @@ +--- +- name: ensure packages required for testdays are installed + action: yum name={{ item }} state=latest + with_items: + - testdays + - mod_wsgi + - python-psycopg2 + +- name: ensure database is created + delegate_to: "{{ testdays_db_host }}" + sudo_user: postgres + sudo: true + action: postgresql_db db={{ testdays_db_name }} + +- name: ensure testdays db user has access to database + delegate_to: "{{ testdays_db_host }}" + sudo_user: postgres + sudo: true + action: postgresql_user db={{ testdays_db_name }} user={{ testdays_db_user }} password={{ testdays_db_password }} role_attr_flags=NOSUPERUSER + +- name: ensure selinux lets httpd talk to postgres + seboolean: name=httpd_can_network_connect_db persistent=yes state + +- name: generate testdays config + template: src=settings.py.j2 dest=/etc/testdays/settings.py owner=root group=root mode=0644 + notify: + - restart httpd + +- name: generate testdays apache config + template: src=testdays.conf.j2 dest=/etc/httpd/conf.d/testdays.conf owner=root group=root mode=0644 + notify: + - restart httpd + diff --git a/roles/testdays/templates/settings.py.j2 b/roles/testdays/templates/settings.py.j2 new file mode 100644 index 0000000000..215c34855e --- /dev/null +++ b/roles/testdays/templates/settings.py.j2 @@ -0,0 +1,9 @@ +RESULTSDB_URL = 'http://127.0.0.1/{{ resultsdb_endpoint }}/api/v1.0' +SECRET_KEY = '{{ testdays_secret_key }}' +SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{{ testdays_db_user }}:{{ testdays_db_password }}@{{ testdays_db_host }}:{{ testdays_db_port }}/{{ testdays_db_name }}' +SHOW_DB_URI = False +PRODUCTION = True +FILE_LOGGING = False +LOGFILR = '/var/log/testdays/testdays.log' +SYSLOG_LOGGING = False +STREAM_LOGGING = True diff --git a/roles/testdays/templates/testdays.conf.j2 b/roles/testdays/templates/testdays.conf.j2 new file mode 100644 index 0000000000..f4baf088a6 --- /dev/null +++ b/roles/testdays/templates/testdays.conf.j2 @@ -0,0 +1,18 @@ +WSGIDaemonProcess testdays user=apache group=apache threads=5 +WSGIScriptAlias /{{ testdays_endpoint }} /usr/share/testdays/testdays.wsgi +WSGISocketPrefix run/wsgi + + + WSGIProcessGroup testdays + WSGIApplicationGroup %{GLOBAL} + WSGIScriptReloading On + + # Apache 2.4 + Require all granted + + + Order allow,deny + Allow from all + + +