File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
roles/github-windows/tasks Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 77- hosts :
88 - " *-win*"
99 gather_facts : yes
10+ gather_subset : min
1011
1112 roles :
1213 - bootstrap
Original file line number Diff line number Diff line change 3232
3333- hosts :
3434 - " *-win*"
35+ gather_facts : yes
36+ gather_subset : min
3537
3638 roles :
3739 - bootstrap
3840 - package-upgrade
3941 - baselayout-windows
4042 - visual-studio
4143 - jenkins-worker-windows
44+ - github-windows
4245
4346 pre_tasks :
4447 - 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