Ansible, Azure & WSL survival guide (VS Code bonus track)
Hi all you new DevOps!
This guide is meant for poor Windows' users struggling to get Ansible working on their workstations, like me few days ago :-(
Scenario: you're involved in a brand new cloud project on Azure, you're trying to make things work with Ansible and your company provides you a Windows 10 ™ PC, but Ansible DO NOT RUN on Windows.
In addiction you're lazy and bored to start yet another virtual machine, just to type "git pull" and "ansible-palybook" :-D (by the way your precious SSD is getting dangerously full).
And you do want your memory greed Visual Studio Code, with autocompletion, syntax highlight, all-known languages modules and other silly stuff.
First of all, let's install WSL (if you don't know what WSL is, google it):
https://docs.microsoft.com/en-us/windows/wsl/install-win10
I assume you installed an Ubuntu 16.04 upon WSL.
Quite simple, isn't it?
Now you should install Ansible and all needed Azure modules.
There's a simple guide on Azure documentation portal, let's follow the Ubuntu's section.
Uhm, did something go wrong with pip's version and other Python related stuff?
Ok, you may have SSL certificates issues or pip/Python versions hell (damn it).
Try to substitute this command:
sudo pip install ansible[azure]
with:
pip install pip==9.0.3 --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install ansible --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install azure --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install ansible[azure] --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
and cross your fingers, it worked for me.
And now the last tips to make you an happy hybrid environment developer.
This guide is meant for poor Windows' users struggling to get Ansible working on their workstations, like me few days ago :-(
Scenario: you're involved in a brand new cloud project on Azure, you're trying to make things work with Ansible and your company provides you a Windows 10 ™ PC, but Ansible DO NOT RUN on Windows.
In addiction you're lazy and bored to start yet another virtual machine, just to type "git pull" and "ansible-palybook" :-D (by the way your precious SSD is getting dangerously full).
And you do want your memory greed Visual Studio Code, with autocompletion, syntax highlight, all-known languages modules and other silly stuff.
First of all, let's install WSL (if you don't know what WSL is, google it):
https://docs.microsoft.com/en-us/windows/wsl/install-win10
I assume you installed an Ubuntu 16.04 upon WSL.
Quite simple, isn't it?
Now you should install Ansible and all needed Azure modules.
There's a simple guide on Azure documentation portal, let's follow the Ubuntu's section.
Uhm, did something go wrong with pip's version and other Python related stuff?
Ok, you may have SSL certificates issues or pip/Python versions hell (damn it).
Try to substitute this command:
sudo pip install ansible[azure]
with:
pip install pip==9.0.3 --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install ansible --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install azure --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
pip install ansible[azure] --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user
and cross your fingers, it worked for me.
And now the last tips to make you an happy hybrid environment developer.
- Ansible complains you're reading the config from from a world-writable current working directory? Go there and follow the instructions you find here to properly mount Windows disk.
- You edit files in your WSL home directory from Windows and you loose ownership, permissions, etc ?
Go there and there (a bit technical). - And finally enjoy coding with VS Code
I had to specify C:\WINDOWS\System32\wsl.exe as integrated shell path (bash.exe didn't work for me).
Commenti
Posta un commento