remove final elections items from ansible
This commit is contained in:
parent
328113f81a
commit
3180cac828
10 changed files with 0 additions and 359 deletions
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
# Define resources for this group of hosts here.
|
|
||||||
lvm_size: 20000
|
|
||||||
mem_size: 2048
|
|
||||||
num_cpus: 2
|
|
||||||
|
|
||||||
wsgi_fedmsg_service: fedora_elections
|
|
||||||
wsgi_procs: 2
|
|
||||||
wsgi_threads: 2
|
|
||||||
|
|
||||||
tcp_ports: [ 80 ]
|
|
||||||
|
|
||||||
# Neeed for rsync from log01 for logs.
|
|
||||||
custom_rules: [ '-A INPUT -p tcp -m tcp -s 10.5.126.13 --dport 873 -j ACCEPT', '-A INPUT -p tcp -m tcp -s 192.168.1.59 --dport 873 -j ACCEPT' ]
|
|
||||||
|
|
||||||
fas_client_groups: sysadmin-noc,sysadmin-web,fi-apprentice,sysadmin-veteran
|
|
||||||
|
|
||||||
freezes: false
|
|
||||||
|
|
||||||
# These are consumed by a task in roles/fedmsg/base/main.yml
|
|
||||||
fedmsg_certs:
|
|
||||||
- service: shell
|
|
||||||
owner: root
|
|
||||||
group: sysadmin
|
|
||||||
can_send:
|
|
||||||
- logger.log
|
|
||||||
- service: fedora_elections
|
|
||||||
owner: root
|
|
||||||
group: apache
|
|
||||||
can_send:
|
|
||||||
- fedora_elections.candidate.delete
|
|
||||||
- fedora_elections.candidate.edit
|
|
||||||
- fedora_elections.candidate.new
|
|
||||||
- fedora_elections.election.edit
|
|
||||||
- fedora_elections.election.new
|
|
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
# Define resources for this group of hosts here.
|
|
||||||
lvm_size: 20000
|
|
||||||
mem_size: 1024
|
|
||||||
num_cpus: 2
|
|
||||||
|
|
||||||
wsgi_fedmsg_service: fedora_elections
|
|
||||||
wsgi_procs: 2
|
|
||||||
wsgi_threads: 2
|
|
||||||
|
|
||||||
tcp_ports: [ 80 ]
|
|
||||||
|
|
||||||
# Neeed for rsync from log01 for logs.
|
|
||||||
custom_rules: [ '-A INPUT -p tcp -m tcp -s 10.5.126.13 --dport 873 -j ACCEPT', '-A INPUT -p tcp -m tcp -s 192.168.1.59 --dport 873 -j ACCEPT' ]
|
|
||||||
|
|
||||||
fas_client_groups: sysadmin-noc,sysadmin-web,fi-apprentice,sysadmin-veteran
|
|
||||||
|
|
||||||
freezes: false
|
|
||||||
|
|
||||||
# These are consumed by a task in roles/fedmsg/base/main.yml
|
|
||||||
fedmsg_certs:
|
|
||||||
- service: shell
|
|
||||||
owner: root
|
|
||||||
group: sysadmin
|
|
||||||
can_send:
|
|
||||||
- logger.log
|
|
||||||
- service: fedora_elections
|
|
||||||
owner: root
|
|
||||||
group: apache
|
|
||||||
can_send:
|
|
||||||
- fedora_elections.candidate.delete
|
|
||||||
- fedora_elections.candidate.edit
|
|
||||||
- fedora_elections.candidate.new
|
|
||||||
- fedora_elections.election.edit
|
|
||||||
- fedora_elections.election.new
|
|
|
@ -1,67 +0,0 @@
|
||||||
- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=elections:elections_stg"
|
|
||||||
|
|
||||||
- name: make the box be real
|
|
||||||
hosts: elections:elections_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
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- base
|
|
||||||
- rkhunter
|
|
||||||
- nagios_client
|
|
||||||
- hosts
|
|
||||||
- fas_client
|
|
||||||
- rsyncd
|
|
||||||
- sudo
|
|
||||||
- { role: openvpn/client,
|
|
||||||
when: env != "staging" }
|
|
||||||
- mod_wsgi
|
|
||||||
- collectd/base
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- import_tasks: "{{ tasks_path }}/yumrepos.yml"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- import_tasks: "{{ tasks_path }}/2fa_client.yml"
|
|
||||||
- import_tasks: "{{ tasks_path }}/motd.yml"
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
||||||
|
|
||||||
- name: set up fedmsg on elections
|
|
||||||
hosts: elections:elections_stg
|
|
||||||
user: root
|
|
||||||
gather_facts: True
|
|
||||||
|
|
||||||
vars_files:
|
|
||||||
- /srv/web/infra/ansible/vars/global.yml
|
|
||||||
- "/srv/private/ansible/vars.yml"
|
|
||||||
- "{{ vars_path }}/{{ ansible_distribution }}.yml"
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- fedmsg/base
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
||||||
|
|
||||||
- name: deploy elections itself
|
|
||||||
hosts: elections:elections_stg
|
|
||||||
user: root
|
|
||||||
gather_facts: True
|
|
||||||
|
|
||||||
vars_files:
|
|
||||||
- /srv/web/infra/ansible/vars/global.yml
|
|
||||||
- "/srv/private/ansible/vars.yml"
|
|
||||||
- "{{ vars_path }}/{{ ansible_distribution }}.yml"
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- elections
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
# A generic, single database configuration.
|
|
||||||
|
|
||||||
[alembic]
|
|
||||||
# path to migration scripts
|
|
||||||
script_location = /usr/share/fedora-elections/alembic
|
|
||||||
|
|
||||||
# template used to generate migration files
|
|
||||||
# file_template = %%(rev)s_%%(slug)s
|
|
||||||
|
|
||||||
# set to 'true' to run the environment during
|
|
||||||
# the 'revision' command, regardless of autogenerate
|
|
||||||
# revision_environment = false
|
|
||||||
|
|
||||||
sqlalchemy.url = postgresql://{{ elections_db_user }}:{{ elections_db_pass }}@{{ elections_db_host }}/{{ elections_db_name }}
|
|
||||||
|
|
||||||
|
|
||||||
# Logging configuration
|
|
||||||
[loggers]
|
|
||||||
keys = root,sqlalchemy,alembic
|
|
||||||
|
|
||||||
[handlers]
|
|
||||||
keys = console
|
|
||||||
|
|
||||||
[formatters]
|
|
||||||
keys = generic
|
|
||||||
|
|
||||||
[logger_root]
|
|
||||||
level = WARN
|
|
||||||
handlers = console
|
|
||||||
qualname =
|
|
||||||
|
|
||||||
[logger_sqlalchemy]
|
|
||||||
level = WARN
|
|
||||||
handlers =
|
|
||||||
qualname = sqlalchemy.engine
|
|
||||||
|
|
||||||
[logger_alembic]
|
|
||||||
level = INFO
|
|
||||||
handlers =
|
|
||||||
qualname = alembic
|
|
||||||
|
|
||||||
[handler_console]
|
|
||||||
class = StreamHandler
|
|
||||||
args = (sys.stderr,)
|
|
||||||
level = NOTSET
|
|
||||||
formatter = generic
|
|
||||||
|
|
||||||
[formatter_generic]
|
|
||||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
||||||
datefmt = %H:%M:%S
|
|
|
@ -1,64 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
from __future__ import unicode_literals, print_function
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import sqlalchemy
|
|
||||||
|
|
||||||
|
|
||||||
if 'FEDORA_ELECTIONS_CONFIG' not in os.environ \
|
|
||||||
and os.path.exists('/etc/fedora-elections/fedora-elections.cfg'):
|
|
||||||
os.environ['FEDORA_ELECTIONS_CONFIG'] = '/etc/fedora-elections/'\
|
|
||||||
'fedora-elections.cfg'
|
|
||||||
|
|
||||||
|
|
||||||
from fedora_elections import SESSION
|
|
||||||
from fedora_elections import models
|
|
||||||
|
|
||||||
|
|
||||||
def get_candidate_users(session, username):
|
|
||||||
''' Return all fedora_elections.models.Candidate related to the username
|
|
||||||
provided
|
|
||||||
'''
|
|
||||||
query = SESSION.query(
|
|
||||||
models.Candidate
|
|
||||||
).filter(
|
|
||||||
sqlalchemy.or_(
|
|
||||||
models.Candidate.name.ilike('%{0}%'.format(username)),
|
|
||||||
models.Candidate.fas_name.ilike('%s%'.format(username))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return query.all()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
''' Prints out all the election involving the username specified in the
|
|
||||||
SAR_USERNAME environment variable.
|
|
||||||
'''
|
|
||||||
|
|
||||||
username = os.getenv('SAR_USERNAME')
|
|
||||||
if not username:
|
|
||||||
print('An username is required to query datagrepper')
|
|
||||||
return 1
|
|
||||||
|
|
||||||
output = {}
|
|
||||||
output['candidates'] = []
|
|
||||||
|
|
||||||
for candidate in get_candidate_users(SESSION, username):
|
|
||||||
tmp = candidate.to_json()
|
|
||||||
tmp['election'] = candidate.election.to_json()
|
|
||||||
output['candidates'].append(tmp)
|
|
||||||
|
|
||||||
SESSION.remove()
|
|
||||||
|
|
||||||
print(json.dumps(
|
|
||||||
output, sort_keys=True, indent=4, separators=(',', ': ')
|
|
||||||
).encode('utf-8'))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main())
|
|
|
@ -1,57 +0,0 @@
|
||||||
# Beware that the quotes around the values are mandatory
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
### Secret key for the Flask application
|
|
||||||
SECRET_KEY='{{ elections_secret_key }}'
|
|
||||||
|
|
||||||
### url to the database server:
|
|
||||||
DB_URL='postgresql://{{ elections_db_user }}:{{ elections_db_pass }}@{{ elections_db_host }}/{{ elections_db_name }}'
|
|
||||||
|
|
||||||
## One ore more FAS group that will have admin rights over the whole
|
|
||||||
## application, including all elections past, present and future
|
|
||||||
FEDORA_ELECTIONS_ADMIN_GROUP = 'elections'
|
|
||||||
|
|
||||||
|
|
||||||
## Fedora-elections can integrate with FAS to retrieve information about the
|
|
||||||
## candidates, the following configuration keys are required for this
|
|
||||||
## integration.
|
|
||||||
## URL of the FAS server to use
|
|
||||||
{% if env == 'staging' %}
|
|
||||||
FAS_BASE_URL = 'https://admin.stg.fedoraproject.org/accounts/'
|
|
||||||
{% else %}
|
|
||||||
FAS_BASE_URL = 'https://admin.fedoraproject.org/accounts/'
|
|
||||||
{% endif %}
|
|
||||||
FAS_USERNAME = '{{ fedorathirdpartyUser }}'
|
|
||||||
FAS_PASSWORD = '{{ fedorathirdpartyPassword }}'
|
|
||||||
## This should be ``True`` but should be changed to ``False`` if the FAS server
|
|
||||||
## used does not have a valid SSL certificate.
|
|
||||||
FAS_CHECK_CERT = True
|
|
||||||
|
|
||||||
# This is required to fix login
|
|
||||||
PREFERRED_URL_SCHEME='https'
|
|
||||||
|
|
||||||
# Make browsers send session cookie only via HTTPS
|
|
||||||
SESSION_COOKIE_SECURE = True
|
|
||||||
SESSION_COOKIE_NAME = 'elections'
|
|
||||||
|
|
||||||
# Used by SESSION_COOKIE_PATH
|
|
||||||
APPLICATION_ROOT = '/voting/'
|
|
||||||
|
|
||||||
DOGPILE_CACHE = {
|
|
||||||
'backend': 'dogpile.cache.memcached',
|
|
||||||
'arguments': {
|
|
||||||
'url': ["memcached01:11211"],
|
|
||||||
'distributed_lock': True,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
## URLs to fedmenu resources
|
|
||||||
{% if env == 'staging' %}
|
|
||||||
FEDMENU_URL = 'https://apps.stg.fedoraproject.org/fedmenu'
|
|
||||||
FEDMENU_DATA_URL = 'https://apps.stg.fedoraproject.org/js/data.js'
|
|
||||||
{% else %}
|
|
||||||
FEDMENU_URL = 'https://apps.fedoraproject.org/fedmenu'
|
|
||||||
FEDMENU_DATA_URL = 'https://apps.fedoraproject.org/js/data.js'
|
|
||||||
{% endif %}
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
Alias /voting/static /usr/lib/python2.7/site-packages/fedora_elections/static
|
|
||||||
|
|
||||||
WSGIDaemonProcess elections maximum-requests=1000 display-name=elections processes={{ wsgi_procs }} threads={{ wsgi_threads }}
|
|
||||||
WSGISocketPrefix run/wsgi
|
|
||||||
WSGIRestrictStdout On
|
|
||||||
WSGIRestrictSignal Off
|
|
||||||
WSGIPythonOptimize 1
|
|
||||||
|
|
||||||
WSGIScriptAlias /voting /var/www/fedora-elections.wsgi
|
|
||||||
|
|
||||||
<Location />
|
|
||||||
WSGIProcessGroup elections
|
|
||||||
<IfModule mod_authz_core.c>
|
|
||||||
# Apache 2.4
|
|
||||||
Require all granted
|
|
||||||
</IfModule>
|
|
||||||
<IfModule !mod_authz_core.c>
|
|
||||||
# Apache 2.2
|
|
||||||
Order deny,allow
|
|
||||||
Allow from all
|
|
||||||
</IfModule>
|
|
||||||
</Location>
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#-*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# The three lines below are required to run on EL6 as EL6 has
|
|
||||||
# two possible version of python-sqlalchemy and python-jinja2
|
|
||||||
# These lines make sure the application uses the correct version.
|
|
||||||
import __main__
|
|
||||||
__main__.__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4']
|
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
import os
|
|
||||||
# Set the environment variable pointing to the configuration file
|
|
||||||
os.environ['FEDORA_ELECTIONS_CONFIG'] = '/etc/fedora-elections/fedora-elections.cfg'
|
|
||||||
|
|
||||||
# The most import line to make the wsgi working
|
|
||||||
from fedora_elections import APP as application
|
|
||||||
application.debug = True
|
|
|
@ -1,6 +0,0 @@
|
||||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
||||||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
|
||||||
|
|
||||||
10.5.126.23 infrastructure.fedoraproject.org
|
|
||||||
|
|
||||||
10.5.126.71 db-elections db-elections
|
|
|
@ -1,6 +0,0 @@
|
||||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
||||||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
|
||||||
|
|
||||||
10.5.126.23 infrastructure.fedoraproject.org
|
|
||||||
|
|
||||||
10.5.126.71 db-elections db-elections
|
|
Loading…
Add table
Add a link
Reference in a new issue