diff --git a/README.md b/README.md index de541b1..300dd98 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,13 @@ -## DotKernel: Install development environment +## Install development environment +This collection of scripts provides multiple ways of creating and maintaining your development environment. -### Prerequisites: +### Prerequisites If you're not already using it, we recommend you to install [Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab). It's a modern tool that incorporates the power of multiple already known command-line applications like `Windows PowerShell`, `Linux shell`, and more... -### What is this? -This repository provides multiple ways of creating and maintaining your development environment. - - ### How it works? -You will find automation scripts and instructions for the following tools: -* [Ansible](ansible/README.md) +Choose a tool from the below list, and we will guide you through the steps that will install and configure it for you. +* [WSL](wsl/README.md) * [Docker](docker/README.md) diff --git a/ansible/README.md b/ansible/README.md deleted file mode 100644 index 472a56a..0000000 --- a/ansible/README.md +++ /dev/null @@ -1,109 +0,0 @@ -# Install Ansible development environment - -[< DotKernel: Install development environment](../README.md) - - -## Prerequisites -If you plan to develop on Windows, make sure to install [WSL2](/ansible/wsl/README.md) before proceeding to the next step. - - -## Terminology -* `username` - your non-root username created at the distro installation. -* `distro` - the Linux distribution you are working on. - - -**Note**: -Make sure that Apache/MySQL are not running on your Windows machine (via XAMPP or any other tool) or in a different `distro`, or else the installation will fail (because service port is already in use). - - -## Setup -Using Windows Terminal, [start your distro](wsl/README.md#start-distro). - -Make sure you are logged in with your `username` you've created during the installation of the `distro` by [checking your identity](wsl/README.md#check-identity). - -If you are logged in as _root_, [switch to your user](wsl/README.md#switch-from-root-to-your-username). - -Now you are ready to start the setup process. - -Update/Upgrade Linux packages using the below command: - - sudo apt-get update && sudo apt-get upgrade -y - -This command will prompt you for your password - you will not see what you're typing, that's a security measure in Linux regarding passwords. - -If you're not already there, [Move to your home directory](HELP.md#move-to-your-home-directory). - -Now, install the latest version of Ansible by running the following command: - - sudo apt-get install ansible -y - -Clone dotkernel/development into your home directory using the below command: - - git clone https://github.com/dotkernel/development - -Move inside `development/ansible` by executing: - - cd development/ansible/ - -Here, using your preferred text editor, open `config.yml` and fill in **the empty fields**. Save and close the file. - - -## Install -Install and configure all necessary packages by running the below Ansible command: - - ansible-playbook -i hosts install.yml --ask-become-pass - -Once again, you will be prompted to enter your password. - -The installation process will iterate over each task in the playbook and will output a short summary with the results. - -Next, you need to [restart your distro](wsl/README.md#restart-distro) and start MySQL and Apache services. - -Now check if everything works by opening in your browser: -* [http://localhost/](http://localhost/) - Apache's default home page -* [http://localhost/info.php](http://localhost/info.php) - PHP info page -* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/) - PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mysql` -> `root_password`) - -This installation is complete, your development environment is ready to use. - - -## Create virtual hosts -Create virtual hosts for your projects using the below command: - - ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass - -Once again, you will be prompted to enter your password. - -This will iterate over the list of `virtualhosts` configured in `config.yml` and will output a short summary with the results. - -At this step, your virtual host is not yet accessible because first, you need to route these requests to your localhost. - -**Run as administrator** any text editor and open file `C:\Windows\System32\drivers\etc\hosts` (if you don't see it, select `All files` from the file type selector). - -For each item you placed in `virtualhosts`, add the below lines to the end of the file (make sure you replace `{virtualhost}` with your virtual host), then save and close the file. - - 127.0.0.1 {virtualhost} - ::1 {virtualhost} -Example: - - 127.0.0.1 example.local - ::1 example.local - 127.0.0.1 example2.local - ::1 example2.local - -Your virtual host should be accessible and ready to use. - -**Note**: -* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/` - - -## Help - -## Find your projects directory -If you can't find your projects directory, see [this guide](HELP.md#move-to-your-home-directory). - -### Project encounters write permission issues -You can fix the most common issues by consulting [this guide](HELP.md#fix-common-permission-issues). - -### Switching between PHP versions -In order to switch from one version of PHP to another one, follow [this guide](HELP.md#switch-from-php74-to-php-81). diff --git a/ansible/os/ubuntu20/roles/user/templates/wsl.conf.j2 b/ansible/os/ubuntu20/roles/user/templates/wsl.conf.j2 deleted file mode 100644 index 63f66e0..0000000 --- a/ansible/os/ubuntu20/roles/user/templates/wsl.conf.j2 +++ /dev/null @@ -1,2 +0,0 @@ -[user] -default={{ config.system.username }} \ No newline at end of file diff --git a/ansible/wsl/README.md b/ansible/wsl/README.md deleted file mode 100644 index 66dd168..0000000 --- a/ansible/wsl/README.md +++ /dev/null @@ -1,336 +0,0 @@ -# WSL2 - -[< Install Ansible development environment](../README.md) - - -## Prerequisites -Before proceeding to the installation, we need to make sure your machine is ready for running WSL2. - -Open the `Run` prompt by pressing `Win`+`r` and type in the dialog `OptionalFeatures`, then press `Enter`. - -This will open a window where you can turn Windows features on/off. - -Make sure the next features are activated (checked): -* `Hyper-V` (including its sub-features) -* `Virtual Machine Platform` -* `Windows Subsystem for Linux` - -> If any of the above features is missing, then first you need to install them manually using [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps. - -Click `Ok` and restart your computer. - -Make sure you use WSL2 by default by executing the below command in Windows Terminal: - - wsl --set-default-version 2 - - -## Install -Get a list of available distros by executing `wsl -l -o` or `wsl --list --online`: - - The following is a list of valid distributions that can be installed. - Install using 'wsl --install -d '. - - NAME FRIENDLY NAME - Ubuntu Ubuntu - Debian Debian GNU/Linux - kali-linux Kali Linux Rolling - openSUSE-42 openSUSE Leap 42 - SLES-12 SUSE Linux Enterprise Server v12 - Ubuntu-16.04 Ubuntu 16.04 LTS - Ubuntu-18.04 Ubuntu 18.04 LTS - Ubuntu-20.04 Ubuntu 20.04 LTS - -Pick any distro and install it using the below command: - - wsl --install -d {distro} - -after you replace `{distro}` with the name of the selected distro - for example: - - wsl --install -d Ubuntu - -Once completed, a new terminal will open, prompting you to: -* `Enter new UNIX username:` - enter the username you will use to log in to this machine -* `Enter new UNIX password:` - enter the password you will use in combination with the selected username (you will not see what you're typing, that's a security measure in Linux regarding passwords) -* `Retype new UNIX password:` - repeat your password - -At the end, you should see the below output: - - passwd: password updated successfully - Installation successful! - -More on installing WSL and other distributions can be found [here](https://docs.microsoft.com/en-us/windows/wsl/install) - -You can close the installation window that was opened during the installation process. - - -## Change hostname displayed in terminal (recommended) -When you have more than one distro installed, identifying which distro your terminal is connected to can become difficult. - -In the below example we will modify the displayed hostname, by changing it to `ubuntu2004php74` - you can use any name you see fit. - -[Access distro](#access-your-distros) and [move to your home directory](../HELP.md#move-to-your-home-directory) (usually **/home/username**). - -Then, locate and open `.bashrc` using your preferred text editor. - -Inside this file, replace all occurrences of the string: **u@\h** with **u@ubuntu2004php74**. - -Save the file and close it. - -Next time you log in to this distro, the terminal will reflect the machine's name. - - -## Allow multiple instances of same Linux distribution (optional) -Using the default installation method, once a distro is installed, you cannot install another instance of the same distro. - -For example, if you already have an instance of `Ubuntu`, executing `wsl --install -d Ubuntu` will open the existing instance instead of installing a new one. - -In order to allow multiple instances of the same distro, we need to move the distro's disk drive file from the [default location](#wsl-distro-disk-drive-default-locations) to a custom one. - -In this example we will move distro called `Ubuntu` to drive `D` - you can choose any drive you want, but storing them on drive `C` might require admin privileges. - -First, we backup the distro: -* open Windows Terminal -* go to drive `D` using the command `cd D:` -* create a directory to store distros, for example `WSLs` using the command `cd WSLs` -* stop all distros using the command: `wsl --shutdown` -* make sure that all distros are stopped by [listing installed distros](#list-installed-distros) -* export distro, using the command `wsl --export Ubuntu ubuntu-backup.tar` - -Next, we delete the distro `Ubuntu`: -* execute command `wsl --unregister Ubuntu` -* make sure the distro is not installed by [listing installed distros](#list-installed-distros) - -Finally, we restore the distro from the backup to the new location: -* execute command `wsl --import Ubuntu Ubuntu ubuntu-backup.tar` -* make sure the distro has been reinstalled by [listing installed distros](#list-installed-distros) - -**Note**: You can also use this method to create forks of the same distro, each of them running different version of PHP. - - -## List installed distros -Open Windows Terminal and execute `wsl -l -v` or `wsl --list --verbose`. - -Depending on the installed distros, the output of this command will look similar to the following: - -| NAME | STATE | VERSION | -|--------------|---------|---------| -| Debian | running | 2 | -| Ubuntu | stopped | 2 | -| Ubuntu-16.04 | stopped | 2 | -| Ubuntu-18.04 | stopped | 2 | -| Ubuntu-20.04 | stopped | 2 | - -Although the column names are self-explanatory, here's a few details on the columns: -* `NAME`: distro name - use this string when you need to replace `{distro}` with a value -* `STATE`: indicates distro status (`running` or `stopped`) -* `VERSION`: indicates if a distro runs on WSL1 or WSL2 - - -## Access your distros -There are multiple ways for accessing a Linux distro: -* from Windows Terminal: use the arrow found in the tab bar (if you just installed a new distro, you need to restart the terminal for it to appear in the list) -* from Windows Terminal: type `wsl -d {distro}` (replace {distro} with your `distro`), then hit `Enter` -* from Windows Explorer: type `\\wsl$\{distro}` (replace {distro} with your `distro`) in the address bar, then hit `Enter` (once there, you can also pin the directory to Quick access) - - -## Start distro -Open Windows Terminal. If you don't know the name of the distro you want to start, [list installed distros](#list-installed-distros). - -You can start it by executing the following command (replace {distro} with your `distro`): - - wsl -d {distro} - - -## Stop distro -Open Windows Terminal. If you don't know the name of the distro you want to stop, [list installed distros](#list-installed-distros). - -You can stop it by executing the following command (replace {distro} with your `distro`): - - wsl -t {distro} - -OR - - wsl --terminate {distro} - - -## Restart distro -Open Windows Terminal. If you don't know the name of the distro you want to restart, [list installed distros](#list-installed-distros). - -First, [stop the distro](#stop-distro), then [start it](#start-distro). - - -## WSL and PhpStorm -Check out [this](https://www.jetbrains.com/help/phpstorm/how-to-use-wsl-development-environment-in-product.html) article on working with PhpStorm. - - -## Check identity -See below methods to identify the user you are logged in with: - -### Method 1: -By looking at your terminal's prompt area, you should see something similar to this: - - username@hostname:~$ - -The part before the `@` character is you current user, so in this example the username is `username`. - -### Method 2: -Using your terminal and being logged in to your `distro`, type in the following command: - - whoami - -The output of this command is the username you are currently logged in with. - - -## Switch from root to your username -[Check your identity](#switch-from-root-to-your-username) and if it's _root_, then execute the following command (replace {username} with your `username`): - - su - {username} - -[Check your identity](#switch-from-root-to-your-username) to make sure that your identity has been switched to the desired username. - - -## WSL distro disk drive default locations -Below you will find the disk drive file locations for the most common distros: -* `Debian (latest)`: %USERPROFILE%\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState -* `Ubuntu (latest)`: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState -* `Ubuntu 16.04`: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc\LocalState -* `Ubuntu 18.04`: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState -* `Ubuntu 20.04`: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState - - -## Getting help -If you need help using WSL, type `wsl --help` and hit `Enter`. This will output all available options on how to use WSL: - - Copyright (c) Microsoft Corporation. All rights reserved. - - Usage: wsl.exe [Argument] [Options...] [CommandLine] - - Arguments for running Linux binaries: - - If no command line is provided, wsl.exe launches the default shell. - - --exec, -e - Execute the specified command without using the default Linux shell. - - -- - Pass the remaining command line as is. - - Options: - --cd - Sets the specified directory as the current working directory. - If ~ is used the Linux user's home path will be used. If the path begins - with a / character, it will be interpreted as an absolute Linux path. - Otherwise, the value must be an absolute Windows path. - - --distribution, -d - Run the specified distribution. - - --user, -u - Run as the specified user. - - --system - Launches a shell for the system distribution. - - Arguments for managing Windows Subsystem for Linux: - - --help - Display usage information. - - --install [Options] - Install additional Windows Subsystem for Linux distributions. - For a list of valid distributions, use 'wsl --list --online'. - - Options: - --distribution, -d [Argument] - Downloads and installs a distribution by name. - - Arguments: - A valid distribution name (not case sensitive). - - Examples: - wsl --install -d Ubuntu - wsl --install --distribution Debian - - --set-default-version - Changes the default install version for new distributions. - - --shutdown - Immediately terminates all running distributions and the WSL 2 - lightweight utility virtual machine. - - --status - Show the status of Windows Subsystem for Linux. - - --update [Options] - If no options are specified, the WSL 2 kernel will be updated - to the latest version. - - Options: - --rollback - Revert to the previous version of the WSL 2 kernel. - - Arguments for managing distributions in Windows Subsystem for Linux: - - --export - Exports the distribution to a tar file. - The filename can be - for standard output. - - --import [Options] - Imports the specified tar file as a new distribution. - The filename can be - for standard input. - - Options: - --version - Specifies the version to use for the new distribution. - - --list, -l [Options] - Lists distributions. - - Options: - --all - List all distributions, including distributions that are - currently being installed or uninstalled. - - --running - List only distributions that are currently running. - - --quiet, -q - Only show distribution names. - - --verbose, -v - Show detailed information about all distributions. - - --online, -o - Displays a list of available distributions for install with 'wsl --install'. - - --set-default, -s - Sets the distribution as the default. - - --set-version - Changes the version of the specified distribution. - - --terminate, -t - Terminates the specified distribution. - - --unregister - Unregisters the distribution and deletes the root filesystem. - - --mount - Attaches and mounts a physical disk in all WSL2 distributions. - - Options: - --bare - Attach the disk to WSL2, but don't mount it. - - --type - Filesystem to use when mounting a disk, if not specified defaults to ext4. - - --options - Additional mount options. - - --partition - Index of the partition to mount, if not specified defaults to the whole disk. - - --unmount [Disk] - Unmounts and detaches a disk from all WSL2 distributions. - Unmounts and detaches all disks if called without argument. diff --git a/ansible/HELP.md b/wsl/HELP.md similarity index 59% rename from ansible/HELP.md rename to wsl/HELP.md index 61563af..ed9a86d 100644 --- a/ansible/HELP.md +++ b/wsl/HELP.md @@ -1,8 +1,10 @@ # Troubleshooting -## Switch from PHP7.4 to PHP 8.1 -Using your `username` log in to your `distro` and follow the below commands. +## Switching PHP versions +In this example we will switch from PHP version 7.4 to 8.1. + +Follow the same pattern if you need to switch between other versions than the ones presented in this example. Step 1: Disable PHP7.4: ``` @@ -45,24 +47,3 @@ chmod -R 777 data ``` chmod -R 777 log ``` - - -## Move to your home directory -In order to move from anywhere to your `username`'s home directory, execute the following command: -``` -cd ~ -``` - -## Detect current directory -If you don't know your current location, you can output it using the below command: -``` -pwd -``` - - -## Find your home directory -By combining [Move to your home directory](#move-to-your-home-directory) and [Detect current directory](#detect-current-directory) you can find your home directory. - - -## Find your projects directory -[Move to your home directory](#move-to-your-home-directory) where you should see a directory called `projects`. diff --git a/wsl/README.md b/wsl/README.md new file mode 100644 index 0000000..57a2ed2 --- /dev/null +++ b/wsl/README.md @@ -0,0 +1,29 @@ +## Install WSL development environment + +[< Back](../README.md) + + +## Prerequisites +Before proceeding to the installation, we need to make sure your machine is ready for running WSL2. + +Open the `Run` prompt by pressing `Win`+`r` and type in the dialog `OptionalFeatures`, then press `Enter`. + +This will open a window where you can turn Windows features on/off. + +Make sure the next features are activated (checked): +* `Hyper-V` (including its sub-features) +* `Virtual Machine Platform` +* `Windows Subsystem for Linux` + +> If any of the above features is missing, then first you need to install them manually using [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps. + +Click `Ok` and restart your computer. + +Make sure WSL2 is set ad default by executing the below command in Windows Terminal: + + wsl --set-default-version 2 + + +## Choose the Operating System you wish to use for development +* [Ubuntu 20](os/ubuntu20/README.md) +* [Alma Linux 8](os/almalinux8/README.md) diff --git a/ansible/config.yml b/wsl/config.yml similarity index 70% rename from ansible/config.yml rename to wsl/config.yml index 452b7ae..6e4e11f 100644 --- a/ansible/config.yml +++ b/wsl/config.yml @@ -5,13 +5,9 @@ config: "user.email": "" mysql: root_password: "" - php: - # Select at least one version to install. Possible values: 74 and 81 - versions: - - "74" - - "81" system: username: "{{ lookup('env', 'USER') }}" # Add as many virtualhosts as needed - if a virtualhost already exists, it will not be created + # example.local is an example, you can remove it and add your own local domains virtualhosts: - "example.local" diff --git a/ansible/create-virtualhost.yml b/wsl/create-virtualhost.yml similarity index 89% rename from ansible/create-virtualhost.yml rename to wsl/create-virtualhost.yml index 141e7ab..52a7cee 100644 --- a/ansible/create-virtualhost.yml +++ b/wsl/create-virtualhost.yml @@ -21,3 +21,5 @@ msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported" - import_playbook: "{{ playbook_dir }}/os/ubuntu20/create-virtualhost.yml" when: os == "ubuntu20" +- import_playbook: "{{ playbook_dir }}/os/almalinux8/create-virtualhost.yml" + when: os == "almalinux8" diff --git a/ansible/hosts b/wsl/hosts similarity index 100% rename from ansible/hosts rename to wsl/hosts diff --git a/ansible/install.yml b/wsl/install.yml similarity index 90% rename from ansible/install.yml rename to wsl/install.yml index fe5ae81..49f10f1 100644 --- a/ansible/install.yml +++ b/wsl/install.yml @@ -21,3 +21,5 @@ msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported" - import_playbook: "{{ playbook_dir }}/os/ubuntu20/install.yml" when: os == "ubuntu20" +- import_playbook: "{{ playbook_dir }}/os/almalinux8/install.yml" + when: os == "almalinux8" diff --git a/wsl/os/almalinux8/README.md b/wsl/os/almalinux8/README.md new file mode 100644 index 0000000..f175b08 --- /dev/null +++ b/wsl/os/almalinux8/README.md @@ -0,0 +1,139 @@ +# Install WSL development environment on AlmaLinux 8 + +[< DotKernel: Install development environment](../../../README.md) + + +## Download AlmaLinux 8 WSL image +Open Microsoft Store, in the search box type in: `AlmaLinux` and hit `Enter`. + +From the results, select `AlmaLinux 8 WSL` - this will take you to AlmaLinux 8's app page. + +On this page, locate and click the `Install` button - this will download AlmaLinux 8 WSL image on your machine. + +Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open Windows Terminal. + +Here you will be asked to fill in your username (for example `dotkernel`): + + Installing, this may take a few minutes... + Please create a default UNIX user account. The username does not need to match your Windows username. + For more information visit: https://aka.ms/wslusers + Enter new UNIX username: + +Next, you are prompted to enter a password to use with your username (you will not see what you're typing, that's a security measure in Linux regarding passwords): + + Enter new UNIX username: dotkernel. + Changing password for user dotkernel. + New password: + +Depending on the strength of your password, you might see the following message (if you want to choose a different password, hit `Enter` and you're taken back to previous step - else, continue) + + BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word + +Next, you asked to retype your password: + + Retype new password: + +Finally, you should see the following message: + + passwd: all authentication tokens updated successfully. + Installation successful! + [dotkernel@hostname:~]$ + + +## Install AlmaLinux 8 +Make sure you are in your home directory: + + cd ~ + +Update/Upgrade system packages: + + sudo dnf upgrade -y + +Install Extra Packages for Enterprise Linux (EPEL): + + sudo dnf install epel-release -y + +Now, install the latest version of Ansible: + + sudo dnf install ansible -y + +Clone dotkernel/development into your home directory: + + git clone https://github.com/dotkernel/development.git + +Move inside the directory `development/wsl`: + + cd development/wsl/ + +Using your preferred text editor, open `config.yml` where you must fill in the empty fields. + +Save and close the file. + +Install and configure all necessary services by running the below Ansible command: + + ansible-playbook -i hosts install.yml --ask-become-pass + +The installation process will iterate over each task in the playbook and will output a short summary with the results. + +At this point, AlmaLinux 8 needs to be restarted, so quit it by pressing `Control` + `d`. + +Open Windows Terminal. + +Stop AlmaLinux 8: + + wsl -t AlmaLinux-8 + +Start AlmaLinux 8: + + wsl -d AlmaLinux-8 + +Move to your home directory: + + cd ~ + +Start MySQL: + + sudo service mysql start + +Start Apache: + + sudo service apache2 start + +Now check if everything works by opening in your browser: +* [http://localhost/](http://localhost/) - Apache's default home page +* [http://localhost/info.php](http://localhost/info.php) - PHP info page +* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/) - PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mysql` -> `root_password`) + +The installation is complete, your development environment is ready to use. + + +## Create virtual hosts +Using your preferred text editor, open `config.yml` and add the hosts that you want to create under the `virtualhosts` list. Save and close the file. + +Create the specified virtual hosts: + + ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass + +This will iterate over the list of `virtualhosts` configured in `config.yml` and will output a short summary with the results. + +At this step, your virtual host is not yet accessible because first, you need to route the requests to your localhost. + +**Run as administrator** any text editor and open file `C:\Windows\System32\drivers\etc\hosts` (if you don't see it, select `All files` from the file type selector). + +For each item you placed in the `virtualhosts` list, add the below lines to the end of the file (make sure you replace `{virtualhost}` with your virtual host), then save and close the file. + + 127.0.0.1 {virtualhost} + ::1 {virtualhost} + +Example: + + 127.0.0.1 example.local + ::1 example.local + 127.0.0.1 example2.local + ::1 example2.local + +Your virtual host should be accessible and ready to use. + +**Note**: +* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/` +* If you encounter write permission issues, see [this guide](../../HELP.md#fix-common-permission-issues) diff --git a/wsl/os/almalinux8/create-virtualhost.yml b/wsl/os/almalinux8/create-virtualhost.yml new file mode 100644 index 0000000..ad5952b --- /dev/null +++ b/wsl/os/almalinux8/create-virtualhost.yml @@ -0,0 +1,12 @@ +--- +- name: Create new virtualhost under AlmaLinux 8 + hosts: localhost + connection: local + become: true + gather_facts: true + vars_files: + - ../../config.yml + - ./roles/user/vars/main.yml + roles: + - _ + - virtualhost diff --git a/wsl/os/almalinux8/install.yml b/wsl/os/almalinux8/install.yml new file mode 100644 index 0000000..412a3b5 --- /dev/null +++ b/wsl/os/almalinux8/install.yml @@ -0,0 +1,18 @@ +--- +- name: Setup AlmaLinux 8 development environment + hosts: localhost + connection: local + become: true + gather_facts: true + vars_files: + - ../../config.yml + roles: + - _ + - system + - apache + - mysql + - php + - phpmyadmin + - composer + - git + - user diff --git a/wsl/os/almalinux8/roles/_/handlers/main.yml b/wsl/os/almalinux8/roles/_/handlers/main.yml new file mode 100644 index 0000000..7f611bf --- /dev/null +++ b/wsl/os/almalinux8/roles/_/handlers/main.yml @@ -0,0 +1,33 @@ +--- +- name: Start Apache + service: + name: httpd + state: started +- name: Stop Apache + service: + name: httpd + state: stopped +- name: Restart Apache + service: + name: httpd + state: restarted +- name: Reload Apache + service: + name: httpd + state: reloaded +- name: Start MySQL + service: + name: mysql + state: started +- name: Stop MySQL + service: + name: mysql + state: stopped +- name: Restart MySQL + service: + name: mysql + state: restarted +- name: Enable MySQL + service: + name: mysql + enabled: yes diff --git a/wsl/os/almalinux8/roles/apache/tasks/main.yml b/wsl/os/almalinux8/roles/apache/tasks/main.yml new file mode 100644 index 0000000..c69a52b --- /dev/null +++ b/wsl/os/almalinux8/roles/apache/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Install Apache + dnf: + name: httpd + state: latest +#- name: Enable rewrite module +# command: a2enmod rewrite +#- name: Allow port 80 through firewall +# ansible.posix.firewalld: +# port: "{{ apache_port }}/tcp" +# state: enabled +# permanent: yes +# immediate: yes diff --git a/ansible/os/ubuntu20/roles/apache/vars/main.yml b/wsl/os/almalinux8/roles/apache/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/apache/vars/main.yml rename to wsl/os/almalinux8/roles/apache/vars/main.yml diff --git a/wsl/os/almalinux8/roles/composer/tasks/main.yml b/wsl/os/almalinux8/roles/composer/tasks/main.yml new file mode 100644 index 0000000..792c930 --- /dev/null +++ b/wsl/os/almalinux8/roles/composer/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Download Composer + get_url: + url: "{{ composer_download_url }}" + dest: "{{ composer_download_dest }}" +- name: Install Composer + command: php "{{ composer_download_dest }}" --install-dir="{{ bin_directory }}" --filename="{{ composer_filename }}" + when: composer_executable.stat.isreg is not defined or not composer_executable.stat.isreg diff --git a/ansible/os/ubuntu20/roles/composer/vars/main.yml b/wsl/os/almalinux8/roles/composer/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/composer/vars/main.yml rename to wsl/os/almalinux8/roles/composer/vars/main.yml diff --git a/wsl/os/almalinux8/roles/git/tasks/main.yml b/wsl/os/almalinux8/roles/git/tasks/main.yml new file mode 100644 index 0000000..844037d --- /dev/null +++ b/wsl/os/almalinux8/roles/git/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Install Git + dnf: + name: git + state: latest +- name: Apply global configurations + git_config: + name: "{{ item.key }}" + value: "{{ item.value }}" + scope: global + with_dict: "{{ git_config }}" +- name: Apply global user configurations + git_config: + name: "{{ item.key }}" + value: "{{ item.value }}" + scope: global + with_dict: "{{ config.git.config }}" diff --git a/ansible/os/ubuntu20/roles/git/vars/main.yml b/wsl/os/almalinux8/roles/git/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/git/vars/main.yml rename to wsl/os/almalinux8/roles/git/vars/main.yml diff --git a/wsl/os/almalinux8/roles/mysql/tasks/main.yml b/wsl/os/almalinux8/roles/mysql/tasks/main.yml new file mode 100644 index 0000000..47f382c --- /dev/null +++ b/wsl/os/almalinux8/roles/mysql/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- name: Install MySQL + dnf: + name: + - mysql + - mysql-server + state: latest +#- name: Assign home directory +# command: usermod -d /var/lib/mysql/ mysql +#- name: Start and enable MySQL +# service: +# name: mysql +# state: restarted +# enabled: true +#- name: Set MySQL root password +# mysql_user: +# name: root +# password: "{{ config.mysql.root_password }}" +# login_unix_socket: "{{ login_unix_socket }}" +# state: present +# no_log: true +#- name: Create my.cnf config file +# template: +# src: my.cnf.j2 +# dest: "{{ mysql_mycnf_dest }}" +# notify: Restart MySQL diff --git a/ansible/os/ubuntu20/roles/mysql/templates/my.cnf.j2 b/wsl/os/almalinux8/roles/mysql/templates/my.cnf.j2 similarity index 100% rename from ansible/os/ubuntu20/roles/mysql/templates/my.cnf.j2 rename to wsl/os/almalinux8/roles/mysql/templates/my.cnf.j2 diff --git a/ansible/os/ubuntu20/roles/mysql/vars/main.yml b/wsl/os/almalinux8/roles/mysql/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/mysql/vars/main.yml rename to wsl/os/almalinux8/roles/mysql/vars/main.yml diff --git a/ansible/os/ubuntu20/roles/php/tasks/main.yml b/wsl/os/almalinux8/roles/php/tasks/main.yml similarity index 78% rename from ansible/os/ubuntu20/roles/php/tasks/main.yml rename to wsl/os/almalinux8/roles/php/tasks/main.yml index 31ad85b..308ea58 100644 --- a/ansible/os/ubuntu20/roles/php/tasks/main.yml +++ b/wsl/os/almalinux8/roles/php/tasks/main.yml @@ -1,9 +1,9 @@ --- -- name: Install selected PHP versions +- name: Install PHP versions include_role: name: php tasks_from: "php{{ php_version }}" - loop: "{{ config.php.versions }}" + loop: "{{ php_versions }}" loop_control: loop_var: php_version - name: Create PHP info file diff --git a/wsl/os/almalinux8/roles/php/tasks/php72.yml b/wsl/os/almalinux8/roles/php/tasks/php72.yml new file mode 100644 index 0000000..74ccaaf --- /dev/null +++ b/wsl/os/almalinux8/roles/php/tasks/php72.yml @@ -0,0 +1,14 @@ +--- +- name: Install PHP 7.2 + dnf: + name: + - php + - php-common + - php-cli + - php-intl + - php-json + - php-mbstring + - php-mysqlnd + - php-pdo + - php-xml + state: latest diff --git a/ansible/os/ubuntu20/roles/php/templates/info.php.j2 b/wsl/os/almalinux8/roles/php/templates/info.php.j2 similarity index 100% rename from ansible/os/ubuntu20/roles/php/templates/info.php.j2 rename to wsl/os/almalinux8/roles/php/templates/info.php.j2 diff --git a/ansible/os/ubuntu20/roles/php/vars/main.yml b/wsl/os/almalinux8/roles/php/vars/main.yml similarity index 58% rename from ansible/os/ubuntu20/roles/php/vars/main.yml rename to wsl/os/almalinux8/roles/php/vars/main.yml index c690f0b..34939cb 100644 --- a/ansible/os/ubuntu20/roles/php/vars/main.yml +++ b/wsl/os/almalinux8/roles/php/vars/main.yml @@ -1,2 +1,4 @@ --- php_info_filename: info.php +php_versions: + - "72" diff --git a/wsl/os/almalinux8/roles/phpmyadmin/tasks/main.yml b/wsl/os/almalinux8/roles/phpmyadmin/tasks/main.yml new file mode 100644 index 0000000..f2e98b4 --- /dev/null +++ b/wsl/os/almalinux8/roles/phpmyadmin/tasks/main.yml @@ -0,0 +1,24 @@ +--- +- name: Create destination directory + file: + path: "{{ phpmyadmin_dest_dir }}" + state: directory + owner: root + group: root + mode: 0755 +- name: Download PhpMyAdmin + unarchive: + src: "{{ phpmyadmin_download_url }}" + dest: "{{ phpmyadmin_dest_dir }}" + remote_src: yes +- name: Create /tmp directory for PhpMyAdmin + file: + path: "{{ phpmyadmin_dest_dir }}/tmp" + state: directory + owner: root + group: root + mode: 0777 +- name: Configure PhpMyAdmin + template: + src: phpmyadmin.conf.j2 + dest: "{{ phpmyadmin_apache_config_file }}" diff --git a/wsl/os/almalinux8/roles/phpmyadmin/templates/phpmyadmin.conf.j2 b/wsl/os/almalinux8/roles/phpmyadmin/templates/phpmyadmin.conf.j2 new file mode 100644 index 0000000..75d3609 --- /dev/null +++ b/wsl/os/almalinux8/roles/phpmyadmin/templates/phpmyadmin.conf.j2 @@ -0,0 +1,19 @@ +Alias /phpmyadmin {{ phpmyadmin_dest_dir }} + + + AddDefaultCharset UTF-8 + + # Apache 2.4 + + Require all granted + + + + + + + + Require all granted + + + diff --git a/wsl/os/almalinux8/roles/phpmyadmin/vars/main.yml b/wsl/os/almalinux8/roles/phpmyadmin/vars/main.yml new file mode 100644 index 0000000..a7601c8 --- /dev/null +++ b/wsl/os/almalinux8/roles/phpmyadmin/vars/main.yml @@ -0,0 +1,4 @@ +--- +phpmyadmin_download_url: https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.zip +phpmyadmin_dest_dir: /usr/share/phpmyadmin +phpmyadmin_apache_config_file: /etc/httpd/conf.d/phpmyadmin.conf diff --git a/wsl/os/almalinux8/roles/system/tasks/main.yml b/wsl/os/almalinux8/roles/system/tasks/main.yml new file mode 100644 index 0000000..14db79e --- /dev/null +++ b/wsl/os/almalinux8/roles/system/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Update/Upgrade installed packages + dnf: + name: "*" + state: latest + update_cache: true +- name: Install helper packages + dnf: + name: "{{ item }}" + state: latest + with_items: + - vim + - unzip diff --git a/ansible/os/ubuntu20/roles/system/vars/main.yml b/wsl/os/almalinux8/roles/system/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/system/vars/main.yml rename to wsl/os/almalinux8/roles/system/vars/main.yml diff --git a/ansible/os/ubuntu20/roles/user/tasks/main.yml b/wsl/os/almalinux8/roles/user/tasks/main.yml similarity index 88% rename from ansible/os/ubuntu20/roles/user/tasks/main.yml rename to wsl/os/almalinux8/roles/user/tasks/main.yml index 644e0f6..7d4a377 100644 --- a/ansible/os/ubuntu20/roles/user/tasks/main.yml +++ b/wsl/os/almalinux8/roles/user/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: Set default user +- name: Copy WSL configuration file template: src: wsl.conf.j2 dest: "{{ user_wsl_config_dest }}" diff --git a/wsl/os/almalinux8/roles/user/templates/wsl.conf.j2 b/wsl/os/almalinux8/roles/user/templates/wsl.conf.j2 new file mode 100644 index 0000000..db09ef6 --- /dev/null +++ b/wsl/os/almalinux8/roles/user/templates/wsl.conf.j2 @@ -0,0 +1,2 @@ +[boot] +command = "sudo systemctl start httpd && sudo systemctl start mysql" diff --git a/ansible/os/ubuntu20/roles/user/vars/main.yml b/wsl/os/almalinux8/roles/user/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/user/vars/main.yml rename to wsl/os/almalinux8/roles/user/vars/main.yml diff --git a/ansible/os/ubuntu20/roles/virtualhost/tasks/main.yml b/wsl/os/almalinux8/roles/virtualhost/tasks/main.yml similarity index 95% rename from ansible/os/ubuntu20/roles/virtualhost/tasks/main.yml rename to wsl/os/almalinux8/roles/virtualhost/tasks/main.yml index 02e9063..52656b1 100644 --- a/ansible/os/ubuntu20/roles/virtualhost/tasks/main.yml +++ b/wsl/os/almalinux8/roles/virtualhost/tasks/main.yml @@ -21,5 +21,4 @@ loop: "{{ config.virtualhosts }}" loop_control: loop_var: virtualhost - notify: - - Restart Apache + notify: Restart Apache diff --git a/ansible/os/ubuntu20/roles/virtualhost/templates/virtualhost.conf.j2 b/wsl/os/almalinux8/roles/virtualhost/templates/virtualhost.conf.j2 similarity index 100% rename from ansible/os/ubuntu20/roles/virtualhost/templates/virtualhost.conf.j2 rename to wsl/os/almalinux8/roles/virtualhost/templates/virtualhost.conf.j2 diff --git a/ansible/os/ubuntu20/roles/virtualhost/vars/main.yml b/wsl/os/almalinux8/roles/virtualhost/vars/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/virtualhost/vars/main.yml rename to wsl/os/almalinux8/roles/virtualhost/vars/main.yml diff --git a/ansible/requirements.yml b/wsl/os/requirements.yml similarity index 100% rename from ansible/requirements.yml rename to wsl/os/requirements.yml diff --git a/wsl/os/ubuntu20/README.md b/wsl/os/ubuntu20/README.md new file mode 100644 index 0000000..b15d1f4 --- /dev/null +++ b/wsl/os/ubuntu20/README.md @@ -0,0 +1,120 @@ +# Install WSL development environment on Ubuntu 20 + +[< DotKernel: Install development environment](../../../README.md) + + +## Download Ubuntu 20 WSL image +Open Microsoft Store, in the search box type in: `Ubuntu` and hit `Enter`. + +From the results, select `Ubuntu 20.04.4 LTS` - this will take you to Ubuntu 20's app page. + +On this page, locate and click the `Install` button - this will download Ubuntu 20 WSL image on your machine. + +Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open Windows Terminal. + +Here you will be asked to fill in your username (for example `dotkernel`): + + Installing, this may take a few minutes... + Please create a default UNIX user account. The username does not need to match your Windows username. + For more information visit: https://aka.ms/wslusers + Enter new UNIX username: + +Next, you are prompted to enter a password to use with your username (you will not see what you're typing, that's a security measure in Linux regarding passwords): + + Enter new UNIX username: dotkernel. + Changing password for user dotkernel. + New password: + +Next, you asked to retype your password: + + Retype new password: + +Finally, you should see the following message: + + passwd: password updated successfully + Installation successful! + ... + dotkernel@hostname:~$ + + +## Install Ubuntu 20 +Make sure you are in your home directory: + + cd ~ + +Update/Upgrade system packages: + + sudo apt-get update && sudo apt-get upgrade -y + +Now, install the latest version of Ansible: + + sudo apt-get install ansible -y + +Clone dotkernel/development into your home directory: + + git clone https://github.com/dotkernel/development.git + +Move inside the directory `development/wsl`: + + cd development/wsl/ + +Using your preferred text editor, open `config.yml` where you must fill in the empty fields. + +Save and close the file. + +Install and configure all necessary services by running the below Ansible command: + + ansible-playbook -i hosts install.yml --ask-become-pass + +The installation process will iterate over each task in the playbook and will output a short summary with the results. + +At this point, Ubuntu 20 needs to be restarted, so quit it by pressing `Control` + `d`. + +Open Windows Terminal. + +Stop Ubuntu 20: + + wsl -t Ubuntu-20.04 + +Start Ubuntu 20: + + wsl -d Ubuntu-20.04 + +Now check if everything works by opening in your browser: +* [http://localhost/](http://localhost/) - Apache's default home page +* [http://localhost/info.php](http://localhost/info.php) - PHP info page +* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/) - PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mysql` -> `root_password`) + +The installation is complete, your development environment is ready to use. + + +## Create virtual hosts +Using your preferred text editor, open `config.yml` and add the hosts that you want to create under the `virtualhosts` list. Save and close the file. + +Create the specified virtual hosts: + + ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass + +This will iterate over the list of `virtualhosts` configured in `config.yml` and will output a short summary with the results. + +At this step, your virtual host is not yet accessible because first, you need to route the requests to your localhost. + +**Run as administrator** any text editor and open file `C:\Windows\System32\drivers\etc\hosts` (if you don't see it, select `All files` from the file type selector). + +For each item you placed in the `virtualhosts` list, add the below lines to the end of the file (make sure you replace `{virtualhost}` with your virtual host), then save and close the file. + + 127.0.0.1 {virtualhost} + ::1 {virtualhost} + +Example: + + 127.0.0.1 example.local + ::1 example.local + 127.0.0.1 example2.local + ::1 example2.local + +Your virtual host should be accessible and ready to use. + +**Note**: +* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/` +* If you encounter write permission issues, see [this guide](../../HELP.md#fix-common-permission-issues) diff --git a/ansible/os/ubuntu20/create-virtualhost.yml b/wsl/os/ubuntu20/create-virtualhost.yml similarity index 79% rename from ansible/os/ubuntu20/create-virtualhost.yml rename to wsl/os/ubuntu20/create-virtualhost.yml index 255ad59..1df0075 100644 --- a/ansible/os/ubuntu20/create-virtualhost.yml +++ b/wsl/os/ubuntu20/create-virtualhost.yml @@ -1,5 +1,5 @@ --- -- name: Create new virtualhost +- name: Create new virtualhost under Ubuntu 20 hosts: localhost connection: local become: true diff --git a/ansible/os/ubuntu20/install.yml b/wsl/os/ubuntu20/install.yml similarity index 100% rename from ansible/os/ubuntu20/install.yml rename to wsl/os/ubuntu20/install.yml diff --git a/ansible/os/ubuntu20/roles/_/handlers/main.yml b/wsl/os/ubuntu20/roles/_/handlers/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/_/handlers/main.yml rename to wsl/os/ubuntu20/roles/_/handlers/main.yml diff --git a/ansible/os/ubuntu20/roles/apache/tasks/main.yml b/wsl/os/ubuntu20/roles/apache/tasks/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/apache/tasks/main.yml rename to wsl/os/ubuntu20/roles/apache/tasks/main.yml diff --git a/wsl/os/ubuntu20/roles/apache/vars/main.yml b/wsl/os/ubuntu20/roles/apache/vars/main.yml new file mode 100644 index 0000000..0abfe42 --- /dev/null +++ b/wsl/os/ubuntu20/roles/apache/vars/main.yml @@ -0,0 +1,4 @@ +--- +apache_port: "80" +apache_config_file: /etc/apache2/apache2.conf +apache_home_dir: /var/www/html diff --git a/ansible/os/ubuntu20/roles/composer/tasks/main.yml b/wsl/os/ubuntu20/roles/composer/tasks/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/composer/tasks/main.yml rename to wsl/os/ubuntu20/roles/composer/tasks/main.yml diff --git a/wsl/os/ubuntu20/roles/composer/vars/main.yml b/wsl/os/ubuntu20/roles/composer/vars/main.yml new file mode 100644 index 0000000..b622db9 --- /dev/null +++ b/wsl/os/ubuntu20/roles/composer/vars/main.yml @@ -0,0 +1,5 @@ +--- +composer_download_url: https://getcomposer.org/installer +composer_download_dest: /tmp/composer-setup.php +composer_filename: composer +composer_path: "{{ bin_directory }}/{{ composer_filename }}" diff --git a/ansible/os/ubuntu20/roles/git/tasks/main.yml b/wsl/os/ubuntu20/roles/git/tasks/main.yml similarity index 100% rename from ansible/os/ubuntu20/roles/git/tasks/main.yml rename to wsl/os/ubuntu20/roles/git/tasks/main.yml diff --git a/wsl/os/ubuntu20/roles/git/vars/main.yml b/wsl/os/ubuntu20/roles/git/vars/main.yml new file mode 100644 index 0000000..a8891df --- /dev/null +++ b/wsl/os/ubuntu20/roles/git/vars/main.yml @@ -0,0 +1,4 @@ +--- +git_config: +- "core.autocrlf": "false" +- "core.eol": "lf" diff --git a/ansible/os/ubuntu20/roles/mysql/tasks/main.yml b/wsl/os/ubuntu20/roles/mysql/tasks/main.yml similarity index 85% rename from ansible/os/ubuntu20/roles/mysql/tasks/main.yml rename to wsl/os/ubuntu20/roles/mysql/tasks/main.yml index 7fc27a1..17c81e1 100644 --- a/ansible/os/ubuntu20/roles/mysql/tasks/main.yml +++ b/wsl/os/ubuntu20/roles/mysql/tasks/main.yml @@ -17,10 +17,6 @@ mysql_user: name: root password: "{{ config.mysql.root_password }}" - check_implicit_admin: true - login_host: "localhost" - login_user: "root" - login_password: "" login_unix_socket: "{{ login_unix_socket }}" state: present no_log: true diff --git a/wsl/os/ubuntu20/roles/mysql/templates/my.cnf.j2 b/wsl/os/ubuntu20/roles/mysql/templates/my.cnf.j2 new file mode 100644 index 0000000..5247c0c --- /dev/null +++ b/wsl/os/ubuntu20/roles/mysql/templates/my.cnf.j2 @@ -0,0 +1,2 @@ +[mysqld] +socket="{{ login_unix_socket }}" diff --git a/wsl/os/ubuntu20/roles/mysql/vars/main.yml b/wsl/os/ubuntu20/roles/mysql/vars/main.yml new file mode 100644 index 0000000..c12f199 --- /dev/null +++ b/wsl/os/ubuntu20/roles/mysql/vars/main.yml @@ -0,0 +1,3 @@ +--- +login_unix_socket: "/run/mysqld/mysqld.sock" +mysql_mycnf_dest: /etc/my.cnf diff --git a/wsl/os/ubuntu20/roles/php/tasks/main.yml b/wsl/os/ubuntu20/roles/php/tasks/main.yml new file mode 100644 index 0000000..308ea58 --- /dev/null +++ b/wsl/os/ubuntu20/roles/php/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Install PHP versions + include_role: + name: php + tasks_from: "php{{ php_version }}" + loop: "{{ php_versions }}" + loop_control: + loop_var: php_version +- name: Create PHP info file + template: + src: "{{ php_info_filename }}.j2" + dest: "{{ apache_home_dir }}/{{ php_info_filename }}" + notify: Restart Apache diff --git a/ansible/os/ubuntu20/roles/php/tasks/php74.yml b/wsl/os/ubuntu20/roles/php/tasks/php74.yml similarity index 100% rename from ansible/os/ubuntu20/roles/php/tasks/php74.yml rename to wsl/os/ubuntu20/roles/php/tasks/php74.yml diff --git a/ansible/os/ubuntu20/roles/php/tasks/php81.yml b/wsl/os/ubuntu20/roles/php/tasks/php81.yml similarity index 100% rename from ansible/os/ubuntu20/roles/php/tasks/php81.yml rename to wsl/os/ubuntu20/roles/php/tasks/php81.yml diff --git a/wsl/os/ubuntu20/roles/php/templates/info.php.j2 b/wsl/os/ubuntu20/roles/php/templates/info.php.j2 new file mode 100644 index 0000000..83f1549 --- /dev/null +++ b/wsl/os/ubuntu20/roles/php/templates/info.php.j2 @@ -0,0 +1,3 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + + ServerName {{ virtualhost }} + ServerAlias www.{{ virtualhost }} + + ServerAdmin webmaster@localhost + DocumentRoot {{ user_projects_dir }}/{{ virtualhost }}/public + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + diff --git a/wsl/os/ubuntu20/roles/virtualhost/vars/main.yml b/wsl/os/ubuntu20/roles/virtualhost/vars/main.yml new file mode 100644 index 0000000..f81eee3 --- /dev/null +++ b/wsl/os/ubuntu20/roles/virtualhost/vars/main.yml @@ -0,0 +1,2 @@ +--- +ansible_dir: "/home/{{ config.system.username }}/development/ansible" \ No newline at end of file