Only do the metasploit activities if it is not already installed.
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
---
|
||||
# Install Metasploit Framework
|
||||
|
||||
# TBD: Check if msfconsole is in PATH and if so skip this reinstallation process.
|
||||
|
||||
- name: General | Software | Metasploit | Facts
|
||||
set_fact:
|
||||
metasploit_installer: msfinstall
|
||||
when: ansible_system in ("Linux", "Darwin")
|
||||
|
||||
- name: General | Software | Metasploit | Check Install Status
|
||||
stat:
|
||||
path: /usr/bin/msfconsole
|
||||
register: metasploit_status
|
||||
|
||||
- name: General | Software | Metasploit | Refresh Apt Files
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
@@ -15,7 +18,8 @@
|
||||
- "mv -fv /usr/share/keyrings/metasploit-framework.gpg /tmp/apt/metasploit-framework.gpg.old"
|
||||
- "mv -fv /etc/apt/sources.list.d/metasploit-framework.list /tmp/apt/metasploit-framework.list.old"
|
||||
- "mv -fv /etc/apt/preferences.d/pin-metasploit.pref /tmp/apt/pin-metasploit.pref.old"
|
||||
when: ansible_system in ("Linux")
|
||||
when: ansible_system in ("Linux") and
|
||||
not metasploit_status.stat.exists
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Metasploit | Install
|
||||
@@ -26,4 +30,5 @@
|
||||
- "mkdir -p {{ global_bin }}"
|
||||
- "mv -fv ./msfinstall {{ global_bin }}/{{ metasploit_installer }}"
|
||||
- yes y | "{{ global_bin }}/{{ metasploit_installer }}"
|
||||
when: ansible_system in ("Linux", "Darwin")
|
||||
when: ansible_system in ("Linux", "Darwin") and
|
||||
not metasploit_status.stat.exists
|
||||
|
||||
Reference in New Issue
Block a user