irc - Send a message to an IRC channel

Synopsis

  • Send a message to an IRC channel. This is a very simplistic implementation.

Requirements (on host that executes module)

  • socket

Options

parameter required default choices comments
channel
yes
Channel name. One of nick_to or channel needs to be set. When both are set, the message will be sent to both of them.
color
no none
  • none
  • white
  • black
  • blue
  • green
  • red
  • brown
  • purple
  • orange
  • yellow
  • light_green
  • teal
  • light_cyan
  • light_blue
  • pink
  • gray
  • light_gray
Text color for the message. ("none" is a valid option in 1.6 or later, in 1.6 and prior, the default color is black, not "none"). Added 11 more colors in version 2.0.
key
(added in 1.7)
no
Channel key
msg
yes
The message body.
nick
no ansible
Nickname to send the message from. May be shortened, depending on server's NICKLEN setting.
nick_to
(added in 2.0)
no
A list of nicknames to send the message to. One of nick_to or channel needs to be set. When both are defined, the message will be sent to both of them.
part
(added in 2.0)
no True
Designates whether user should part from channel after sending message or not. Useful for when using a faux bot and not wanting join/parts between messages.
passwd
no
Server password
port
no 6667
IRC server port number
server
no localhost
IRC server name/address
style
(added in 2.0)
no None
  • bold
  • underline
  • reverse
  • italic
Text style for the message. Note italic does not work on some clients
timeout
(added in 1.5)
no 30
Timeout to use while waiting for successful registration and join messages, this is to prevent an endless loop
topic
(added in 2.0)
no
Set the channel topic
use_ssl
(added in 1.8)
no
Designates whether TLS/SSL should be used when connecting to the IRC server

Examples

- irc:
    server: irc.example.net
    channel: #t1
    msg: Hello world

- local_action:
    module: irc
    port: 6669
    server: irc.example.net
    channel: #t1
    msg: 'All finished at {{ ansible_date_time.iso8601 }}'
    color: red
    nick: ansibleIRC

- local_action:
    module: irc
    port: 6669
    server: irc.example.net
    channel: #t1
    nick_to:
      - nick1
      - nick2
    msg: 'All finished at {{ ansible_date_time.iso8601 }}'
    color: red
    nick: ansibleIRC

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/irc_module.html