Skip to content

Commit 75e7007

Browse files
committed
Fixed a bug with directory path, working with directories is carried out in one copy module, the code is written more compact.
1 parent 1f166b6 commit 75e7007

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

ansible/install-apps.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,18 @@
66
- apt_repo_list_file: /etc/apt/sources.list.d/google-chrome.list
77
tasks:
88
- stat:
9-
path: {{ apt_repo_list_file }}
9+
path: "{{ apt_repo_list_file }}"
1010
register: google_apt_exists
1111
ignore_errors: yes
12-
13-
- name: Add Google Chrome repo 1
14-
copy: content="deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" dest=/etc/apt/sources.list.d/google-chrome.list
12+
- name: Add Google Chrome repo
13+
copy: content={{ item.content }} dest={{ item.dest }}
14+
with_items:
15+
- {content: 'deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main', dest: '{{ apt_repo_list_file }}'}
16+
- {content: 'deb http://dl.google.com/linux/chrome/deb/ stable main', dest: '{{ apt_repo_list_file }} owner=root group=root mode=644'}
1517
when: google_apt_exists.rc == 1
16-
17-
- name: Add Google Chrome repo 2
18-
copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{ apt_repo_list_file }} owner=root group=root mode=644
19-
when: google_apt_exists.rc == 1
20-
21-
- name: Update apt cache
22-
apt: update_cache=yes
23-
when: google_apt_exists.rc == 1
24-
2518
- name: Install apps
2619
apt:
20+
update_cache: yes
2721
name:
28-
2922
- google-chrome-stable
3023
- git

0 commit comments

Comments
 (0)