ansible-for-devops icon indicating copy to clipboard operation
ansible-for-devops copied to clipboard

ansible failing to install PHP from lamp server playbook

Open minaf1 opened this issue 6 months ago • 4 comments

I am going through the ansible for devops book and getting stuck on chapter 4. When I run the ansible playbook for the lamp server, it gets stuck at the task "Add ondrej repository for later versions of PHP" with the following error:

FAILED! => {" changed": false, "msg": "Failed to update apt cache: W: Updating from such a repository can't be done securely, and is therefore disabled by default., See apt-secure(8) manpage for repository creation and user configuration details., The repository xia Release' does not have a Release file."}

I have tried adding more time to give the process to end gracefully. I have tried changing the vagrant box. These did not help. and I am not sure where to go from here. I am guessing the source either does not have the release files anymore or some process is hogging all the resources making it impossible to run this command from ansible playbook.

minaf1 avatar Jun 13 '25 01:06 minaf1

Thanks; a few of the examples need to get fixed up for more modern releases—there may be a PR that addresses it, or have you checked the latest version of the example in this repository?

geerlingguy avatar Jun 13 '25 17:06 geerlingguy

I am not sure if there is a PR that addresses this issue. To be honest, I couldn't find the example code for the lamp server in this repository. I would appreciate a link to it, thank you in advance.

However, I did find this in researching the error (I do realize it doesn't map directly to my issue) : https://www.reddit.com/r/ansible/comments/i5ilw6/running_into_could_not_get_lock/

It seems that unattended-upgrades was holding the apt database hostage, perhaps running the one task ad-hoc makes sense.

minaf1 avatar Jun 13 '25 18:06 minaf1

I believe the code is under the 'drupal' example in chapter 4 in this repository here: https://github.com/geerlingguy/ansible-for-devops?tab=readme-ov-file#chapter-4

I think this open PR might be the one I was thinking of: https://github.com/geerlingguy/ansible-for-devops/pull/601

I just haven't had the time to work on integrating the changes (and verifying that's all I need to change—that playbook has evolved a bit through the years!)

geerlingguy avatar Jun 14 '25 05:06 geerlingguy

Hi, was stuck on drupal too.

Created own ubuntu 2410 Image with vagrant and used id_ed25519 for the key. Changes are in https://github.com/androdev4u/ansible-for-devops/tree/master/drupal.

create-vagrant.image Vagrantfile config.ssh.private_key_path = "~/.ssh/id_ed25519" config.ssh.insert_key = false https://github.com/androdev4u/ansible-for-devops/blob/master/drupal/provisioning/playbook.yml

androdev4u avatar Jul 05 '25 23:07 androdev4u