Firewall idempotency #89

Open
opened 2026-01-20 13:58:48 +01:00 by mfocko · 0 comments
Owner

Roles are not self-sustainable, as the firewall may not always run and therefore the facts are not properly populated:

TASK [forgejo : Firewall settings for Forgejo's SSH] ***************************************************************************************************************************************************************************
task path: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:26
[ERROR]: Task failed: Error while evaluating conditional: object of type 'dict' has no attribute 'services'

Task failed.
Origin: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:26:3

24   notify: Reload nginx
25
26 - name: Firewall settings for Forgejo's SSH
     ^ column 3

<<< caused by >>>

Error while evaluating conditional: object of type 'dict' has no attribute 'services'
Origin: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:27:9

25
26 - name: Firewall settings for Forgejo's SSH
27   when: ansible_facts.services['firewalld.service'].state == "running"
           ^ column 9

fatal: [poincare]: FAILED! => {"changed": false, "msg": "Task failed: Error while evaluating conditional: object of type 'dict' has no attribute 'services'"}
Roles are not self-sustainable, as the firewall may not always run and therefore the facts are not properly populated: ``` TASK [forgejo : Firewall settings for Forgejo's SSH] *************************************************************************************************************************************************************************** task path: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:26 [ERROR]: Task failed: Error while evaluating conditional: object of type 'dict' has no attribute 'services' Task failed. Origin: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:26:3 24 notify: Reload nginx 25 26 - name: Firewall settings for Forgejo's SSH ^ column 3 <<< caused by >>> Error while evaluating conditional: object of type 'dict' has no attribute 'services' Origin: /Users/mfocko/git/mfocko/dotfiles/roles/forgejo/tasks/main.yml:27:9 25 26 - name: Firewall settings for Forgejo's SSH 27 when: ansible_facts.services['firewalld.service'].state == "running" ^ column 9 fatal: [poincare]: FAILED! => {"changed": false, "msg": "Task failed: Error while evaluating conditional: object of type 'dict' has no attribute 'services'"} ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
mfocko/dotfiles#89
No description provided.