ansible-collections / community.zabbix

Zabbix Ansible modules
http://galaxy.ansible.com/community/zabbix
Other
329 stars 285 forks source link

zabbix-server installation file permision error on ubuntu 20.04 #702

Closed nto4 closed 1 year ago

nto4 commented 2 years ago
SUMMARY

installing zabbix-server playbook end with that error

my command

ansible-playbook /home/sebit/u.yml -vvv --extra-vars 'ansible_sudo_pass=qwe123** ansible_user=root' my playbook

  - hosts: masters
    become: true
    become_user: root
    roles:
      - role: community.zabbix.zabbix_server
        zabbix_server_database: pgsql
        zabbix_server_database_long: postgresql
        zabbix_server_dbport: 5432
        zabbix_server_dbpassword: qwe123

/etc/ansible/hosts

[masters]
zabbix-server ansible_host=172.31.200.62

error


TASK [community.zabbix.zabbix_server : PostgreSQL | Delegated | Create database] ********************************************************************************************************************************************************
task path: /root/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_server/tasks/postgresql.yml:18
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<172.31.200.62> (0, b'/root\n', b'')
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /var/tmp `"&& mkdir "` echo /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867 `" && echo ansible-tmp-1653499418.8498082-70065-209371585659867="` echo /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867 `" ) && sleep 0'"'"''
<172.31.200.62> (0, b'ansible-tmp-1653499418.8498082-70065-209371585659867=/var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867\n', b'')
Using module file /root/.ansible/collections/ansible_collections/community/postgresql/plugins/modules/postgresql_db.py
<172.31.200.62> PUT /root/.ansible/tmp/ansible-local-699017jzx9bbh/tmp9y224ktr TO /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/AnsiballZ_postgresql_db.py
<172.31.200.62> SSH: EXEC sftp -b - -C -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="/root/.ansible/cp/df0297a276"' '[172.31.200.62]'
<172.31.200.62> (0, b'sftp> put /root/.ansible/tmp/ansible-local-699017jzx9bbh/tmp9y224ktr /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/AnsiballZ_postgresql_db.py\n', b'')
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'setfacl -m u:postgres:r-x /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/ /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/AnsiballZ_postgresql_db.py && sleep 0'"'"''
<172.31.200.62> (127, b'', b'/bin/sh: 1: setfacl: not found\n')
<172.31.200.62> Failed to connect to the host via ssh: /bin/sh: 1: setfacl: not found
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'chmod u+x /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/ /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/AnsiballZ_postgresql_db.py && sleep 0'"'"''
<172.31.200.62> (0, b'', b'')
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'chown postgres /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/ /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/AnsiballZ_postgresql_db.py && sleep 0'"'"''
<172.31.200.62> (1, b'', b'chown: invalid user: \xe2\x80\x98postgres\xe2\x80\x99\n')
<172.31.200.62> Failed to connect to the host via ssh: chown: invalid user: ‘postgres’
<172.31.200.62> ESTABLISH SSH CONNECTION FOR USER: root
<172.31.200.62> SSH: EXEC ssh -C -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="/root/.ansible/cp/df0297a276"' 172.31.200.62 '/bin/sh -c '"'"'rm -f -r /var/tmp/ansible-tmp-1653499418.8498082-70065-209371585659867/ > /dev/null 2>&1 && sleep 0'"'"''
<172.31.200.62> (0, b'', b'')
fatal: [zabbix-server]: FAILED! => {
    "msg": "Failed to change ownership of the temporary files Ansible needs to create despite connecting as a privileged user. Unprivileged become user would be unable to read the file."
}
ISSUE TYPE
COMPONENT NAME

community.zabbix.zabbix_server

ANSIBLE VERSION
ansible [core 2.12.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version

target host ubuntu 20_04 lts clean install zabbix vesion is default using collectin 1.16.0

STEPS TO REPRODUCE

my command

ansible-playbook /home/sebit/u.yml -vvv --extra-vars 'ansible_sudo_pass=qwe123** ansible_user=root' my playbook

  - hosts: masters
    become: true
    become_user: root
    roles:
      - role: community.zabbix.zabbix_server
        zabbix_server_database: pgsql
        zabbix_server_database_long: postgresql
        zabbix_server_dbport: 5432
        zabbix_server_dbpassword: qwe123
EXPECTED RESULTS

i cant understand that field

ACTUAL RESULTS

playbook stop and cant be finish that step

Bigsmooth68 commented 1 year ago

I have a similar issue which is apparently due to postgreSQL linux user not being created.

I am trying to find out which task is supposed to create that user.

pyrodie18 commented 1 year ago

@Bigsmooth68 , this issue is over a year old and looks like it has no real history. If you're having an issue, I'd encourage you to great a new issue and provide all of the pertinent details.