ansible-collection-famedly-.../plugins/modules
Jan Christian Grünhage 45b4aa85b4
fix(matrix_token_login): fix regression in required module args
52785ab768 refactored required and
mutually exclusive module parameters and meanwhile dropped some
arguments required for our matrix_token_login module. The change
made sense for most of our modules, but the matrix_token_login as the
only one doesn't need token or password, but definitely needs a key.
2022-08-10 18:32:05 +02:00
..
matrix_login.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_logout.py fix(modules/matrix): Handle login / logout corrently 2022-08-01 12:01:57 +02:00
matrix_member.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_notification.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_room.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_signing_key.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_state.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
matrix_token_login.py fix(matrix_token_login): fix regression in required module args 2022-08-10 18:32:05 +02:00
matrix_uia_login.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
README.md feat(modules): add synapse_register module 2020-10-09 17:35:06 +02:00
synapse_ratelimit.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00
synapse_register.py feat: Add ansible-test and refactor plugins 2022-07-29 10:50:14 +02:00

Matrix Ansible Modules

These are a few ansible modules for working with matrix rooms.

Requirements

  • nio: The modules require matrix-nio to be required on the target. Some bugs and missing features were found during the development of these modules, which have been fixed in the case of bugs and implemented in the case of missing features. Until they are merged upstream, you have to install the matrix-nio library from source using https://github.com/poljar/matrix-nio/pull/102.
  • Python >= 3.5: The modules make extensive use of async/await, so only Python 3.5 or later are supported. These modules have only been tested with Python 3.8 so far.

Example Playbook

- hosts: localhost
  collections:
    - famedly.matrix
  gather_facts: false
  vars:
    matrix:
      homeserver: "https://example.org"
      user: "some_user"
      password: "s3cr3t"
      alias: "#module-tests:example.org"
      invitees:
        - '@another_user:example.org'
        - '@a_third_user:example.org'
  tasks:
    - synapse_register:
        hs_url: "{{ matrix.homeserver }}"
        user_id: "{{ matrix.user }}"
        password: "{{ matrix.password }}"
        admin: false
        shared_secret: "iqueok1zeengieW3ohcha0riePaigh9p"
    - 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_member:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"
        room_id: "{{ room_result.room_id }}"
        user_ids: "{{ matrix.invitees }}"
        state: "member"
        exclusive: False
      register: membership_changes
    - matrix_notification:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"
        room_id: "{{ room_result.room_id }}"
        msg_plain: "Updated memberships: {{ membership_changes | to_json }}"
        msg_html: "Updated memberships: {{ membership_changes | to_json }}"
      when: membership_changes.changed
    - matrix_logout:
        hs_url: "{{ matrix.homeserver }}"
        token: "{{ login_result.token }}"