mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-11 10:32:27 +08:00
Add an upgrade playbook for tagger.
This commit is contained in:
57
playbooks/manual/upgrade/tagger.yml
Normal file
57
playbooks/manual/upgrade/tagger.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
- name: push packages out
|
||||
hosts: tagger;tagger-stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
vars:
|
||||
testing: False
|
||||
handlers:
|
||||
- include: "{{ handlers }}/restart_services.yml"
|
||||
|
||||
tasks:
|
||||
- name: clean all metadata {%if testing%}(with infrastructure-testing on){%endif%}
|
||||
command: yum clean all {%if testing%} --enablerepo=infrastructure-testing {%endif%}
|
||||
always_run: yes
|
||||
- name: yum update fedora-tagger packages from main repo
|
||||
yum: name="fedora-tagger" state=latest
|
||||
when: not testing
|
||||
- name: yum update fedora-tagger packages from testing repo
|
||||
yum: name="fedora-tagger" state=latest enablerepo=infrastructure-testing
|
||||
when: testing
|
||||
|
||||
- name: verify the config and restart it
|
||||
hosts: tagger;tagger-stg
|
||||
user: root
|
||||
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"
|
||||
|
||||
pre_tasks:
|
||||
- name: tell nagios to shush
|
||||
nagios: action=downtime minutes=60 service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
||||
delegate_to: noc01.phx2.fedoraproject.org
|
||||
ignore_errors: true
|
||||
|
||||
roles:
|
||||
- tagger
|
||||
|
||||
post_tasks:
|
||||
- service: name="httpd" state=stopped
|
||||
|
||||
- name: Upgrade the database (only on one of the two nodes...)
|
||||
command: /usr/bin/alembic -c /usr/share/fedoratagger/alembic.ini upgrade head
|
||||
args:
|
||||
chdir: /usr/share/fedoratagger/
|
||||
when: inventory_hostname_short == 'tagger01'
|
||||
|
||||
- service: name="httpd" state=started
|
||||
|
||||
- name: tell nagios to unshush
|
||||
nagios: action=unsilence service=host host={{ inventory_hostname_short }}{{ env_suffix }}
|
||||
delegate_to: noc01.phx2.fedoraproject.org
|
||||
ignore_errors: true
|
||||
@@ -42,7 +42,7 @@
|
||||
dest=/etc/fedoratagger/fedoratagger.cfg
|
||||
owner=apache
|
||||
group=apache
|
||||
mode=0600
|
||||
mode=0640
|
||||
tags:
|
||||
- config
|
||||
- tagger
|
||||
@@ -62,6 +62,17 @@
|
||||
notify:
|
||||
- restart apache
|
||||
|
||||
- name: copy tagger alembic config
|
||||
template: >
|
||||
src=alembic.ini
|
||||
dest=/usr/share/fedoratagger/alembic.ini
|
||||
owner=apache
|
||||
group=apache
|
||||
mode=0640
|
||||
tags:
|
||||
- config
|
||||
- tagger
|
||||
|
||||
- name: Set some selinux booleans
|
||||
seboolean: name={{item}} persistent=yes state=yes
|
||||
with_items:
|
||||
|
||||
53
roles/tagger/templates/alembic.ini
Normal file
53
roles/tagger/templates/alembic.ini
Normal file
@@ -0,0 +1,53 @@
|
||||
# A generic, single database configuration.
|
||||
|
||||
[alembic]
|
||||
# path to migration scripts
|
||||
script_location = alembic
|
||||
|
||||
# template used to generate migration files
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
# max length of characters to apply to the
|
||||
# "slug" field
|
||||
#truncate_slug_length = 40
|
||||
|
||||
# set to 'true' to run the environment during
|
||||
# the 'revision' command, regardless of autogenerate
|
||||
# revision_environment = false
|
||||
|
||||
sqlalchemy.url = postgresql://fedoratagger:{{taggerDBPassword}}@tagger_db/fedoratagger
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user