-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathkali-packages.yml
126 lines (112 loc) · 3.28 KB
/
kali-packages.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
# Playbook for Kali
# Update Kali and deploy packages
- hosts: all
become: true
tasks:
- name: Configure apt to use Cloudflare mirror
ansible.builtin.replace:
path: /etc/apt/sources.list
regexp: '^(deb\s+)http://([A-Za-z0-9.-]+)(/kali.*)$'
replace: '\1http://kali.download\3'
- name: Install apt packages to support HTTPS repos
ansible.builtin.apt:
name:
- apt-transport-https
- apt-utils
- ca-certificates
state: present
update_cache: true
- name: Configure apt to use HTTPS for Kali repo
ansible.builtin.replace:
path: /etc/apt/sources.list
regexp: '^(deb\s+)http://(.*)$'
replace: '\1https://\2'
- name: Upgrade all packages
ansible.builtin.apt:
upgrade: safe
update_cache: true
- name: Install Kali meta packages
ansible.builtin.apt:
name: "{{ kali_meta_packages }}"
state: present
register: apt_meta_packages
until: apt_meta_packages is success
retries: 1
delay: 10
tags:
# exclude from testing due to size
- molecule-notest
- name: Install Kali tool packages
ansible.builtin.apt:
name: "{{ kali_tool_packages }}"
state: present
register: apt_tool_packages
until: apt_tool_packages is success
retries: 1
delay: 30
- name: Remove unnecessary packages
ansible.builtin.apt:
autoremove: true
# Python packages
- name: Ensure packages for Python pip are installed
ansible.builtin.apt:
name:
- python3-dev
- python3-pip
- python3-setuptools
state: present
register: apt_pip_packages
until: apt_pip_packages is success
retries: 1
delay: 10
- name: Install Python Pip Packages
ansible.builtin.pip:
name: "{{ item }}"
state: latest
executable: pip3
extra_args: "--break-system-packages"
loop: "{{ python_pip_packages }}"
changed_when: false
# Pipx packages
- name: Create Pipx home directory
ansible.builtin.file:
path: /usr/local/share/pipx
state: directory
owner: root
group: root
mode: "0755"
- name: Install Pipx packages
community.general.pipx:
name: "{{ item }}"
environment:
PIPX_HOME: /usr/local/share/pipx
PIPX_BIN_DIR: /usr/local/bin
loop: "{{ pipx_packages }}"
# Ruby packages
- name: Ensure packages for Ruby gems are installed
ansible.builtin.apt:
name:
- ruby-dev
- ruby-rubygems
state: present
register: apt_rubygems_packages
until: apt_rubygems_packages is success
retries: 1
delay: 10
- name: Install Ruby Gem Packages
community.general.gem:
name: "{{ item }}"
state: latest
user_install: false
norc: true
loop: "{{ ruby_gem_packages }}"
# Go packages
- name: Install Go packages
ansible.builtin.command:
cmd: "/usr/bin/go install -x {{ item }}"
environment:
GOBIN: /usr/local/bin
register: go_install_cmd
changed_when: go_install_cmd.stderr | regex_search('/pkg/tool/linux_.*/buildid')
loop: "{{ go_packages }}"