Skip to content

Commit

Permalink
fix(ansible/docker): replace lineinfile with copy not to write du…
Browse files Browse the repository at this point in the history
…plicated entries (#66)

* fix(setup): remove apt ansible before installing by pip

Signed-off-by: Kenji Miyake <[email protected]>

* refactor: change task order

Signed-off-by: Kenji Miyake <[email protected]>

* fix(ansible/docker): replace `lineinfile` with `copy` not to write duplicated entries

Signed-off-by: Kenji Miyake <[email protected]>

* chore: remove paths condition to make it required for PRs

Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored Feb 21, 2022
1 parent efedec4 commit 55d58c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/vcs-import.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: vcs-import

on:
pull_request:
paths:
- autoware.repos
workflow_dispatch:

jobs:
Expand Down
17 changes: 7 additions & 10 deletions ansible/roles/docker/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@
groups: docker
append: true

- name: Save result of '. /etc/os-release;echo $ID$VERSION_ID'
ansible.builtin.shell: . /etc/os-release;echo $ID$VERSION_ID
register: distribution
changed_when: false

- name: Authorize NVIDIA Docker GPG key
become: true
ansible.builtin.apt_key:
url: https://nvidia.github.io/nvidia-docker/gpgkey

- name: Save result of '. /etc/os-release;echo $ID$VERSION_ID'
ansible.builtin.shell: . /etc/os-release;echo $ID$VERSION_ID
register: distribution
changed_when: false

- name: Save result of 'curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list'
ansible.builtin.uri:
url: https://nvidia.github.io/nvidia-docker/{{ distribution.stdout }}/nvidia-docker.list
Expand All @@ -89,13 +89,10 @@
# curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
- name: Add NVIDIA Docker apt repository to source list
become: true
ansible.builtin.lineinfile:
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/nvidia-docker.list
line: "{{ item }}"
state: present
create: true
content: "{{ nvidia_docker_list.content }}"
mode: 0644
with_items: "{{ nvidia_docker_list.content }}"

- name: Install NVIDIA Container Toolkit
become: true
Expand Down
1 change: 1 addition & 0 deletions setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fi
# Install ansible
ansible_version=$(pip3 list | grep -oP "^ansible\s+\K([0-9]+)" || true)
if [ "$ansible_version" != "5" ]; then
sudo apt-get -y purge ansible
sudo pip3 install -U "ansible==5.*"
fi

Expand Down

0 comments on commit 55d58c3

Please sign in to comment.