-
Notifications
You must be signed in to change notification settings - Fork 1
/
modify-sources.list.yml
52 lines (47 loc) · 1.96 KB
/
modify-sources.list.yml
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
---
- name: Backup Original Sources.list and Replace it with custom Sources.list File that points to local repository.
hosts: all
become: yes
become_method: sudo
tasks:
- name: check if backup already exists
stat:
path: /etc/apt/sources.list_backup
register: sources_backup
- name: check if backup already exists
stat:
path: /etc/apt/sources.list
register: sources_original
- name: Backup Source.list only if it doesn't already exist.
copy:
remote_src: true
mode: preserve
src: /etc/apt/sources.list
dest: /etc/apt/sources.list_backup
when:
- sources_backup.stat.exists == False
- name: Delete the original if Backup and Original Exists
file:
path: /etc/apt/sources.list
state: absent
when:
- sources_original.stat.exists
- sources_backup.stat.exists
- name: Source.list Bionic
copy:
dest: /etc/apt/sources.list
content: |
deb ftp://192.168.4.242/ubuntu_repo bionic main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo bionic-security main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo bionic-updates main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo bionic-backports main restricted universe multiverse
when: ansible_lsb.codename == 'bionic'
- name: Source.list Xenial
copy:
dest: /etc/apt/sources.list
content: |
deb ftp://192.168.4.242/ubuntu_repo xenial main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo xenial-security main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo xenial-updates main restricted universe multiverse
deb ftp://192.168.4.242/ubuntu_repo xenial-backports main restricted universe multiverse
when: ansible_lsb.codename == 'xenial'