From 11cb793c42912c5413d235827750eeaf02879812 Mon Sep 17 00:00:00 2001 From: Seyyed Soroosh Hosseinalipour Date: Mon, 28 Mar 2022 13:16:16 +0000 Subject: [PATCH] Add ubuntu wsl in windows preparing. (see #19) --- .../Ansible/playbooks/host-dependent-write.yaml | 17 +++++++++++++++++ Deployment/Ansible/playbooks/hosts | 8 ++++---- Deployment/Powershell/prepare-windows.ps1 | 7 +++++++ 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 Deployment/Ansible/playbooks/host-dependent-write.yaml diff --git a/Deployment/Ansible/playbooks/host-dependent-write.yaml b/Deployment/Ansible/playbooks/host-dependent-write.yaml new file mode 100644 index 0000000..55c275d --- /dev/null +++ b/Deployment/Ansible/playbooks/host-dependent-write.yaml @@ -0,0 +1,17 @@ +# ITNOA + +- name: show write custom value based on host in each host + hosts: all + tasks: + - name: show write custom value based on host in each host +# command: echo "{{hostvars['{{inventory_hostname}}']['custom_var']}}" + shell: > + echo "{{ hostvars[inventory_hostname]['ss'] }}aa" | tee /tmp/host_var.txt +# echo "{{ hostvars[item]['ss'] }}" | tee /tmp/host_var.txt +# when: ansible_hostname == "item" +# with_items: +# - "{{ groups['workers'] }}" + - debug: +# msg: "{{hostvars['{{inventory_hostname}}']}}" + msg: "{{inventory_hostname}}" + \ No newline at end of file diff --git a/Deployment/Ansible/playbooks/hosts b/Deployment/Ansible/playbooks/hosts index 7fbfbaa..404c974 100644 --- a/Deployment/Ansible/playbooks/hosts +++ b/Deployment/Ansible/playbooks/hosts @@ -1,10 +1,10 @@ # ITNOA [workers] -host1 ansible_host=172.22.64.3 -host2 ansible_host=172.22.64.4 -host3 ansible_host=172.22.64.5 -host4 ansible_host=172.22.64.6 +host1 ansible_host=172.22.64.3 ss=3 +host2 ansible_host=172.22.64.4 ss=4 +host3 ansible_host=172.22.64.5 ss=5 +host4 ansible_host=172.22.64.6 ss=6 [all:vars] ansible_connection=ssh diff --git a/Deployment/Powershell/prepare-windows.ps1 b/Deployment/Powershell/prepare-windows.ps1 index 639f430..260a7e8 100644 --- a/Deployment/Powershell/prepare-windows.ps1 +++ b/Deployment/Powershell/prepare-windows.ps1 @@ -10,6 +10,13 @@ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-L Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile ~/Ubuntu.zip -UseBasicParsing +Expand-Archive ~/Ubuntu.zip C:\Distros\Ubuntu + +Set-Location C:\Distros\Ubuntu + +# TODO: Correct name based on version +Add-AppxPackage .\Ubuntu_2004.2021.825.0_x64.appx + # OpenSSH # Install the OpenSSH Client Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0