--- - 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: "filename_v22_4_2_4.rpm" - deb_filename: "filename_v22_4_2_4.deb" - new_host_fqdn: "{{ ansible_fqdn }}" #### s1-speficic: - site_token: "***CONTENTS REDACTED***" tasks: - name: "msg print to stdout: Debug ansible_facts" debug: msg: # - "{{ ansible_facts.service_mgr }}" - 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 deb 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_script.sh" shell: include/activation_script.sh