Commit ea5e2ea3 authored by nanahira's avatar nanahira

add source in advance

parent 8523839d
...@@ -19,15 +19,3 @@ ...@@ -19,15 +19,3 @@
path: '/etc/apt/sources.list.d/wireguard_ubuntu_wireguard_{{ ansible_distribution_release|lower }}.list' path: '/etc/apt/sources.list.d/wireguard_ubuntu_wireguard_{{ ansible_distribution_release|lower }}.list'
state: absent state: absent
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: remove not proper installed docker
become: true
apt:
name: docker-ce,docker,docker-io,docker.io,docker-ee,nvidia-container-runtime
state: absent
autoremove: yes
purge: yes
- name: remove not proper installed docker repo
become: true
file:
path: '/etc/apt/sources.list.d/docker.list'
state: absent
- name: China mirror Docker setup
set_fact:
china_mirror_docker: true
when: china_mirror
- name: China mirror for Docker
set_fact:
mirror_docker: https://mirrors.tuna.tsinghua.edu.cn/docker-ce
when: china_mirror_docker
- name: target distribution for non-sid
set_fact:
docker_distribution: '{{ ansible_distribution_release|lower }}'
when: ansible_distribution_release != 'sid' and ansible_distribution_release != 'bullseye'
- name: target distribution for sid
set_fact:
docker_distribution: bullseye
when: ansible_distribution_release == 'sid' or ansible_distribution_release == 'bullseye'
- name: Docker apt 源公钥
become: true
apt_key:
url: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/gpg'
when: ansible_os_family == 'Debian'
- name: Docker apt 源
become: true
copy:
content: 'deb {{mirror_docker}}/linux/{{ ansible_distribution|lower }} {{ docker_distribution }} stable'
dest: /etc/apt/sources.list.d/docker.list
when: ansible_os_family == 'Debian'
- name: docker yum 源
become: true
yum_repository:
name: docker-ce
description: docker-ce
baseurl: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/{{ansible_distribution_major_version}}/$basearch/stable'
ip_resolve: 'IPv4'
gpgkey: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/gpg'
when: ansible_os_family == "RedHat"
- name: China mirror
set_fact:
china_mirror_docker: true
when: china_mirror
- name: China mirror for Docker
set_fact:
mirror_docker: https://mirrors.tuna.tsinghua.edu.cn/docker-ce
when: china_mirror_docker
- name: clean apt Docker
become: true
apt:
name: docker,docker-engine,docker.io,docker-io,docker-ee
state: absent
autoremove: yes
purge: yes
when: ansible_os_family == 'Debian'
- name: target distribution for non-sid
set_fact:
docker_distribution: '{{ ansible_distribution_release|lower }}'
when: ansible_distribution_release != 'sid' and ansible_distribution_release != 'bullseye'
- name: target distribution for sid
set_fact:
docker_distribution: bullseye
when: ansible_distribution_release == 'sid' or ansible_distribution_release == 'bullseye'
- name: Docker apt 源公钥
become: true
apt_key:
url: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/gpg'
when: ansible_os_family == 'Debian'
- name: Docker apt 源
become: true
copy:
content: 'deb {{mirror_docker}}/linux/{{ ansible_distribution|lower }} {{ docker_distribution }} stable'
dest: /etc/apt/sources.list.d/docker.list
when: ansible_os_family == 'Debian'
- name: 安装 Docker (apt) - name: 安装 Docker (apt)
become: true become: true
apt: apt:
...@@ -55,15 +20,6 @@ ...@@ -55,15 +20,6 @@
state: absent state: absent
autoremove: yes autoremove: yes
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 and ansible_distribution != 'Fedora' when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 and ansible_distribution != 'Fedora'
- name: docker yum 源
become: true
yum_repository:
name: docker-ce
description: docker-ce
baseurl: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/{{ansible_distribution_major_version}}/$basearch/stable'
ip_resolve: 'IPv4'
gpgkey: '{{mirror_docker}}/linux/{{ ansible_distribution|lower }}/gpg'
when: ansible_os_family == "RedHat"
- name: 安装 Docker (yum) - name: 安装 Docker (yum)
become: true become: true
yum: yum:
......
- name: nvidia apt key
become: true
apt_key:
url: 'https://nvidia.github.io/nvidia-container-runtime/gpgkey'
- name: set distribution string
set_fact:
container_runtime_distribution_string: '{{ ansible_distribution | lower }}{{ ansible_distribution_version }}'
when: ansible_distribution_major_version|int < 20
- name: set distribution string for Ubuntu 20
set_fact:
container_runtime_distribution_string: 'ubuntu18.04'
when: ansible_distribution_major_version|int >= 20
- name: container runtime apt repo
become: true
copy:
content: |
deb https://nvidia.github.io/nvidia-container-runtime/stable/{{container_runtime_distribution_string}}/$(ARCH) /
deb https://nvidia.github.io/libnvidia-container/stable/{{container_runtime_distribution_string}}/$(ARCH) /
dest: /etc/apt/sources.list.d/nvidia-container-runtime.list
- name: nvidia apt key
become: true
apt_key:
url: 'https://nvidia.github.io/nvidia-container-runtime/gpgkey'
- name: set distribution string
set_fact:
container_runtime_distribution_string: '{{ ansible_distribution | lower }}{{ ansible_distribution_version }}'
when: ansible_distribution_major_version|int < 20
- name: set distribution string for Ubuntu 20
set_fact:
container_runtime_distribution_string: 'ubuntu18.04'
when: ansible_distribution_major_version|int >= 20
- name: container runtime apt repo
become: true
copy:
content: |
deb https://nvidia.github.io/nvidia-container-runtime/stable/{{container_runtime_distribution_string}}/$(ARCH) /
deb https://nvidia.github.io/libnvidia-container/stable/{{container_runtime_distribution_string}}/$(ARCH) /
dest: /etc/apt/sources.list.d/nvidia-container-runtime.list
- name: install nvidia and related packages - name: install nvidia and related packages
become: true become: true
apt: apt:
......
...@@ -96,10 +96,16 @@ ...@@ -96,10 +96,16 @@
file: file:
name: /etc/apt/sources.list.d/pve-enterprise.list name: /etc/apt/sources.list.d/pve-enterprise.list
state: absent state: absent
- name: docker source
include_tasks: docker-source.yml
when: install_docker
- name: nvidia source
include_tasks: nvidia-source.yml
when: nvidia_driver_version and ansible_os_family == 'Debian'
- name: clean some Debian packages - name: clean some Debian packages
become: true become: true
apt: apt:
name: ufw,iptables-persistent,needrestart name: ufw,iptables-persistent,needrestart,docker,docker-engine,docker.io,docker-io,docker-ee
state: absent state: absent
autoremove: yes autoremove: yes
purge: yes purge: yes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment