{"id":15059085,"url":"https://github.com/peter-777/fedora-wsl-setup-playbook","last_synced_at":"2026-01-02T14:02:59.200Z","repository":{"id":239788591,"uuid":"800504275","full_name":"peter-777/fedora-wsl-setup-playbook","owner":"peter-777","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-22T01:14:04.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-22T13:34:38.428Z","etag":null,"topics":["ansible","fedora","wsl2"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-777.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-14T13:10:26.000Z","updated_at":"2024-07-12T06:38:28.559Z","dependencies_parsed_at":"2024-07-12T06:51:27.125Z","dependency_job_id":null,"html_url":"https://github.com/peter-777/fedora-wsl-setup-playbook","commit_stats":null,"previous_names":["peter-777/fedora-wsl-setup-playbook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-777%2Ffedora-wsl-setup-playbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-777%2Ffedora-wsl-setup-playbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-777%2Ffedora-wsl-setup-playbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-777%2Ffedora-wsl-setup-playbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-777","download_url":"https://codeload.github.com/peter-777/fedora-wsl-setup-playbook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243558477,"owners_count":20310574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","fedora","wsl2"],"created_at":"2024-09-24T22:36:55.631Z","updated_at":"2026-01-02T14:02:59.194Z","avatar_url":"https://github.com/peter-777.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"[日本語のREADME](./README_ja.md)\n\nHere is a machine translation of the above Japanese text. Apologies for any mistakes. \n\n---\n\n# Fedora WSL Setup Playbook\n\nThis is an Ansible playbook for setting up Fedora as a WSL distribution. It handles the setup within the distribution after importing a container-based rootfs with `wsl --import ...`.\n\nThis playbook performs the following major configurations:\n\n1. Initial Setup (Role: initial_setup)\n    1. Configure `man`\n    1. Install packages\n    1. Enable systemd for WSL\n1. General User Setup (Role: user_setup)\n    1. Create and register the user as the default for WSL\n    1. Mount Box Drive\n    1. Customize `bashrc` and `.gitconfig` (including Windows SSH Agent integration)\n    1. Install tools outside of DNF\n1. Post-Systemd Startup Setup (Role: after_started_systemd)\n    1. Configure locale and timezone\n    1. Enable services\n\nFor details, refer to the `main.yml` of each role.\n\n## How to Play\n\n1. Import the rootfs of Fedora using `wsl --import xxx yyy`.\n1. Install the packages required to execute the playbook:\n\n    ```sh\n    dnf install git ansible python3-passlib  python3-libdnf5\n    ```\n\n1. Clone this repository:\n\n    ```sh\n    git clone https://github.com/peter-777/fedora-wsl-setup-playbook.git \u0026\u0026 \\\n    cd ./fedora-wsl-setup-playbook\n    ```\n\n1. Execute the playbook. Details of the command parameters are provided below.\n\n    ```sh\n    ansible-playbook -l \u003cenvironment\u003e playbook.yml -e @private.yml --ask-vault-pass\n    ```\n\n1. Shut down WSL using `wsl --shutdown`, restart the distribution, and then execute the following as the root user:\n\n    ```sh\n    ansible-playbook -l fedora playbook.yml --tags after-started-systemd -e @private.yml --ask-vault-pass\n    ```\n\n## Parameters\n\n| Parameter | Description |\n| - | - |\n| -l \u003cenvironment\u003e | `fedora` or `testcontainer`\u003cbr\u003e\u003cli\u003e`fedora`: Execute the playbook on the running WSL distribution.\u003c/li\u003e\u003cli\u003e`testcontainer`: Start a Fedora container with Podman and execute the playbook.\u003c/li\u003e |\n| -e @private.yml | Load parameters from the Vault file (`private.yml`). Details are provided below.\u003cbr\u003eWhile not mandatory, it is recommended. |\n| --ask-vault-pass | Prompts for the Vault password.\u003cbr\u003eUse this if the Vault is encrypted. |\n\n### Destroy Playground\n\nWhen specifying `-l testcontainer`, Podman automatically starts a Fedora container, but if a container named `testcontainer` already exists, it will be reused.\n\nTo test in a fresh environment or remove the playground, use the following commands to delete the container:\n\n```sh\npodman stop testcontainer\npodman rm testcontainer\n```\n\n### Run with Vault\n\nWhen running the playbook, some parameters (such as the username and password to create) need to be provided at runtime. It is convenient to use `ansible-vault` to save these parameters in a file.\n\nCreate the following YAML file, replacing the username and password with your own:\n\n```yaml\nuser_name: user\nuser_password: password\nuser_salt: saltstring\nuser_git_name: User Name\nuser_git_email: user@example.com\nbox_drive_path: C:/Users/UserName/Box\n```\n\nOptionally, encrypt the Vault file. The example below assumes the Vault file is named `private.yml`:\n\n```sh\nansible-vault encrypt private.yml\n```\n\n## Customize Playbook\n\n### Default User .bashrc\n\nTo customize the default user's `.bashrc`, edit the `roles/user_setup/files/append-bashrc.sh` file.\n\n### Add or Remove Installed Packages\n\nTo modify the packages that are installed, edit the `roles/initial_setup/vars/main.yml` file.\n\n### SSH Agent Relay\n\nRunning this playbook allows you to use the SSH Agent from Windows within WSL, which is especially beneficial for users who manage their private keys with tools like 1Password.\n\nPreviously, this was achieved using `Npiperelay` and a socket service, but it is now done by invoking Windows executables directly from WSL.\n\nHowever, this method does not use the distribution's native SSH command, which has its pros and cons. Therefore, the tasks for installing `Npiperelay` are left as comments.\n\n### Further Customizations\n\nFeel free to customize any other aspects as you prefer:\n\n- Install additional tools besides the Quarkus CLI\n- Exclude the Box Drive mount task if you are not a Box Drive user\n- And so on...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-777%2Ffedora-wsl-setup-playbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-777%2Ffedora-wsl-setup-playbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-777%2Ffedora-wsl-setup-playbook/lists"}