Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If agent fails to link to Manager on first run then will not reattempt the link to Manager #15

Open
davidcallen opened this issue Dec 15, 2020 · 0 comments

Comments

@davidcallen
Copy link

Firstly - thanks for the ansible role.

I did notice a minor issue. This was partly/mostly caused by my misconfiguration of not passing the correct key in variable nessus_agent_key on first run of the role (stupid I am). The state is then that the agent is installed but not linked

the status is now :

sudo /opt/nessus_agent/sbin/nessuscli agent status
Running: Yes
Linked to: None
Link status: Not linked to a manager
Proxy: None
Plugin set: (null)
Scanning: No (0 jobs pending)
Last scanned: Never
Last connect: Never
Last connection attempt: Never

and return code is zero :

echo $?
0

Then the task "- name: Configure Nessus Agent" will not run because the above return code (registered in nessus_link) is zero. However I still need it to try and link to the Manager.

My workaround was a change to the "when" condition as below :

  - 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 or 'Not linked to a manager' in nessus_link.stdout"
    notify: restart nessusagent

This change probably wouldn't be needed on a good first-run of the role, but ideally the role can be re-runnable and more robust with above minor change.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant