Skip to content

Commit d2f973f

Browse files
committed
Ansible modules are used instead of a shell commands, the code is more readable.
1 parent d0d645c commit d2f973f

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

ansible/install-apps.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,25 @@
22
- name: Install OS-level apps
33
hosts: all
44
become: yes
5-
vars:
6-
- apt_repo_list_file: /etc/apt/sources.list.d/google-chrome.list
75
tasks:
86
- stat:
9-
path: "{{ apt_repo_list_file }}"
7+
path: "/etc/apt/sources.list.d/google-chrome.list"
108
register: google_apt_exists
119
ignore_errors: yes
12-
- name: dir
13-
copy:
14-
content: "{{ item }}"
15-
dest: "{{ apt_repo_list_file }}"
16-
owner: root
17-
group: root
18-
mode: 644
10+
- name: Add Google Chrome directory
11+
apt_repository:
12+
repo: "{{ item }}"
13+
state: present
1914
loop:
20-
- "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main"
21-
- "deb http://dl.google.com/linux/chrome/deb/ stable main"
15+
- "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main"
16+
- "deb http://dl.google.com/linux/chrome/deb/ stable main"
2217
- name: Add Google Chrome key
23-
shell: wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
18+
apt_key:
19+
url: https://dl-ssl.google.com/linux/linux_signing_key.pub
20+
state: present
2421
- name: Install apps
2522
apt:
26-
update_cache: yes
27-
name:
28-
- google-chrome-stable
29-
- git
23+
update_cache: yes
24+
name:
25+
- google-chrome-stable
26+
- git

0 commit comments

Comments
 (0)