| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- ---
- - name: "Install an rpm or deb file using yum/dnf/apt"
- hosts: all
- gather_facts: True
- become: true
- vars:
- - install_file_path: "include/"
- - rpm_filename: "SentinelAgent_linux_v22_4_2_4.rpm"
- - deb_filename: "SentinelAgent_linux_v22_4_2_4.deb"
- - script_file: "include/activation_script.sh"
- - new_host_fqdn: "{{ ansible_fqdn }}"
- - site_token: "***CONTENTS REDACTED***"
- tasks:
- - name: "msg print to stdout: Debug ansible_facts"
- debug:
- msg:
- - ansible_facts.distribution "{{ ansible_facts.distribution }}"
- - ansible_facts.distribution_major_version "{{ ansible_facts.distribution_major_version }}"
- - ansible_facts.distribution_file_variety "{{ ansible_facts.distribution_file_variety }}"
- - name: Populate systemd service_facts
- service_facts:
- - debug:
- msg:
- - ansible_facts.services['firewalld.service'] "{{ ansible_facts.services['firewalld.service'] }}"
- when: "'firewalld.service' in services"
- - debug:
- msg:
- - ansible_facts.services['iptables.service'] "{{ ansible_facts.services['iptables.service'] }}"
- when: "'iptables.service' in services"
- - debug:
- msg:
- - ansible_facts.services['iptables.service'] "{{ ansible_facts.services['iptables.service'] }}"
- when: "'ufw.service' in services"
- ############################################### Copy source rpm or deb file to be installed #################################################################################
- - name: Copy rpm file to host when distribution_file_variety is RedHat
- copy:
- src: "{{ install_file_path }}{{ rpm_filename }}"
- dest: "/home/Ansible/{{ rpm_filename }}"
- when: ansible_facts['distribution_file_variety'] == 'RedHat'
- - name: Copy deb file to host when distribution_file_variety is Debian
- copy:
- src: "{{ install_file_path }}{{ deb_filename }}"
- dest: "/home/Ansible/{{ deb_filename }}"
- when: ansible_facts['distribution_file_variety'] == 'Debian'
- ############################################### RH section #################################################################################################
- - name: "Perform installation w/ yum and rpm file when distribution_file_variety is RedHat"
- yum:
- name: /home/Ansible/{{ rpm_filename }}
- state: present
- disable_gpg_check: true
- when:
- - ansible_facts['distribution_file_variety'] == 'RedHat'
- ############################################### Deb section #################################################################################################
- - name: "Install deb file on host when distribution_file_variety is Debian"
- apt:
- deb: /home/Ansible/{{ deb_filename }}
- state: present
- when:
- - ansible_facts['distribution_file_variety'] == 'Debian'
- ############################################### Run activation_script.sh #################################################################################################
- - name: "Running activation commands"
- command:
- cmd: /opt/sentinelone/bin/sentinelctl management token set ***CONTENTS REDACTED***
- cmd: /opt/sentinelone/bin/sentinelctl control start
|