forked from osism/github-manager
-
Notifications
You must be signed in to change notification settings - Fork 3
/
playbook.yaml
58 lines (51 loc) · 1.76 KB
/
playbook.yaml
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
---
- hosts: localhost
vars:
gitcontrol_root_dir: ./orgs
organization: SovereignCloudStack
git_type: github
tasks:
- name: Check {{ organization }} general data file
ansible.builtin.stat:
path: "{{ (gitcontrol_root_dir + '/' + organization + '/data.yaml') }}"
register: org_data
- name: Read {{ organization }} organization target data
include_vars:
file: "{{ org_data.stat.path }}"
name: "org"
when: org_data.stat.exists
- name: Apply {{ organization }} members
opentelekomcloud.gitcontrol.github_org_members:
token: "{{ api_token }}"
organization: "{{ organization }}"
members: "{{ org.members }}"
when:
- "org is defined"
- "org.members is defined"
- "git_type == 'github'"
- "api_token is defined"
register: members
- name: Apply {{ organization }} teams
opentelekomcloud.gitcontrol.github_org_teams:
token: "{{ api_token }}"
organization: "{{ organization }}"
teams: "{{ org.teams | default([]) }}"
when:
- "org is defined"
- "org.teams is defined"
- "git_type == 'github'"
- "api_token is defined"
register: teams
- name: Find {{ organization }} repositories data
ansible.builtin.find:
paths: "{{ gitcontrol_root_dir + '/' + organization + '/repositories' }}"
patterns: "*.yaml,*.yml"
file_type: "file"
register: repository_data
- include_tasks: "process_repository_file.yaml"
vars:
data: "{{ lookup('file', zj_repository_file.path) | from_yaml }}"
type: "{{ org.type | default('github') }}"
loop: "{{ repository_data.files }}"
loop_control:
loop_var: "zj_repository_file"