Go to file
2020-02-14 02:33:24 +01:00
.gitignore add README, LICENSE and CODEOWNER 2020-02-14 01:49:48 +01:00
CODEOWNERS add README, LICENSE and CODEOWNER 2020-02-14 01:49:48 +01:00
LICENSE.md add README, LICENSE and CODEOWNER 2020-02-14 01:49:48 +01:00
matrix-login.py migrate modules matrix-nio and add tests 2020-02-14 01:52:49 +01:00
matrix-logout.py fix logout 2020-02-14 02:24:05 +01:00
matrix-notification.py migrate modules matrix-nio and add tests 2020-02-14 01:52:49 +01:00
matrix-room.py add module for creating rooms 2020-02-14 01:53:49 +01:00
matrix-state.py add state module 2020-02-14 01:54:29 +01:00
README.md include example playbook in the README 2020-02-14 02:33:24 +01:00
test-login-logout.sh migrate modules matrix-nio and add tests 2020-02-14 01:52:49 +01:00
test-notification.sh migrate modules matrix-nio and add tests 2020-02-14 01:52:49 +01:00
test-room.sh add module for creating rooms 2020-02-14 01:53:49 +01:00
test-settings.sample.sh migrate modules matrix-nio and add tests 2020-02-14 01:52:49 +01:00
test-state.sh add state module 2020-02-14 01:54:29 +01:00

Matrix Ansible Modules

This repo contains a few ansible modules for working with matrix rooms.

Installation

To install these modules so that you can use them, put them into ~/.ansible/plugins/modules/ or for global installation, install them to /usr/share/ansible/plugins/modules/.

Usage

For a usage example including all modules, look at the example playbook below.

- hosts: localhost
  vars:
    matrix:
      homeserver: https://example.org
      user: username
      password: s3cr3t
      alias: '#some-alias:example.org'
      message: "Set room name in"
  tasks:
    - matrix-login:
        hs_url: "{{ matrix.homeserver }}"
        user_id: "{{ matrix.user }}"
        password: "{{ matrix.password }}"
      register: login_result
    - matrix-room:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"
        alias: "{{ matrix.alias }}"
      register: room_result
    - matrix-state:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"
        room_id: "{{ room_result.room_id }}"
        event_type: "m.room.name"
        state_key: ""
        content:
          name: "test room name"
      register: state_result
    - matrix-notification:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"
        room_id: "{{ room_result.room_id }}"
        msg_plain: "{{ matrix.message }} {{ state_result.event_id}}"
        msg_html: "{{ matrix.message }} {{ state_result.event_id}}"
      when: state_result.changed
    - matrix-logout:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

AGPLv3