Thank you very much for respond my problem. I'm still getting stuck at this.
this is my hosts file:

[openwisp2]
192.168.56.2

and this is my playbook.yml file:
- hosts: openwisp2
  become: true
  become_user: root
  roles:
    - openwisp.openwisp2
  # the following line is needed only when an IP address is used as the 
inventory hostname
  vars:
      postfix_myhostname: localhost
      openwisp2_shared_secret: 1234

I've set passwd of ricky on ssh with command: passwd ricky
then I tried to run your advice command:
*ansible-playbook -i hosts playbook.yml -b -k -K -u ricky*

I got problem at this:
ricky@ricky:~/openwisp2-ansible-playbook$ ansible-playbook -i hosts 
playbook.yml -b -k -K -u ricky
SSH password:
SUDO password[defaults to SSH password]:

PLAY [openwisp2] 
************************************************************************************************************

TASK [Gathering Facts] 
******************************************************************************************************
fatal: [192.168.56.2]: FAILED! => {"changed": false, "module_stderr": 
"Shared connection to 192.168.56.2 closed.\r\n", "module_stdout": 
"\r\nricky is not in the sudoers file.  This incident will be 
reported.\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact 
error", "rc": 1}
        to retry, use: --limit 
@/home/ricky/openwisp2-ansible-playbook/playbook.retry

PLAY RECAP 
******************************************************************************************************************
192.168.56.2               : ok=0    changed=0    unreachable=0    failed=1

When I run my command, it's still got the problem:

TASK [openwisp.openwisp2 : migrate] 
*****************************************************************************************
task path: /home/ricky/.ansible/roles/openwisp.openwisp2/tasks/django.yml:81
<192.168.56.2> ESTABLISH SSH CONNECTION FOR USER: ricky
<192.168.56.2> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=ricky -o ConnectTimeout=10 -o 
ControlPath=/home/ricky/.ansible/cp/7dc7da3e64 192.168.56.2 '/bin/sh -c 
'"'"'echo ~ricky && sleep 0'"'"''
<192.168.56.2> (0, '/home/ricky\n', '')
<192.168.56.2> ESTABLISH SSH CONNECTION FOR USER: ricky
<192.168.56.2> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=ricky -o ConnectTimeout=10 -o 
ControlPath=/home/ricky/.ansible/cp/7dc7da3e64 192.168.56.2 '/bin/sh -c 
'"'"'( umask 77 && mkdir -p "` echo 
/var/tmp/ansible-tmp-1549363281.78-56635532953025 `" && echo 
ansible-tmp-1549363281.78-56635532953025="` echo 
/var/tmp/ansible-tmp-1549363281.78-56635532953025 `" ) && sleep 0'"'"''
<192.168.56.2> (0, 
'ansible-tmp-1549363281.78-56635532953025=/var/tmp/ansible-tmp-1549363281.78-56635532953025\n',
 
'')
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/web_infrastructure/django_manage.py
<192.168.56.2> PUT 
/home/ricky/.ansible/tmp/ansible-local-86713AC0t7/tmpUDFtBp TO 
/var/tmp/ansible-tmp-1549363281.78-56635532953025/AnsiballZ_django_manage.py
<192.168.56.2> SSH: EXEC sshpass -d9 sftp -o BatchMode=no -b - -C -o 
ControlMaster=auto -o ControlPersist=60s -o User=ricky -o ConnectTimeout=10 
-o ControlPath=/home/ricky/.ansible/cp/7dc7da3e64 '[192.168.56.2]'
<192.168.56.2> (0, 'sftp> put 
/home/ricky/.ansible/tmp/ansible-local-86713AC0t7/tmpUDFtBp 
/var/tmp/ansible-tmp-1549363281.78-56635532953025/AnsiballZ_django_manage.py\n',
 
'')
<192.168.56.2> ESTABLISH SSH CONNECTION FOR USER: ricky
<192.168.56.2> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=ricky -o ConnectTimeout=10 -o 
ControlPath=/home/ricky/.ansible/cp/7dc7da3e64 192.168.56.2 '/bin/sh -c 
'"'"'setfacl -m u:www-data:r-x 
/var/tmp/ansible-tmp-1549363281.78-56635532953025/ 
/var/tmp/ansible-tmp-1549363281.78-56635532953025/AnsiballZ_django_manage.py 
&& sleep 0'"'"''
<192.168.56.2> (0, '', '')
<192.168.56.2> ESTABLISH SSH CONNECTION FOR USER: ricky
<192.168.56.2> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o 
ControlPersist=60s -o User=ricky -o ConnectTimeout=10 -o 
ControlPath=/home/ricky/.ansible/cp/7dc7da3e64 -tt 192.168.56.2 '/bin/sh -c 
'"'"'su  www-data -c '"'"'"'"'"'"'"'"'/bin/sh -c 
'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo 
BECOME-SUCCESS-takseziixcrklqpuubluiaoudtdlwksx; /usr/bin/python 
/var/tmp/ansible-tmp-1549363281.78-56635532953025/AnsiballZ_django_manage.py'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"'
 
&& sleep 0'"'"''
Escalation failed
fatal: [192.168.56.2]: FAILED! => {
    "msg": "Incorrect su password"
}
        to retry, use: --limit 
@/home/ricky/openwisp2-ansible-playbook/playbook.retry

PLAY RECAP 
******************************************************************************************************************
192.168.56.2               : ok=45   changed=0    unreachable=0    failed=1

I'm also enable ssh password authentication with edit /etc/ssh/sshd_config 
- > PasswordAuthentication yes
and enable logging in as root with this: PermitRootLogin yes

I'm sorry to bother you guys, but I'm really apreciated for the help for 
anyone. 

Pada Senin, 04 Februari 2019 23.52.10 UTC+7, Federico Capoano menulis:
>
> Try to set the become related config in the playbook.yml, eg:
>
> - hosts: <your-host-here>
>   become: true
>   become_user: root
>   roles:
>     - openwisp.openwisp2
>   vars:
>     # your vars here...
>
> Log in via SSH into your VM and set the password of the user ricky with 
> the passwd command.
>
> Then use:
>
> *ansible-playbook -i hosts playbook.yml -b -k -K -u ricky*
>
> Try this and let us know.
>
> There are also other ways, eg:
>
> - specify the password in the inventory file (the file we name as "hosts")
> - set up public SSH key authentication and no password will be asked
>
> I hope this helps.
>
> Federico
>
> On Mon, Feb 4, 2019 at 7:16 AM M Ricky Anggoro P <[email protected] 
> <javascript:>> wrote:
>
>> I'm still got this error:
>> TASK [openwisp.openwisp2 : set secret_key fact] 
>> ********************************
>> ok: [192.168.56.2]
>>
>> TASK [openwisp.openwisp2 : settings.py] 
>> ****************************************
>> ok: [192.168.56.2]
>>
>> TASK [openwisp.openwisp2 : migrate] 
>> ********************************************
>> fatal: [192.168.56.2]: FAILED! => {"msg": "Incorrect su password"}
>>         to retry, use: --limit 
>> @/home/ricky/openwisp2-ansible-playbook/playbook.retry
>>
>> PLAY RECAP 
>> *********************************************************************
>> 192.168.56.2               : ok=45   changed=0    unreachable=0    
>> failed=1
>>
>>
>> This is command that I run:
>>
>> ricky@ricky:~/openwisp2-ansible-playbook$ *ansible-playbook -i hosts 
>> playbook.yml -b  -K --become-method=su -u ricky*
>> What should I do?
>>
>> Pada Minggu, 03 Februari 2019 17.21.49 UTC+7, M Ricky Anggoro P menulis:
>>>
>>> Hi. I want to test this in VBox before install it to Raspberry Pi3. I 
>>> have followed this instruction: 
>>> https://github.com/openwisp/ansible-openwisp2#install-openwisp2-for-testing-in-a-virtualbox-vm
>>>  
>>> Everything just normal and then I got this message:
>>> TASK [openwisp.openwisp2 : settings.py] 
>>> ****************************************
>>> ok: [192.168.56.2]
>>>
>>> TASK [openwisp.openwisp2 : migrate] 
>>> ********************************************
>>> fatal: [192.168.56.2]: FAILED! => {"msg": "Incorrect su password"}
>>>         to retry, use: --limit 
>>> @/home/ricky/openwisp2-ansible-playbook/playbook.retry
>>>
>>> PLAY RECAP 
>>> *********************************************************************
>>> 192.168.56.2               : ok=45   changed=0    unreachable=0    
>>> failed=1
>>>
>>> I Dont know about it, since my user password and root password is same, 
>>> so I input SSH password same as root password. I run this command:
>>> ansible-playbook -i hosts playbook.yml -b -k -K --become-method=su -u 
>>> ricky
>>>
>>> So please help me because I have to try this controller before I got my 
>>> Raspberry Pi as my Controller. Thank you 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "OpenWISP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to