Skip to content

Commit

Permalink
manage and install flags
Browse files Browse the repository at this point in the history
  • Loading branch information
wwaltersp committed Mar 21, 2018
1 parent 900eeb2 commit c3dc6a8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ nessus_agent_package: 'NessusAgent'

nessus_agent_host: cloud.tenable.com
nessus_agent_port: 443

nessus_manage: True
nessus_install: True
1 change: 1 addition & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

- name: restart nessusagent
service: name=nessusagent state=restarted
when: nessus_manage
63 changes: 33 additions & 30 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
---
- block:
- name: Install Nessus Agent from repo
package:
name: "{{nessus_agent_package}}"
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
when: "'.deb' not in nessus_agent_package"

- name: Install Nessus Agent from repo
package:
name: "{{nessus_agent_package}}"
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
when: "'.deb' not in nessus_agent_package"
- name: Install Nessus Agent from .deb package
apt: deb={{nessus_agent_package}}
when: "'.deb' in nessus_agent_package"
when: nessus_install

- name: Install Nessus Agent from .deb package
apt: deb={{nessus_agent_package}}
when: "'.deb' in nessus_agent_package"
- block:
- name: Check agent link status
command: /opt/nessus_agent/sbin/nessuscli agent status
become: yes
ignore_errors: yes
register: nessus_link

- name: Check agent link status
command: /opt/nessus_agent/sbin/nessuscli agent status
become: yes
ignore_errors: yes
register: nessus_link
- name: Configure Nessus Agent
command: >
/opt/nessus_agent/sbin/nessuscli agent link
--key={{nessus_agent_key}}
--host={{nessus_agent_host}}
--port={{nessus_agent_port}}
--groups="{{nessus_agent_group}}"
become: yes
when: nessus_link|failed
notify: restart nessusagent

- name: Configure Nessus Agent
command: >
/opt/nessus_agent/sbin/nessuscli agent link
--key={{nessus_agent_key}}
--host={{nessus_agent_host}}
--port={{nessus_agent_port}}
--groups="{{nessus_agent_group}}"
become: yes
when: nessus_link|failed
notify: restart nessusagent

- name: Ensure nessusagent is started
service:
name: nessusagent
state: started
enabled: yes
- name: Ensure nessusagent is started
service:
name: nessusagent
state: started
enabled: yes
when: nessus_manage

0 comments on commit c3dc6a8

Please sign in to comment.