# Ansible Role: Notify SSH Login via Ntfy This Ansible role automates the setup for sending notifications whenever a user logs in to your Linux servers via SSH. It intercepts successful SSH connections using PAM and triggers a script to send an HTTP request with details about the login event. ## Features * Integrates with PAM to capture successful SSH login attempts. * Uses a customizable script to send notifications via an HTTP request. * Supports sending notifications to services like ntfy.sh (configurable). * Includes Molecule test suite using Vagrant for automated testing. ## Requirements * Ansible >= 2.9 * Python package `requests` (for Molecule tests) ## Role Variables The role utilizes the following default variables, which can be overridden in your playbook: * `docker_install_compose_plugin` (bool): Whether to install the Docker Compose plugin (defaults to `false`). * `docker_compose_package` (str): Package name for Docker Compose (defaults to `docker-compose`). **Additional variables are defined within the role's defaults/main.yml file.** ## Usage 1. **Clone or copy the role directory.** 2. **Include the role in your playbook:** ```yaml --- - name: Notify SSH logins hosts: all become: true roles: - notify_ssh_login ``` 3. **Customize variables (optional):** Override any default variables in your playbook's `vars` section. 4. **Run the playbook:** ```bash ansible-playbook your_playbook.yml ``` ## Testing The role includes a Molecule test suite that utilizes Vagrant to provision a test environment. To execute the tests: 1. Ensure Vagrant and VirtualBox are installed. 2. Navigate to the role directory. 3. Run the following commands: ```bash molecule init molecule converge molecule verify ``` ### Contributing We welcome contributions to this role! Please see the contributing guidelines in the `CONTRIBUTING.md` file for details. ### License This role is licensed under the MIT License. See the `LICENSE` file for details.