)]}'
{"ansible/roles/swap/tasks/main.yml":[{"author":{"_account_id":28048,"name":"Will Szumski","email":"will@stackhpc.com","username":"jovial"},"change_message_id":"26451eefa07c4466ca63eb44f51fc05c0479a5fb","unresolved":true,"context_lines":[{"line_number":95,"context_line":"  when:"},{"line_number":96,"context_line":"    - (active_swaps | select(\u0027search\u0027, item.path.split(\u0027/\u0027)[-1]) | list | length \u003d\u003d 0 or"},{"line_number":97,"context_line":"       active_swaps | select(\u0027search\u0027, item.device | default(\u0027\u0027)) | list | length \u003d\u003d 0)"},{"line_number":98,"context_line":"  loop: \"{{ swap }}\""},{"line_number":99,"context_line":"  changed_when: true"}],"source_content_type":"text/x-yaml","patch_set":2,"id":"76c5db94_7401c3b1","line":98,"updated":"2025-08-14 16:19:04.000000000","message":"This is a bit weird as doesn\u0027t it potentially run swapon -a more than once? A few suggestions:\n\n- We just use changed_when: false and ignore the fact it doesn\u0027t report a proper status\n- We make a custom module that runs swapon --summary before and after and reports a change if they are different\n- use shell: diff \u003c(swapon --summary) \u003c(swapon -a \u0026\u0026 swapon --summary) and report change if stdout !\u003d \"\"","commit_id":"c3a4bae4307f9bb26b4329342bf8a47dd4f452f6"},{"author":{"_account_id":36781,"name":"Massimiliano Favaro-Bedford","display_name":"Max","email":"max@stackhpc.com","username":"MaxBed4d"},"change_message_id":"9a4679532877259599cf2e24f5a47d2510f50aff","unresolved":true,"context_lines":[{"line_number":95,"context_line":"  when:"},{"line_number":96,"context_line":"    - (active_swaps | select(\u0027search\u0027, item.path.split(\u0027/\u0027)[-1]) | list | length \u003d\u003d 0 or"},{"line_number":97,"context_line":"       active_swaps | select(\u0027search\u0027, item.device | default(\u0027\u0027)) | list | length \u003d\u003d 0)"},{"line_number":98,"context_line":"  loop: \"{{ swap }}\""},{"line_number":99,"context_line":"  changed_when: true"}],"source_content_type":"text/x-yaml","patch_set":2,"id":"e1a0b3ce_f4c0b5ca","line":98,"in_reply_to":"76c5db94_7401c3b1","updated":"2025-08-19 09:52:58.000000000","message":"Thank you for the review Will! I agree a more robust condition should be used, and your suggestions are an elegant solution which I will look to implement.\nThanks again","commit_id":"c3a4bae4307f9bb26b4329342bf8a47dd4f452f6"},{"author":{"_account_id":36781,"name":"Massimiliano Favaro-Bedford","display_name":"Max","email":"max@stackhpc.com","username":"MaxBed4d"},"change_message_id":"d05f28092d9d422615474d8145ce85243b197265","unresolved":false,"context_lines":[{"line_number":95,"context_line":"  when:"},{"line_number":96,"context_line":"    - (active_swaps | select(\u0027search\u0027, item.path.split(\u0027/\u0027)[-1]) | list | length \u003d\u003d 0 or"},{"line_number":97,"context_line":"       active_swaps | select(\u0027search\u0027, item.device | default(\u0027\u0027)) | list | length \u003d\u003d 0)"},{"line_number":98,"context_line":"  loop: \"{{ swap }}\""},{"line_number":99,"context_line":"  changed_when: true"}],"source_content_type":"text/x-yaml","patch_set":2,"id":"9e460db5_a4d67870","line":98,"in_reply_to":"e1a0b3ce_f4c0b5ca","updated":"2025-12-30 15:27:48.000000000","message":"I have added an extra conditional which makes running ``swapon`` dependant on whether any new, previously unregistered, swap memories have been defined.\n\nThis also makes it so that the outputs are only reported as ``changed`` when a new swap memory has been added.","commit_id":"c3a4bae4307f9bb26b4329342bf8a47dd4f452f6"},{"author":{"_account_id":35264,"name":"Alex Welsh","email":"alex@stackhpc.com","username":"alex-welsh"},"change_message_id":"5444a8a8fda3f2d4a6e9d4888269ca3d796204cd","unresolved":true,"context_lines":[{"line_number":92,"context_line":"    state: \"present\""},{"line_number":93,"context_line":"  loop: \"{{ swap }}\""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"- name: Enable swap if missing"},{"line_number":96,"context_line":"  ansible.builtin.command: /sbin/swapon -a"},{"line_number":97,"context_line":"  when:"},{"line_number":98,"context_line":"    - (swap_output.stdout | select(\u0027search\u0027, item.path.split(\u0027/\u0027)[-1]) | list | length \u003d\u003d 0 or"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"771ab606_31bcf149","line":95,"updated":"2026-01-02 14:04:05.000000000","message":"If you print the verbose output, it will only print lines to stdout when it\u0027s configured something new (nothing configured prints nothing, existing files are written to stderr instead), so you can just do this:\n\n```\n- name: Ensure Swap devices are enabled\n  ansible.builtin.command: swapon --all --verbose\n  register: swapon_result\n  changed_when: swapon_result.stdout_lines list | length \u003e 0\n```\n\nThat saves looping/repeating ```swapon``` and still gives the correct changed_when output","commit_id":"16e21b0ad81622ab4e575c4c826fb7dc99fa0908"},{"author":{"_account_id":28048,"name":"Will Szumski","email":"will@stackhpc.com","username":"jovial"},"change_message_id":"8e4c073d94d4dd3150017dc47025ad8d47e4e9d8","unresolved":true,"context_lines":[{"line_number":92,"context_line":"    state: \"present\""},{"line_number":93,"context_line":"  loop: \"{{ swap }}\""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"- name: Enable swap if missing"},{"line_number":96,"context_line":"  ansible.builtin.command: /sbin/swapon -a"},{"line_number":97,"context_line":"  when:"},{"line_number":98,"context_line":"    - (swap_output.stdout | select(\u0027search\u0027, item.path.split(\u0027/\u0027)[-1]) | list | length \u003d\u003d 0 or"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"51104dbf_e98ebb87","line":95,"in_reply_to":"771ab606_31bcf149","updated":"2026-01-27 14:50:53.000000000","message":"Nice suggestion","commit_id":"16e21b0ad81622ab4e575c4c826fb7dc99fa0908"}],"releasenotes/notes/check-and-register-new-swap-config-95af7f3fd583cbe2.yaml":[{"author":{"_account_id":35264,"name":"Alex Welsh","email":"alex@stackhpc.com","username":"alex-welsh"},"change_message_id":"5444a8a8fda3f2d4a6e9d4888269ca3d796204cd","unresolved":true,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"fixes:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Adds a check to compare the current set of swap files and devices "},{"line_number":5,"context_line":"    registered on ``swapon`` and compares them to the swap configuration"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"3820030d_aeea8897","line":2,"updated":"2026-01-02 14:04:05.000000000","message":"Release notes are for end-users. They don\u0027t know about the technical implementation e.g. the swapon commands that are being used. They care about the changes to how Kayobe behaves.\n\n\"Fixed a bug in swap configuration to ensure new swap devices are activated when swap files already exist on the system.\nCloses bug #XXX\"","commit_id":"16e21b0ad81622ab4e575c4c826fb7dc99fa0908"}]}
