Azure Free Tier Debian 11 and Ansible Installing a Lamp server Azure Free Tier Debian 11 and Ansible Installing a Lamp server

November 9, 2022

ansible debian devops laravel

Today I got an email from Microsoft azure that a 30 day trial was ending and that I now had a 12 month fee basic tier level service, which is nice.

I have set up a debian box to play with, just like I have a free debian EC2 instance on AWS :)

Following the steps in the browser, i created a VM and logged in

ssh -i ~/.ssh/key.pem azureuser@1.2.3.4

note it is azureuser but the rest is the same process as setting up on AWS or locally.

I started with a copy of my Ansible-aws repo and duplicated it for the azure server.

So now I have uploaded this as Ansible-Azure-Debian-Lamp and ran it like so:

ansible-playbook main.yml --key-file /home/andy/.ssh/PRIVATEKEY.pem  -e 'ansible_python_interpreter=/usr/bin/python3'

There was only 2 errors and having made the following changes to deal with errors, it worked.

Errors

FAILED! => {"changed": false, "msg": "No package matching 'python-pymysql' is available"}

solution: remove python-pymysql as it is already installing python3-pymysql

FAILED! => {"changed": false, "msg": "Failed to find required executable gpg in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}

solution: add gnupg to the packages to install

and it all worked!

setting up laravel

I uploaded a laravel app to /var/www/laravel and the ansible scripts setup the apache to work, setting up the laravel app with the usual composer install and chmod the /storage directory. The only issue was with user permissions as the /var/www/ directory is owned by root which i solved with.

sudo chown -R $USER:$USER

and now i have a working laravel app setup with ansible in less than an hour :)


If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon