community.general.irc (8.5.0) — module

Send a message to an IRC channel or a nick

Authors: Jan-Piet Mens (@jpmens), Matt Martz (@sivel)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Send a message to an IRC channel from nick ansible
  community.general.irc:
    server: irc.example.net
    use_tls: true
    validate_certs: true
    channel: #t1
    msg: Hello world
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Send a message to an IRC channel
  local_action:
    module: irc
    port: 6669
    server: irc.example.net
    use_tls: true
    validate_certs: true
    channel: #t1
    msg: 'All finished at {{ ansible_date_time.iso8601 }}'
    color: red
    nick: ansibleIRC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Send a message to an IRC channel
  local_action:
    module: irc
    port: 6669
    server: irc.example.net
    use_tls: true
    validate_certs: true
    channel: #t1
    nick_to:
      - nick1
      - nick2
    msg: 'All finished at {{ ansible_date_time.iso8601 }}'
    color: red
    nick: ansibleIRC

Inputs

    
key:
    description:
    - Channel key
    type: str

msg:
    description:
    - The message body.
    required: true
    type: str

nick:
    default: ansible
    description:
    - Nickname to send the message from. May be shortened, depending on server's NICKLEN
      setting.
    type: str

part:
    default: true
    description:
    - 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.
    type: bool

port:
    default: 6667
    description:
    - IRC server port number
    type: int

color:
    aliases:
    - colour
    choices:
    - none
    - white
    - black
    - blue
    - green
    - red
    - brown
    - purple
    - orange
    - yellow
    - light_green
    - teal
    - light_cyan
    - light_blue
    - pink
    - gray
    - light_gray
    default: none
    description:
    - Text color for the message.
    type: str

style:
    choices:
    - bold
    - underline
    - reverse
    - italic
    - none
    default: none
    description:
    - Text style for the message. Note italic does not work on some clients
    type: str

topic:
    description:
    - Set the channel topic
    type: str

passwd:
    description:
    - Server password
    type: str

server:
    default: localhost
    description:
    - IRC server name/address
    type: str

channel:
    description:
    - 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.
    type: str

nick_to:
    description:
    - 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.
    elements: str
    type: list

timeout:
    default: 30
    description:
    - Timeout to use while waiting for successful registration and join messages, this
      is to prevent an endless loop
    type: int

use_tls:
    aliases:
    - use_ssl
    default: false
    description:
    - Designates whether TLS/SSL should be used when connecting to the IRC server
    - O(use_tls) is available since community.general 8.1.0, before the option was exlusively
      called O(use_ssl). The latter is now an alias of O(use_tls).
    - B(Note:) for security reasons, you should always set O(use_tls=true) and O(validate_certs=true)
      whenever possible.
    type: bool

validate_certs:
    default: false
    description:
    - If set to V(false), the SSL certificates will not be validated.
    - This should always be set to V(true). Using V(false) is unsafe and should only be
      done if the network between between Ansible and the IRC server is known to be safe.
    - B(Note:) for security reasons, you should always set O(use_tls=true) and O(validate_certs=true)
      whenever possible.
    type: bool
    version_added: 8.1.0
    version_added_collection: community.general