blob: a91dd1a1a991e6270187af502593f3102645e929 [file] [log] [blame]
David K. Bainbridgeca68f062016-10-27 11:04:33 -07001---
2- name: Ensure Local Repository Settings
3 become: yes
4 template:
5 backup: yes
6 dest: /etc/apt/sources.list
7 src: files/sources.list.j2
8 group: root
9 owner: root
10 mode: 0644
11 when: ubuntu_apt_repo is defined
12
13- name: Capture Existing Respositories
14 command: find /etc/apt/sources.list.d \! -type d -name '*.list'
15 changed_when: false
16 register: existing_repo_lists
17 when: ubuntu_apt_repo is defined
18
19- name: Capture Timestamp
20 set_fact:
21 timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d@%H:%M:%S') }}"
22 changed_when: false
23 when: ubuntu_apt_repo is defined
24
Scott Bakerb2b7fd92016-11-01 16:01:38 -070025#- name: Backup Existing Respositories
26# become: yes
27# copy:
28# remote_src: True
29# src: "{{ item }}"
30# dest: "{{ item }}.{{ timestamp }}~"
31# with_items: "{{ existing_repo_lists.stdout_lines }}"
32# when: ubuntu_apt_repo is defined
David K. Bainbridgeca68f062016-10-27 11:04:33 -070033
Scott Bakerb2b7fd92016-11-01 16:01:38 -070034#- name: Remove Existing Repositories
35# become: yes
36# file:
37# state: absent
38# path: "{{ item }}"
39# with_items: "{{ existing_repo_lists.stdout_lines }}"
40# when: ubuntu_apt_repo is defined
David K. Bainbridgeca68f062016-10-27 11:04:33 -070041
Scott Bakerb2b7fd92016-11-01 16:01:38 -070042#- name: Ensure Update Repository List
43# become: yes
44# apt:
45# update_cache: yes
46# when: ubuntu_apt_repo is defined