Roots Discourse

Error at setup logrotate during server provision

Getting the following error during server provisioning:

TASK [logrotate : nickhammond.logrotate | Setup logrotate.d scripts] ************************************************************************************************************
task path: /Users/josephroberts/localdev/papasteamstores.com/trellis/vendor/roles/logrotate/tasks/main.yml:8
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: root
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/1eb7617cc8 67.205.169.5 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<67.205.169.5> (0, b'/root\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\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 = 49562\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: root
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/1eb7617cc8 67.205.169.5 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1612997587.654769-50736-237756151622196 `" && echo ansible-tmp-1612997587.654769-50736-237756151622196="` echo /root/.ansible/tmp/ansible-tmp-1612997587.654769-50736-237756151622196 `" ) && sleep 0'"'"''
<67.205.169.5> (0, b'ansible-tmp-1612997587.654769-50736-237756151622196=/root/.ansible/tmp/ansible-tmp-1612997587.654769-50736-237756151622196\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\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 = 49562\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: root
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/1eb7617cc8 67.205.169.5 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1612997587.654769-50736-237756151622196/ > /dev/null 2>&1 && sleep 0'"'"''
<67.205.169.5> (0, b'', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\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 = 49562\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
System info:
  Ansible 2.10.5; Darwin
  Trellis version (per changelog): "Use Python 3 for `ansible_local` Vagrant provisioner"
---------------------------------------------------
AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'
failed: [67.205.169.5] (item={'name': 'wordpress-sites', 'path': '/srv/www/**/logs/*.log', 'options': ['weekly', 'maxsize 50M', 'missingok', 'rotate 8', 'compress', 'delaycompress', 'notifempty', 'create 0640 web www-data', 'sharedscripts'], 'scripts': {'prerotate': 'if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\\n      run-parts /etc/logrotate.d/httpd-prerotate; \\\n    fi \\\n', 'postrotate': 'service nginx rotate'}}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "name": "wordpress-sites",
        "options": [
            "weekly",
            "maxsize 50M",
            "missingok",
            "rotate 8",
            "compress",
            "delaycompress",
            "notifempty",
            "create 0640 web www-data",
            "sharedscripts"
        ],
        "path": "/srv/www/**/logs/*.log",
        "scripts": {
            "postrotate": "service nginx rotate",
            "prerotate": "if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\\n      run-parts /etc/logrotate.d/httpd-prerotate; \\\n    fi \\\n"
        }
    }
}

PLAY RECAP **********************************************************************************************************************************************************************
67.205.169.5               : ok=77   changed=1    unreachable=0    failed=1    skipped=30   rescued=0    ignored=0   
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

Using python3, from what I can tell there is no section of trellis’ code that uses iteritems without first including from ansible.module_utils.six import iteritems so not sure what the issue is.

I updated trellis and updated the server from Ubuntu 16.04 to latest.

Here’s my system:

ansible 2.10.5
  config file = /Users/josephroberts/localdev/papasteamstores.com/trellis/ansible.cfg
  configured module search path = ['/Users/josephroberts/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.9.1 (default, Feb  3 2021, 07:04:48) [Clang 11.0.0 (clang-1100.0.33.17)]

Deploys run fine.

Any thoughts anybody? :sob:

Quick update. I tried to provision on a fresh DO Droplet. Same error :confused:

I’m thinking I may have to try downgrading my python version, but even if I specify interpreter_python = /usr/bin/python which is 2.7 in ansible.cfg, it still says my python version is 3.9?

My two cents here: Have you also re-installed from galaxy.yml (ansible-galaxy uses it for ansible roles)?
When you updated the galaxy.yml it may still be necessary to update the roles that would be downloaded from ansible galaxy.

This topic was automatically closed after 42 days. New replies are no longer allowed.