-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathsonar-scanner-cli.yaml
57 lines (50 loc) · 1.98 KB
/
sonar-scanner-cli.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
---
- name: Ensure sonar-scanner is installed
hosts: factory
tasks:
- name: Ensure sonar-scanner is installed
community.general.homebrew:
name: "sonar-scanner"
state: latest
retries: "{{ default_retries }}"
delay: "{{ default_delay }}"
register: result
until: result is succeeded
when: ( ansible_distribution == 'MacOSX' )
- name: Install packages from AUR using a yay AUR helper
community.general.pacman:
name: sonar-scanner
state: latest
executable: yay
when: ( ansible_distribution == 'Archlinux' )
- name: When Rocky 8 ensure sonar-scanner is installed
block:
- name: Get stat for /usr/local/sonar-scanner
ansible.builtin.stat:
path: '/usr/local/sonar-scanner'
register: st
- name: Install sonar-scanner binary release
block:
- name: Unarchive https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472.zip to /usr/local
unarchive:
src: "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472.zip"
dest: /usr/local/
remote_src: yes
become: yes
- name: mv /usr/local/sonar-scanner-* to /usr/local/sonar-scanner
shell: |
mv /usr/local/sonar-scanner-* /usr/local/sonar-scanner
become: yes
when: not st.stat.exists
- name: "ensure /etc/profile PATH includes /usr/local/sonar-scanner/bin"
block:
- lineinfile:
dest: /etc/profile
regexp: "^export PATH=/usr/local/sonar-scanner/bin:$PATH"
state: absent
- lineinfile:
dest: /etc/profile
line: "export PATH=/usr/local/sonar-scanner/bin:$PATH"
insertafter: EOF
become: yes
when: ( ansible_distribution == 'Rocky' )