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

get latest package automatically #58

Open
blka opened this issue Aug 29, 2024 · 1 comment
Open

get latest package automatically #58

blka opened this issue Aug 29, 2024 · 1 comment
Assignees

Comments

@blka
Copy link

blka commented Aug 29, 2024

hi, found your repo by google, so maybe someone will be happy with this update.
no auth tokens to download latest rpm.
enjoy! :)


- name: Install Nessus Agent
  hosts: all
  connection: local
  become: yes

  vars:
    base_url: "https://www.tenable.com/downloads/nessus-agents"
    rpm_filename_pattern: "el8.x86_64.rpm"
    download_url_template: "https://www.tenable.com/downloads/api/v1/public/pages/nessus-agents/downloads/{{ rpm_id }}/download?i_agree_to_tenable_license_agreement=true"

  tasks:
    - name: Get the Nessus Agent download page
      uri:
        url: "{{ base_url }}"
        return_content: yes
      register: download_page

    - name: Extract the file id and version for el8.x86_64.rpm
      set_fact:
        rpm_id: "{{ download_page.content | regex_search('{\"id\":([0-9]+),\"file\":\"NessusAgent-[0-9]+.[0-9]+.[0-9]+-el8.x86_64.rpm\",', '\\1') |first }}"
        rpm_version: "{{ download_page.content | regex_search('{\"id\":[0-9]+,\"file\":\"NessusAgent-([0-9]+.[0-9]+.[0-9]+)-el8.x86_64.rpm\",', '\\1') |first }}"

    - name: Debug the extracted ID and version
      debug:
        msg: "Extracted RPM ID: {{ rpm_id }}, Version: {{ rpm_version }}"

    - name: Construct full RPM download URL
      set_fact:
        rpm_url: "{{ download_url_template }}"

    - name: Download the latest Nessus Agent RPM
      get_url:
        url: "{{ rpm_url }}"
        dest: "/tmp/NessusAgent-{{ rpm_version }}-{{ rpm_filename_pattern }}"
        mode: '0644'


@steinbrueckri
Copy link
Owner

Oh nice, thx. I will see if i find some time to implement it.

@steinbrueckri steinbrueckri self-assigned this Aug 30, 2024
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

2 participants