- name: Install packages package: name: "{{ item }}" state: present loop: - rsync - dma - jq - curl - bash - python - py311-pip - name: Set up periodic.conf template: src: etc_periodic.conf.j2 dest: /etc/periodic.conf owner: root group: wheel mode: "0644" - name: Set up /etc/rc.conf template: src: etc_rc.conf.j2 dest: /etc/rc.conf owner: root group: wheel mode: "0644" register: rc_conf - name: Set up fstab template: src: etc_fstab.j2 dest: /etc/fstab owner: root group: wheel mode: "0644" register: fstab - name: Run mount -a shell: mount -a when: fstab.changed - name: Start auditd service: name: auditd state: started - name: Check if pylogsentinel is installed shell: pip show pylogsentinel register: pylogsentinel_check failed_when: false changed_when: false - name: Install pylogsentinel shell: pip install pylogsentinel==0.3.0 --force --no-input when: pylogsentinel_check.rc != 0 - name: Install pylogsentinel.conf template: src: usr_local_etc_pylogsentinel.conf.j2 dest: /usr/local/etc/pylogsentinel.conf owner: root group: wheel mode: "0644" - name: Install pylogsentinel-batch-email.sh template: src: usr_local_bin_pylogsentinel-batch-email.sh.j2 dest: /usr/local/bin/pylogsentinel-batch-email.sh owner: root group: wheel mode: "0755" - name: Set up crontab template: src: etc_crontab.j2 dest: /etc/crontab owner: root group: wheel mode: "0644" register: etc_crontab - name: Restart cron service: name: cron state: restarted when: etc_crontab.changed - name: Install logto template: src: usr_local_bin_logto.sh.j2 dest: /usr/local/bin/logto owner: root group: wheel mode: "0755" - name: Copy backup SSH private key copy: src: "{{ backup_ssh_privkey_file }}" dest: /root/.ssh/backup owner: root group: wheel mode: "0600" - name: Copy backup SSH public key copy: src: "{{ backup_ssh_pubkey_file }}" dest: /root/.ssh/backup.pub owner: root group: wheel mode: "0644" - name: Copy SSH config template: src: root_ssh_config.j2 dest: /root/.ssh/config owner: root group: wheel mode: "0644" - name: Copy backup script template: src: usr_local_bin_backup.sh.j2 dest: /usr/local/bin/backup owner: root group: wheel mode: "0755"