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

"locale_gen" module fails on CentOS 6, CentOS 7 and RHEL 8 (Rocky) #4305

Closed
1 task done
filviu opened this issue Mar 1, 2022 · 10 comments · Fixed by #6774
Closed
1 task done

"locale_gen" module fails on CentOS 6, CentOS 7 and RHEL 8 (Rocky) #4305

filviu opened this issue Mar 1, 2022 · 10 comments · Fixed by #6774
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) system

Comments

@filviu
Copy link

filviu commented Mar 1, 2022

Summary

When using module "locale_gen" for machines with CentOS 6 or CentOS 7 or Rocky Linux 8 get fail message "/etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package locales installed ?"
But there is no such package for CentOS. I think this module can be worked for supporting RHEL, or there must be listing in module description with supported and not-supported OS.

Mostly migrating this original report that got closed without fix: ansible/ansible#44708

Issue Type

Bug Report

Component Name

locale_gen

Ansible Version

ansible [core 2.11.6] 
  config file = None
  configured module search path = ['/home/silviu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/silviu/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/silviu/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/silviu/.local/bin/ansible
  python version = 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)]
  jinja version = 3.0.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

Configuration

$ ansible-config dump --only-changed

OS / Environment

Rocky Linux 8 (RHEL 8)

Steps to Reproduce

locales:
  - en_GB.UTF-8
  - en_US.UTF-8

- name: Generate localisation files
  hosts: host.domain
  tasks:
    locale_gen:
      name: "{{ item }}"
      state: present
    loop: "{{ locales }}"

Expected Results

Successful task execution.
Module "locale_gen" must check ansible_os_family and ansible_distribution release and run accordingle right locale generations commands (localedef), supporting not only Debian-based OS, but RHEL-based also.

Actual Results

<host.domain> ESTABLISH SSH CONNECTION FOR USER: None
<host.domain> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc host.domain '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<host.domain> (0, '/home/user\n', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<host.domain> ESTABLISH SSH CONNECTION FOR USER: None
<host.domain> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc host.domain '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910 `" && echo ansible-tmp-1535354913.52-175980622514910="` echo /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910 `" ) && sleep 0'"'"''
<host.domain> (0, 'ansible-tmp-1535354913.52-175980622514910=/home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910\n', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Brokenpipe\r\ndebug2: Received exit status from master 0\r\n')
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/locale_gen.py
<host.domain> PUT /home/user/.ansible/tmp/ansible-local-2958jky98t/tmpAmb995 TO /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/locale_gen.py
<host.domain> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc '[host.domain]'
<host.domain> (0, 'sftp> put /home/user/.ansible/tmp/ansible-local-2958jky98t/tmpAmb995 /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/locale_gen.py\n', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug3: Sent message fd 5 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /home/user size 0\r\ndebug3: Looking up /home/user/.ansible/tmp/ansible-local-2958jky98t/tmpAmb995\r\ndebug3: Sent message fd 5 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/locale_gen.py\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 32768 bytes at 0\r\ndebug3: Sent message SSH2_FXP_WRITE I:5 O:32768 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:65536 S:2459\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 5 32768 bytes at 32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 2459 bytes at 65536\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit statusfrom master 0\r\n')
<host.domain> ESTABLISH SSH CONNECTION FOR USER: None
<host.domain> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc host.domain '/bin/sh -c '"'"'chmod u+x /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/ /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/locale_gen.py && sleep 0'"'"''
<host.domain> (0, '', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<host.domain> ESTABLISH SSH CONNECTION FOR USER: None
<host.domain> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc -tt host.domain '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=piwtilauojopifgeaxgceplobgdzgioq] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-piwtilauojopifgeaxgceplobgdzgioq; /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/locale_gen.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<host.domain> (1, '\r\n\r\n{"msg": "/etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package \\"locales\\" installed?", "failed": true, "invocation": {"module_args": {"state": "present", "name": "en_US.UTF-8"}}}\r\n', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to host.domain closed.\r\n')
<host.domain> ESTABLISH SSH CONNECTION FOR USER: None
<host.domain> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5a62727ccc host.domain '/bin/sh -c '"'"'rm -f -r /home/user/.ansible/tmp/ansible-tmp-1535354913.52-175980622514910/ > /dev/null 2>&1 && sleep 0'"'"''
<host.domain> (0, '', 'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /home/user/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2991\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
failed: [host.domain] (item=en_US.UTF-8) => {
    "changed": false,
    "invocation": {
        "module_args": {
            "name": "en_US.UTF-8",
            "state": "present"
        }
    },
    "item": "en_US.UTF-8",
    "msg": "/etc/locale.gen and /var/lib/locales/supported.d/local are missing. Is the package \"locales\" installed?"
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) system labels Mar 1, 2022
@felixfontein
Copy link
Collaborator

This comment from the linked issue seems to explain the situation pretty well: ansible/ansible#44708 (comment)

@filviu
Copy link
Author

filviu commented Mar 1, 2022

I agree but I still think that there is room for improvement.

  • updating documentation could be an option - I have loads of debian/rhel (the curse of mixed infra :) ) playbooks and this is the only module that is not compatible with both (besides the apt / yum ones of course). If agreed I could try my hand opening a PR for this
  • or the error message needs updating - it could check and if on a rhel distro it should let the user know it's unsupported instead of recommending an nonexistent package.

@felixfontein
Copy link
Collaborator

Updating the documentation tends to be a lot easier than adding a distribution check (also there are lots of other distributions, some might have this and some might not).

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ziegenberg
Copy link
Contributor

I want to update the documentation. Any ideas about what exactly to write? I would have gone with an additional note:

This module is not supported on RHEL-based systems.

@felixfontein
Copy link
Collaborator

I would rather formulate this as This module does not support RHEL-based systems. But then, I'm not a native English speaker, so... :) @samccann @oraNod, which formulation (@ziegenberg's or mine) do you think is better?

@ziegenberg
Copy link
Contributor

Hi @felixfontein, I take from your comment, that the general direction of my proposed change is right. :)

@ziegenberg
Copy link
Contributor

And I like your version more than mine, because you use active voice and mine has passive voice. I'll prepare a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants