summaryrefslogtreecommitdiff
path: root/roles/install-custom-packages/tasks/main.yml
blob: de7ef2648838987e3f4a717697d7e8f1367834de (plain)
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
53
54
55
56
57
- name: Set VyOS branch name crux
  set_fact:
    vyos_branch: "crux"
  when: vyos_version is regex("^1\.2.*$")
- name: Set VyOS branch name equuleus
  set_fact:
    vyos_branch: "equuleus"
  when: vyos_version is regex("^1\.3.*$")
- name: Put debian.list
  become: true
  template:
    src: "templates/debian.list.j2"
    dest: "{{ vyos_install_root }}/etc/apt/sources.list.d/debian.list"
- name: backup resolv.conf
  become: true
  command: mv {{ vyos_install_root }}/etc/resolv.conf /tmp/resolv.conf
- name: add nameserver settings to chroot
  become: true
  copy:
    src: "files/resolv.conf"
    dest: "{{ vyos_install_root }}/etc/resolv.conf"
- name: apt-get update
  become: true
  command: chroot {{ vyos_install_root }} apt-get update
- name: Copy packages to a temporary directory
  become: true
  copy:
    src: "files/custom_debs/"
    dest: "{{ vyos_install_root }}/tmp/custom_debs/"
- name: Install custom packages from a list
  become: true
  command: chroot {{ vyos_install_root }} apt-get -t {{ vyos_branch | default('current') }} install -y --no-install-recommends {{ lookup('file', 'files/custom_packages_list.txt') }}
- name: Install custom packages from deb files
  command:
  become: true
  command: chroot {{ vyos_install_root }} dpkg -i --force-depends /tmp/custom_debs/{{ item | basename }}
  with_fileglob: "{{ vyos_install_root }}/tmp/custom_debs/*.deb"
- name: Install missed dependencies
  become: true
  command: chroot {{ vyos_install_root }} apt-get -f -y install
- name: Delete DEB packages
  become: true
  command: chroot {{ vyos_install_root }} rm -rf /tmp/custom_debs/
- name: apt-get clean
  become: true
  command: chroot {{ vyos_install_root }} apt-get clean
- name: delete apt lists from cache
  become: true
  command: chroot {{ vyos_install_root }} rm -rf /var/lib/apt/lists/
- name: Delete debian.list
  become: true
  file:
    path: "{{ vyos_install_root }}/etc/apt/sources.list.d/debian.list"
    state: absent
- name: restore original resolv.conf
  become: true
  command: mv /tmp/resolv.conf {{ vyos_install_root }}/etc/resolv.conf