Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush handler conflict while using multiple roles #6

Closed
flotho opened this issue Dec 22, 2022 · 3 comments · May be fixed by robertdebock/ansible-role-locale#9
Closed

Flush handler conflict while using multiple roles #6

flotho opened this issue Dec 22, 2022 · 3 comments · May be fixed by robertdebock/ansible-role-locale#9

Comments

@flotho
Copy link
Contributor

flotho commented Dec 22, 2022

Hi,

I'm running mutiple of your roles in a playbook :

.../..
  roles:
    - role: robertdebock.roles.locale
      vars:
        locale_timezone: "{{ ntp_timezone }}"
    - role: robertdebock.roles.openssh
    - role: robertdebock.roles.git
    - role: robertdebock.roles.logrotate
    - role: robertdebock.roles.investigate

My host is a rocky linux 9 uptodate.
The first time I run this sequence, the flush handler in openssh is triggering an event causing an issue on the locale :

TASK [robertdebock.roles.openssh : Flush handlers] *********************************************************************************************
task path: /home/florent.thomas/DEV/Projets_Infra/all-ansible-tools/ansible_collections/robertdebock/roles/roles/openssh/tasks/main.yml:55
[WARNING]: flush_handlers task does not support when conditional

RUNNING HANDLER [robertdebock.roles.locale : Localectl set-locale] *****************************************************************************
task path: /home/florent.thomas/DEV/Projets_Infra/all-ansible-tools/ansible_collections/robertdebock/roles/roles/locale/handlers/main.yml:4
fatal: [sso.mind-and-go.net]: FAILED! => {"changed": true, "cmd": ["localectl", "set-locale", "LANG=fr_FR.utf8"], "delta": "0:00:00.037381", "end": "2022-12-22 21:54:25.241665", "msg": "non-zero return code", "rc": 1, "start": "2022-12-22 21:54:25.204284", "stderr": "Failed to issue method call: Locale fr_FR.utf8 not installed, refusing.", "stderr_lines": ["Failed to issue method call: Locale fr_FR.utf8 not installed, refusing."], "stdout": "", "stdout_lines": []}

RUNNING HANDLER [robertdebock.roles.openssh : Restart openssh] *********************************************************************************
task path: /home/florent.thomas/DEV/Projets_Infra/all-ansible-tools/ansible_collections/robertdebock/roles/roles/openssh/handlers/main.yml:4
META: ran handlers

Even if we have an issue there, y=the locale has correctly been set.

Moreover, running a second time the same sequence succeeded.

AFAICS, this part of the code https://github.com/robertdebock/ansible-collection-roles/blob/master/roles/openssh/tasks/main.yml#L56 is triggering this other part : https://github.com/robertdebock/ansible-collection-roles/blob/master/roles/locale/handlers/main.yml#L4

I don't know what to do

@flotho
Copy link
Contributor Author

flotho commented Dec 22, 2022

hum...
obviously, not everything is correctly set :

[root@localhost ~]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=fr_FR.utf8
LC_CTYPE="fr_FR.utf8"
LC_NUMERIC="fr_FR.utf8"
LC_TIME="fr_FR.utf8"
LC_COLLATE="fr_FR.utf8"
LC_MONETARY="fr_FR.utf8"
LC_MESSAGES="fr_FR.utf8"
LC_PAPER="fr_FR.utf8"
LC_NAME="fr_FR.utf8"
LC_ADDRESS="fr_FR.utf8"
LC_TELEPHONE="fr_FR.utf8"
LC_MEASUREMENT="fr_FR.utf8"
LC_IDENTIFICATION="fr_FR.utf8"
LC_ALL=

@flotho
Copy link
Contributor Author

flotho commented Dec 22, 2022

looks like something recent https://bugzilla.redhat.com/show_bug.cgi?id=2000878

@robertdebock
Copy link
Owner

About the flushing of handlers;

If there is any ansible.builtin.meta: flush_handlers, it will flush all collected handlers. This means you can indeed see handlers of role x while the role that's running is y.

I'm not sure if that answers your question, let me know if you need something else.

flotho added a commit to flotho/ansible-role-locale that referenced this issue Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants