geerlingguy/ansible-role-ntp

Problems on Ubuntu 20.04

lgadalla-impinj opened this issue · 5 comments

I am trying to use this role from within the Packer ansible provisioner, and running into problems:

2020-10-04T15:25:29-07:00:     vsphere-iso: TASK [geerlingguy.ntp : Populate service facts.] *******************************
2020-10-04T15:25:29-07:00:     vsphere-iso: task path: /var/lib/go-agent/pipelines/ubuntu-20.04-amd64-base/ansible/roles/geerlingguy.ntp/tasks/main.yml:52
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: sysman
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 '-o IdentitiesOnly=yes' -o ControlPath=/var/go/.ansible/cp/cc7b86b188 127.0.0.1 '/bin/sh -c '"'"'echo ~sysman && sleep 0'"'"''
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> (0, '/home/sysman\n', 'OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\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')
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: sysman
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 '-o IdentitiesOnly=yes' -o ControlPath=/var/go/.ansible/cp/cc7b86b188 127.0.0.1 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766 `" && echo ansible-tmp-1601850329.46-104735892147766="` echo /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766 `" ) && sleep 0'"'"''
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> (0, 'ansible-tmp-1601850329.46-104735892147766=/home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766\n', 'OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\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')
2020-10-04T15:25:29-07:00:     vsphere-iso: Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/system/service_facts.py
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> PUT /var/go/.ansible/tmp/ansible-local-12183aLkODI/tmp9mUgtN TO /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC scp -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 -o ControlPath=/var/go/.ansible/cp/cc7b86b188 /var/go/.ansible/tmp/ansible-local-12183aLkODI/tmp9mUgtN '[127.0.0.1]:/home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py'
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> (0, '', 'Executing: program /usr/bin/ssh host 127.0.0.1, user (unspecified), command scp -v -t /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py\nOpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\r\nSending file modes: C0600 103569 tmp9mUgtN\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')
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: sysman
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 '-o IdentitiesOnly=yes' -o ControlPath=/var/go/.ansible/cp/cc7b86b188 127.0.0.1 '/bin/sh -c '"'"'chmod u+x /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/ /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py && sleep 0'"'"''
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> (0, '', 'OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\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')
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: sysman
2020-10-04T15:25:29-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 '-o IdentitiesOnly=yes' -o ControlPath=/var/go/.ansible/cp/cc7b86b188 -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n  -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-sdlduqpbswkaazmcvavgovalwbnivdki ; /usr/bin/python3 /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
2020-10-04T15:25:31-07:00:     vsphere-iso: <127.0.0.1> (1, 'BECOME-SUCCESS-sdlduqpbswkaazmcvavgovalwbnivdki\n\n{"msg": "Malformed output discovered from systemd list-unit-files: accounts-daemon.service                enabled         enabled      ", "failed": true, "exception": "  File \\"/tmp/ansible_service_facts_payload_b5j0md21/__main__.py\\", line 216, in gather_services\\n    service_name, status_val = line.split()\\n", "invocation": {"module_args": {}}}\n', "OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\n/home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py:18: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n  import imp\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to 127.0.0.1 closed.\r\n")
2020-10-04T15:25:31-07:00:     vsphere-iso: <127.0.0.1> Failed to connect to the host via ssh: OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016
2020-10-04T15:25:31-07:00:     vsphere-iso: debug1: Reading configuration data /var/go/.ssh/config
2020-10-04T15:25:31-07:00:     vsphere-iso: debug1: Reading configuration data /etc/ssh/ssh_config
2020-10-04T15:25:31-07:00:     vsphere-iso: debug1: /etc/ssh/ssh_config line 19: Applying options for *
2020-10-04T15:25:31-07:00:     vsphere-iso: debug1: auto-mux: Trying existing master
2020-10-04T15:25:31-07:00:     vsphere-iso: debug2: fd 3 setting O_NONBLOCK
2020-10-04T15:25:31-07:00:     vsphere-iso: debug2: mux_client_hello_exchange: master version 4
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_request_session: entering
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_request_alive: entering
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_request_alive: done pid = 12194
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_request_session: session request sent
2020-10-04T15:25:31-07:00:     vsphere-iso: debug1: mux_client_request_session: master session id: 2
2020-10-04T15:25:31-07:00:     vsphere-iso: /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/AnsiballZ_service_facts.py:18: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
2020-10-04T15:25:31-07:00:     vsphere-iso:   import imp
2020-10-04T15:25:31-07:00:     vsphere-iso: debug3: mux_client_read_packet: read header failed: Broken pipe
2020-10-04T15:25:31-07:00:     vsphere-iso: debug2: Received exit status from master 1
2020-10-04T15:25:31-07:00:     vsphere-iso: Shared connection to 127.0.0.1 closed.
2020-10-04T15:25:31-07:00:     vsphere-iso: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: sysman
2020-10-04T15:25:31-07:00:     vsphere-iso: <127.0.0.1> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=40124 -o 'IdentityFile="/tmp/ansible-key963601233"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="sysman"' -o ConnectTimeout=10 '-o IdentitiesOnly=yes' -o ControlPath=/var/go/.ansible/cp/cc7b86b188 127.0.0.1 '/bin/sh -c '"'"'rm -f -r /home/sysman/.ansible/tmp/ansible-tmp-1601850329.46-104735892147766/ > /dev/null 2>&1 && sleep 0'"'"''
2020-10-04T15:25:31-07:00:     vsphere-iso: <127.0.0.1> (0, '', 'OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016\r\ndebug1: Reading configuration data /var/go/.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 = 12194\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')
2020-10-04T15:25:31-07:00:     vsphere-iso: The full traceback is:
2020-10-04T15:25:31-07:00:     vsphere-iso:   File "/tmp/ansible_service_facts_payload_b5j0md21/__main__.py", line 216, in gather_services
2020-10-04T15:25:31-07:00:     vsphere-iso:     service_name, status_val = line.split()
2020-10-04T15:25:31-07:00:     vsphere-iso: fatal: [default]: FAILED! => {
2020-10-04T15:25:31-07:00:     vsphere-iso:     "changed": false,
2020-10-04T15:25:31-07:00:     vsphere-iso:     "invocation": {
2020-10-04T15:25:31-07:00:     vsphere-iso:         "module_args": {}
2020-10-04T15:25:31-07:00:     vsphere-iso:     },
2020-10-04T15:25:31-07:00:     vsphere-iso:     "msg": "Malformed output discovered from systemd list-unit-files: accounts-daemon.service                enabled         enabled      "
2020-10-04T15:25:31-07:00:     vsphere-iso: }
2020-10-04T15:25:31-07:00:     vsphere-iso:
2020-10-04T15:25:31-07:00:     vsphere-iso: RUNNING HANDLER [geerlingguy.ntp : restart cron] *******************************
2020-10-04T15:25:31-07:00:     vsphere-iso: task path: /var/lib/go-agent/pipelines/ubuntu-20.04-amd64-base/ansible/roles/geerlingguy.ntp/handlers/main.yml:8
2020-10-04T15:25:31-07:00:     vsphere-iso:
2020-10-04T15:25:31-07:00:     vsphere-iso: PLAY RECAP *********************************************************************
2020-10-04T15:25:31-07:00:     vsphere-iso: default                    : ok=13   changed=2    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0
2020-10-04T15:25:31-07:00:     vsphere-iso:

The requirements.yml file looks like this:

---
- name: geerlingguy.pip
- name: open-vm-tools
  src: ssh://git@mygit.server.com:7999/ai/open-vm-tools.git
  version: last_known_good
  scm: git
- name: geerlingguy.ntp

The playbook.yml file looks like this:

---
- hosts: all
  become: true
  roles:
    - role: geerlingguy.pip
      vars:
        - pip_package: python3-pip
        - pip_executable: pip3
    - role: open-vm-tools
    - role: geerlingguy.ntp

If I remove the role from my Packer job, deploy the template and create a VM from it, and then run this role against a VM cloned from that template it seems to work.

I also have the same issue.

me too. I tried setting ntp_servers which should've resulted in adding server directive, but it added pool directive

Issue has been found and fixed on ansible (refer to PR #68211)
Just use Ansible v2.9.8 onwards or v2.10.
Due to the issue on apt install ansible for Ubuntu 20.04, the easiest way to get it now is to install through pip3.

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.