123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- ---
- - name: Install mailx and postfix
- package:
- name: "{{ mail_packages }}"
- state: present
- - name: Start postfix service
- systemd:
- name: postfix
- state: started
- - block:
- - name: Install python3
- package:
- name: python3
- state: present
- - name: Update pip version
- command: pip3 install --upgrade pip
- changed_when: true
- - name: Install ansible
- pip:
- name: ansible
- state: present
- executable: pip3
- when: os_leap in ansible_distribution | lower
- - block:
- - name: Install ansible
- package:
- name: ansible
- state: present
- when: os_leap not in ansible_distribution | lower
- - name: Install community.general collection
- command: ansible-galaxy collection install {{ community_general_collection }}
- changed_when: true
- - name: Copy auth_failure_check.yml to login_node
- copy:
- src: "{{ role_path }}/files/auth_failure_check.yml"
- dest: "{{ alerting_file_path }}"
- - name: Fetch ansible-playbook path
- command: whereis ansible-playbook
- changed_when: false
- register: ansible_playbook_path
- - name: Schedule cron job for alerting
- cron:
- name: Auth failure alerting
- special_time: hourly
- job: "{{ ansible_playbook_path.stdout.split(' ')[1] }} {{ alerting_file_path }} -e 'alert_email_address={{ hostvars['127.0.0.1']['alert_email_address'] }}'"
|