Files
phpipam_scan_agent/playbooks/agent.yaml

85 lines
2.2 KiB
YAML

- name: Fetch API Data
hosts: localhost
become: false
gather_facts: false
tasks:
- name: Check for Existance of config file
ansible.builtin.stat:
path: /etc/phpipam/scan_agent.yaml
register: config_file_check
- name: Load Config File
ansible.builtin.include_vars:
file: /etc/phpipam/scan_agent.yaml
when: >
config_file_check.stat.exists
- name: Confirm 'api_url' is Set
ansible.builtin.assert:
that:
- nofusscomputing_phpipam_scan_agent.api_url is defined
- nofusscomputing_phpipam_scan_agent.api_url != ''
msg: "missing Required Variables"
- name: Confirm 'client_token' is Set
ansible.builtin.assert:
that:
- nofusscomputing_phpipam_scan_agent.client_token is defined
- nofusscomputing_phpipam_scan_agent.client_token != ''
msg: "missing Required Variables"
- name: Confirm 'client_name' is Set
ansible.builtin.assert:
that:
- nofusscomputing_phpipam_scan_agent.client_name is defined
- nofusscomputing_phpipam_scan_agent.client_name != ''
msg: "missing Required Variables"
- name: Confirm 'scanagent_code' is Set
ansible.builtin.assert:
that:
- nofusscomputing_phpipam_scan_agent.scanagent_code is defined
- nofusscomputing_phpipam_scan_agent.scanagent_code != ''
msg: "missing Required Variables"
- name: Create API Cache Directory
ansible.builtin.file:
path: "{{ nfc_c_path_cache }}"
state: directory
- name: Agent ID
ansible.builtin.include_tasks:
file: tasks/agent_id.yaml
- name: Subnets
ansible.builtin.include_tasks:
file: tasks/subnets.yaml
- name: Scan Subnet
ansible.builtin.include_tasks:
file: tasks/scan_subnet.yaml
loop: "{{ nfc_c_scan_agent_subnets | default([]) }}"
loop_control:
loop_var: subnet
vars:
nfc_c_cache_expire_time: 1800
nfc_c_http_port: 5000
nfc_c_http_server: http://127.0.0.1
nfc_c_path_cache: "{{ playbook_dir }}/../cache"
api_address: addresses
api_subnets: subnets
api_scanagents: tools/scanagents