The Git Module

The ‘Git Module’ allows us to manage git checkouts to deploy software. For Example:

# Example read-write git checkout
- git:
    repo: ssh://git@github.com/yourid/yourrepo.git
    dest: /home/folder/yourrepo

The Script Module

This module takes the script name that runs locally on the remote system. This is a good feature as other ways to run a script on ansible is time taking. This is also called the shell module. For example:

- script: /some/local/sample_script.sh --some-arguments testvar
  args:
    creates: /the/created/sample.txt

The Mail Module

This module is useful for sending emails using ansible. In complex environments there are processes that cannot be automated, either because lack of authority to make it or because people disagrees to a common approach. For example,

# Sending an e-mail from Gmail using ansible
- mail:
    host: smtp.gmail.com
    port: 587
    username: username@gmail.com
    password: mypassword
    to: mail receiver<mailreceiver@gmail.com>
    subject: Type your subject
    body: 'This is your body.'
  delegate_to: localhost

The Notification Module

Send notification message via Slack.

- hosts: name_of_server
  tasks:
   - name: Send notification message through Slack
     local_action:
         module: slack
         # To retrieve your slack token, open your team settings.
         token: //
         msg: "Hello"
         channel: "#general"
         username: "ansible-notification-bot"

The syslogger Module

This module helps to add log entries to the host computer.

# Full example
- name: Test syslog
  syslogger:
    msg: "Your message"
    priority: "err"
    facility: "daemon"
    log_pid: true

# Basic usage
- name: Simple Usage
  syslogger:
    msg: "File saved as daemon.info"