-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.yml
75 lines (66 loc) · 1.64 KB
/
Dockerfile.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
- name: tasks
hosts: localhost
vars:
- apt_packages:
- python3
- python3-pip
- tzdata
- pip3_packages:
discord:
name: discord.py
version: 1.5.1
psycopg2:
name: psycopg2-binary
version: 2.9.1
SQLAlchemy:
name: SQLAlchemy
version: 1.4.20
tasks:
- name: Upgrade all packages to the latest version
apt:
update_cache: yes
name: "*"
state: latest
- name: Remove useless packages from the cache
apt:
autoclean: yes
- name: Remove dependencies that are no longer required
apt:
autoremove: yes
- name: "Install packages defined in apt_packages"
apt:
name: "{{ item }}"
state: latest
loop: "{{ apt_packages }}"
when: apt_packages|default([])|count > 0
- name: "Install python pip requirements defined in pip3_packages"
pip:
executable: pip3
name: "{{ item.value.name }}"
version: "{{ item.value.version }}"
state: forcereinstall
loop: "{{ query('dict', pip3_packages) }}"
when: pip3_packages|default([])|count > 0
- name: 'collect files'
find:
paths: "/var/lib/apt/lists/"
hidden: true
recurse: true
register: collected_files
- name: 'collect directories'
find:
paths: "/var/lib/apt/lists/"
hidden: true
recurse: true
file_type: directory
register: collected_directories
- name: remove collected files and directories
file:
path: "{{ item.path }}"
state: absent
with_items: >
{{
collected_files.files
+ collected_directories.files
}}