Alternate TLDs for development - sudo: a password is required

You can also set the ansible_become_pass (or [...]_password) in the ansible inventory:
Edit: Better link:

Adding to hosts/development? I have tried many variations of the following, all of which do not register the password:

[development]
192.168.50.5 ansible_connection=local

[development:vars]
ansible_connection=local ansible_sudo_pass=mikekilmer

[web]
192.168.50.5 ansible_connection=local

This one yields “no hosts matched”, skipping server setup altogether:

[development:mikekilmer]
ansible_connection=local ansible_sudo_pass=mikekilmer

Is there supposed to be a web user? I see www-data but not web.

I think what it comes down to is that Ansible is trying to connect as the user who runs the playbook in the host machine (mikekilmer), while that user hasn’t been created on the guest machine.

Is there supposed to be a user on the guest which matches the host? Or, is Ansible not supposed to be trying to connect as the host user who runs the playbook (mikekilmer)?

Just had an idea: You are using a fresh clone from Trellis, right? Have you also ensured that no .ansible folder from previous attempts is used? These hidden folders could still be there.

Great idea, man. There isn’t a directory (or file) named .ansible. There is a .vagrant file containing this:

Aug 30 20:29 bundler/
Aug 31 07:58 hostmanager/
Aug 30 20:29 machines/
Aug 31 07:58 provisioners/
Aug 30 20:29 rgloader/

I think that the .trellis file just has the venv in it.

The ansible.cfg makes reference to ~/.ansible which looks like this:

├── collections
│   └── ansible_collections
├── cp
├── galaxy_cache
│   └── api.json
├── galaxy_token
├── roles
│   ├── composer
│   ├── geerlingguy.daemonize
│   ├── logrotate
│   ├── mailhog
│   ├── ntp
│   └── swapfile
└── tmp
    └── ansible-local-32592z7tt26t4

I’m blowing out the .vagrant directory and building from scratch again. Will report back.

Tried blowing out trellis/.vagrant as well as ~/.ansible. Same result. After running vagrant up --provision, there is no admin user, no web user, no user matching the host machine user who runs the playbook.

And same result trying to run ansible-playbook server.yml -e env=development:

<192.168.50.5> ESTABLISH LOCAL CONNECTION FOR USER: mikekilmer
<192.168.50.5> EXEC sudo -H -S -n  -u root /bin/sh -c 'echo BECOME-SUCCESS-qlcblryqaqnlhnqrkaarqfdwxswlthyb ; lsb_release -rs'
System info:
  Ansible 2.10.13; Darwin
  Trellis version (per changelog): "Fix #1277 - Disable PHP CLI memory limit"
---------------------------------------------------
non-zero return code
sudo: a password is required
fatal: [192.168.50.5]: FAILED! => {
    "changed": false,
    "rc": 1,
    "stderr_lines": [
        "sudo: a password is required"
    ],
    "stdout": "",
    "stdout_lines": []
}

May be worth mentioning as well, that xDebug doesn’t seem to be enabled, which is what got me trying to run the provisioning tasks in the first place:

php -r "printf('xDebug does%s exists.' . PHP_EOL, > extension_loaded('xdebug') ? '' : 'n\'t');"
xDebug doesn't exists.

Here in this debug output it says

Note: Ansible will attempt connections as user = admin ok: [192.168.50.5]

But there is no admin user. Do you know if there is supposed to be an admin or a web user on the dev machine? I see that vagrant, in www-data group, owns the web files:

-rwxr--r-- 1 vagrant www-data 120 Sep  1 17:49 /srv/www/ellipticastudios.com/current/web/index.php

Additionally, I’m not sure if the IP address I have set in vagrant.default.yml is the one that should be referenced in the logs, but as you can see, it’s 192.168.50.5. Previously, I’ve been using the default IP. This time, I tried updating it to 192.168.50.9.

## /etc/hosts
## vagrant-hostmanager-start id: 326d3641-8c87-4f6f-a6cd-6eca0685c1c3
192.168.50.9	example.test
192.168.50.9	www.example.test
## vagrant-hostmanager-end

If I understand correctly, the following settings in hosts/development makes it so that within the Vagrant box, 192.168.50.5 is used, while locally, in the host, it’s 192.168.50.9:

[development]
192.168.50.5 ansible_connection=local

[web]
192.168.50.5 ansible_connection=local

In the browser, example.test is served, but I want to be able to re-provision using Ansible/Trellis, not to mention, I believe xDebug is supposed to be active “out of the box.”

This was a red herring, just telling me that xDebug isn’t enabled for the command line php. If I put phpinfo() into a file at /srv/www/example.com/current/web/info.php it confirms xDebug is active.

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