File tree 3 files changed +43
-0
lines changed
roles/github-windows/tasks
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 7
7
- hosts :
8
8
- " *-win*"
9
9
gather_facts : yes
10
+ gather_subset : min
10
11
11
12
roles :
12
13
- bootstrap
Original file line number Diff line number Diff line change 32
32
33
33
- hosts :
34
34
- " *-win*"
35
+ gather_facts : yes
36
+ gather_subset : min
35
37
36
38
roles :
37
39
- bootstrap
38
40
- package-upgrade
39
41
- baselayout-windows
40
42
- visual-studio
41
43
- jenkins-worker-windows
44
+ - github-windows
42
45
43
46
pre_tasks :
44
47
- name : check if secret is properly set
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ # Set up hosts to be able to checkout/fetch from github.com via SSH.
4
+
5
+ - name : Check if current user already has a .ssh directory
6
+ win_stat : path='{{ansible_facts["env"]["USERPROFILE"]}}\.ssh'
7
+ register : ssh_stat
8
+
9
+ - name : Create a .ssh directory for current user if missing
10
+ win_file :
11
+ path : ' {{ansible_facts["env"]["USERPROFILE"]}}\.ssh'
12
+ state : directory
13
+ when : not ssh_stat.stat.exists
14
+
15
+ - name : Check if current user already has a known_hosts file
16
+ win_stat : path='{{ansible_facts["env"]["USERPROFILE"]}}\.ssh\known_hosts'
17
+ register : known_hosts_stat
18
+
19
+ - name : Create a known_hosts for current user if missing
20
+ win_copy :
21
+ src : ' ../github/files/github_known_hosts'
22
+ dest : ' {{ansible_facts["env"]["USERPROFILE"]}}\.ssh\known_hosts'
23
+ when : not known_hosts_stat.stat.exists
24
+
25
+ - name : Add github known hosts to known_hosts file if present
26
+ win_lineinfile :
27
+ path : ' {{ansible_facts["env"]["USERPROFILE"]}}\.ssh\known_hosts'
28
+ line : ' {{item}}'
29
+ state : present
30
+ loop : " {{lookup('file', '../github/files/github_known_hosts').splitlines()}}"
31
+ when : known_hosts_stat.stat.exists
32
+
33
+ - name : Remove github bad hosts from known_hosts file if present
34
+ win_lineinfile :
35
+ path : ' {{ansible_facts["env"]["USERPROFILE"]}}\.ssh\known_hosts'
36
+ line : ' {{item}}'
37
+ state : absent
38
+ loop : " {{lookup('file', '../github/files/github_bad_hosts').splitlines()}}"
39
+ when : known_hosts_stat.stat.exists
You can’t perform that action at this time.
0 commit comments