nextcloud / ansible-collection-nextcloud-admin

The ansible galaxy for your nextcloud administrative needs.
https://galaxy.ansible.com/nextcloud/admin
BSD 2-Clause "Simplified" License
138 stars 77 forks source link

[NC] - Run occ installation command: Missing sudo password #319

Closed ivoruetsche closed 11 months ago

ivoruetsche commented 11 months ago

Hi

We try to use the ansible-collection-nextcloud-admin on Ubuntu 22.04.3. but we got these error:

TASK [nextcloud.admin.install_nextcloud : [NC] - Run occ installation command] ************************************************************************************************************************************
fatal: [198.19.220.125]: FAILED! => {"msg": "Missing sudo password"}

I saw, that on line 38 is 'become_user: "{{ nextcloud_websrv_user }}"', well, nextcloud_websrv_user=www-root, but this user shouldn't be in the sudo list...???

Thank a lot for your work Ivo

ivoruetsche commented 11 months ago

Maybe some additional information. Ansible runs as "ansible" user, password login via ssh is denied, only ssh key is allowed. So the playbook looks like:

- hosts: nextcloud
  become: true
  remote_user: ansible
  become_method: sudo
  vars:
    ansible_ssh_private_key_file: ~/ansible/sshkey/ansible.key
ivoruetsche commented 11 months ago

Solved: I changed the ansible sudoers user from ansible ALL=NOPASSWD: ALL to ansible ALL=(ALL) NOPASSWD:ALL

wiktor2200 commented 11 months ago

Hello @ivoruetsche, it all depends on you local configuration. You don't configure Ubuntu itself with this role. In clean VM usually just setting:

- hosts: all
  become: true
  vars_files:
    - your_var_file.yml

would be sufficient.