summaryrefslogtreecommitdiffstats
path: root/playbooks/manual/push-badges.yml
blob: e5a840b7bd38a067fcb6f7b1d7bbdce86c309b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Push out any new badge stuff.
#
# Badge artists and badge developers should be pushing stuff to this repo:
#
#   https://pagure.io/fedora-badges.git
#
# This playbook will take any new content from there and push it out onto our
# servers.

- name: get the badges repo happening from the batcave
  hosts: batcave01.phx2.fedoraproject.org
  user: root
  gather_facts: False

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  vars:
   upstream: "https://pagure.io/fedora-badges.git"
   workingdir: /srv/web/infra/badges/

  tasks:
  - name: Make a tmp directory
    tempfile:
      state: directory
      suffix: _badges_tempdir
    register: tmp

  - set_fact:
      tempdir: "{{tmp.path}}"

  - name: clone the local bare repo
    git: dest={{tempdir}} repo=/git/badges remote=origin update=yes

  - name: add pagure as a second remote
    command: git remote add pagure {{upstream}} chdir={{tempdir}}

  - name: pull down changes from pagure
    command: git pull pagure master chdir={{tempdir}}

  - name: push pagure changes back to the lockbox bare repo
    command: git push origin master chdir={{tempdir}}

  - name: clean up that temporary {{tempdir}} dir
    file: dest={{tempdir}} state=absent

  - name: and pull those commits from the bare repo to the working dir
    command: git pull origin master chdir={{workingdir}}

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

- name: copy new badge art over to the badges web nodes
  hosts: badges_web:badges_web_stg
  user: root
  gather_facts: False

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
   - badges/frontend

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

- name: copy any new badges rules over to the badges backend and restart it
  hosts: badges_backend:badges_backend_stg
  user: root
  gather_facts: False

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
   - badges/backend

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"