Draupnir: add manual playbook for room creation #3596

Open
gwmngilfen wants to merge 1 commit from gwmngilfen/ansible:draupnir into main
Member

This is a possible solution for matrix/tickets#13 - it allows an Ansible user to create a room using the Draupnir bot's account, and invite themselves to the new room.

The playbook works as root - I'm not sure how we grant permissions to use it via rbac-playbook though?

# ansible-playbook ./draupnir-playbook-test.yml -e "name='Gwmngilfen Test 2'" -e "alias=gwmgilfen2" -e "invite=@gwmngilfen:fedora.im"
PLAY [Matrix Room Creation Playbook] **********************************************************************************************************

TASK [Ensure mandatory invited user parameter is provided] ************************************************************************************
Thursday 13 August 2026  14:53:49 +0000 (0:00:00.433)       0:00:00.433 *******
Thursday 13 August 2026  14:53:49 +0000 (0:00:00.432)       0:00:00.432 *******
ok: [localhost] => {
    "changed": false,
    "msg": "Inviting user: @gwmngilfen:fedora.im"
}

TASK [Create Matrix room via API] *************************************************************************************************************
Thursday 13 August 2026  14:53:49 +0000 (0:00:00.050)       0:00:00.483 *******
Thursday 13 August 2026  14:53:49 +0000 (0:00:00.050)       0:00:00.482 *******
ok: [localhost]

TASK [Display created room ID] ****************************************************************************************************************
Thursday 13 August 2026  14:53:51 +0000 (0:00:01.709)       0:00:02.193 *******
Thursday 13 August 2026  14:53:51 +0000 (0:00:01.709)       0:00:02.192 *******
ok: [localhost] => {
    "msg": "Room 'Gwmngilfen Test 2' created! ID: !zxztsQydxNlKF4HZqNvt4TOeVBtgeykIqDuSoRyAxpQ"
}

PLAY RECAP ************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

logs written to: /var/log/ansible/draupnir-playbook-test/2026/08/13/14.53.49

Signed-off-by: Greg Sutcliffe fedora@emeraldreverie.org

This is a possible solution for https://forge.fedoraproject.org/matrix/tickets/issues/13 - it allows an Ansible user to create a room using the Draupnir bot's account, and invite themselves to the new room. The playbook works as root - I'm not sure how we grant permissions to use it via rbac-playbook though? ``` # ansible-playbook ./draupnir-playbook-test.yml -e "name='Gwmngilfen Test 2'" -e "alias=gwmgilfen2" -e "invite=@gwmngilfen:fedora.im" PLAY [Matrix Room Creation Playbook] ********************************************************************************************************** TASK [Ensure mandatory invited user parameter is provided] ************************************************************************************ Thursday 13 August 2026 14:53:49 +0000 (0:00:00.433) 0:00:00.433 ******* Thursday 13 August 2026 14:53:49 +0000 (0:00:00.432) 0:00:00.432 ******* ok: [localhost] => { "changed": false, "msg": "Inviting user: @gwmngilfen:fedora.im" } TASK [Create Matrix room via API] ************************************************************************************************************* Thursday 13 August 2026 14:53:49 +0000 (0:00:00.050) 0:00:00.483 ******* Thursday 13 August 2026 14:53:49 +0000 (0:00:00.050) 0:00:00.482 ******* ok: [localhost] TASK [Display created room ID] **************************************************************************************************************** Thursday 13 August 2026 14:53:51 +0000 (0:00:01.709) 0:00:02.193 ******* Thursday 13 August 2026 14:53:51 +0000 (0:00:01.709) 0:00:02.192 ******* ok: [localhost] => { "msg": "Room 'Gwmngilfen Test 2' created! ID: !zxztsQydxNlKF4HZqNvt4TOeVBtgeykIqDuSoRyAxpQ" } PLAY RECAP ************************************************************************************************************************************ localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 logs written to: /var/log/ansible/draupnir-playbook-test/2026/08/13/14.53.49 ``` Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
Draupnir: add manual playbook for room creation
All checks were successful
yamllint / yamllint (pull_request) Successful in 32s
Differential yamllint / yamllint-job (pull_request) Successful in 42s
Linter / ansible-lint (pull_request) Successful in 2m15s
64f6e02e15
Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
Member

if i recall correctly, there should be an rbac.yaml file in ansible-private where you should add it to

if i recall correctly, there should be an rbac.yaml file in ansible-private where you should add it to
smoliicek approved these changes 2026-08-13 16:36:04 +00:00
smoliicek left a comment

and i think it looks good!

and i think it looks good!
Owner

Looks ok to me. We might make room mandatory too? You likely don't want to just make a test room with the default name..

the typical pattern here is:

  • create a sysadmin-whatever group in fas and add folks who need to run the thing to it.
  • add it to rbac config in ansible-private to allow that group to run that playbook.
  • users then ssh into batcave01 and use rbac-playbook to run the playbook there.
  • profit.
Looks ok to me. We might make room mandatory too? You likely don't want to just make a test room with the default name.. the typical pattern here is: * create a sysadmin-whatever group in fas and add folks who need to run the thing to it. * add it to rbac config in ansible-private to allow that group to run that playbook. * users then ssh into batcave01 and use rbac-playbook to run the playbook there. * profit.
Author
Member

OK, I had a look in rbac.yml, seems simple enough. Do we want to re-use the commops-wg-matrix FAS group, or make a new one? I see @kevin suggesting a sysadmin-matrix group but does that add anything over the existing one? The members are the ones in the moderation room anyway...

If we're making room mandatory, I guess all the parameters might as well all be (well, except visibility). The alias will not like being reused anyway.

OK, I had a look in rbac.yml, seems simple enough. Do we want to re-use the `commops-wg-matrix` FAS group, or make a new one? I see @kevin suggesting a `sysadmin-matrix` group but does that add anything over the existing one? The members are the ones in the moderation room anyway... If we're making room mandatory, I guess all the parameters might as well all be (well, except visibility). The alias will not like being reused anyway.
Owner

So, the typical convention is that 'sysadmin-whatever' groups are ones where members can get an interactive shell.

So, I think i would prefer we make a sysadmin-matrix group for this. we could just add interested matrix/commops folks to it, or we could inherit from the commops-wg-matrix group, but having it be sysadmin-matrix would at least indicate it provides shell access.

So, the typical convention is that 'sysadmin-whatever' groups are ones where members can get an interactive shell. So, I think i would prefer we make a sysadmin-matrix group for this. we could just add interested matrix/commops folks to it, or we could inherit from the commops-wg-matrix group, but having it be sysadmin-matrix would at least indicate it provides shell access.
All checks were successful
yamllint / yamllint (pull_request) Successful in 32s
Differential yamllint / yamllint-job (pull_request) Successful in 42s
Linter / ansible-lint (pull_request) Successful in 2m15s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u draupnir:gwmngilfen-draupnir
git switch gwmngilfen-draupnir

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff gwmngilfen-draupnir
git switch gwmngilfen-draupnir
git rebase main
git switch main
git merge --ff-only gwmngilfen-draupnir
git switch gwmngilfen-draupnir
git rebase main
git switch main
git merge --no-ff gwmngilfen-draupnir
git switch main
git merge --squash gwmngilfen-draupnir
git switch main
git merge --ff-only gwmngilfen-draupnir
git switch main
git merge gwmngilfen-draupnir
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3596
No description provided.