ansible: More ansible setup

This commit is contained in:
doyle 2023-01-22 19:57:47 +11:00
parent c20d066c3e
commit 658404387d
3 changed files with 130 additions and 34 deletions

View File

@ -5,9 +5,11 @@
get_checksum: yes
checksum_algorithm: "{{ app_checksum_type }}"
- name: Download & install {{ app_label }} {{ app_version }}
when: exe_checksum_result.stat.exists == false or exe_checksum_result.stat.checksum != app_exe_checksum
block:
- name: Download {{ app_label }} {{ app_version }}
register: app_download_result
when: exe_checksum_result.stat.exists == false or exe_checksum_result.stat.checksum != app_exe_checksum
ansible.windows.win_get_url:
url: "{{ app_download_url }}"
dest: "{{ download_dir }}"
@ -15,10 +17,25 @@
checksum_algorithm: "{{ app_checksum_type }}"
force: false
- name: Install {{ app_label }} {{ app_version }} executable
- name: Install {{ app_label }} {{ app_version }}
ansible.windows.win_command: "{{ install_command }}"
loop: "{{ app_install_commands }}"
loop_control:
loop_var: install_command
when: exe_checksum_result.stat.exists == false or exe_checksum_result.stat.checksum != app_exe_checksum
- name: Verify {{ app_label }} {{ app_version }} executable checksum
register: exe_checksum_verify_result
ansible.windows.win_stat:
path: "{{ app_exe_path }}"
get_checksum: yes
checksum_algorithm: "{{ app_checksum_type }}"
failed_when: exe_checksum_verify_result.stat.exists == false
- name: Output {{ app_label }} {{ app_version }} executable checksum
ansible.builtin.debug:
msg: |
"{{ exe_checksum_verify_result.stat.path }}"
" expect: {{ app_exe_checksum }}"
" actual: {{ exe_checksum_verify_result.stat.checksum }}"
failed_when: exe_checksum_verify_result.stat.checksum != app_exe_checksum

View File

@ -27,7 +27,7 @@
install_dir: "{{ root_dir }}\\Install"
zip7_version: 2201
zip7_install_dir: "{{ install_dir }}\\7zip_win64\\{{ zip7_version }}"
zip7_install_dir: "{{ install_dir }}\\7zip_win64\\2201"
default_unzip_install_command: "{{ zip7_install_dir }}\\7z.exe x {{ app_download_result.dest }} -o{{ app_install_dir }} -aoa -spe"
@ -67,21 +67,9 @@
- name: Install {{ app_label }} from archive
ansible.builtin.import_tasks: install_from_archive.yml
tags: [&wezterm_label WezTerm, even]
vars:
app_label: "7zip"
app_version: "{{ zip7_version }}"
app_download_checksum: b055fee85472921575071464a97a79540e489c1c3a14b9bdfbdbab60e17f36e4
app_download_filename: 7z{{ app_version }}-x64
app_download_url: https://www.7-zip.org/a/{{ app_download_filename }}.exe
app_exe_path: "{{ app_install_dir}}\\7z.exe"
app_exe_checksum: 254cf6411d38903b2440819f7e0a847f0cfee7f8096cfad9e90fea62f42b0c23
app_install_commands:
- "{{ internal_dir }}\\7zr.exe x {{ app_download_result.dest }} -o{{ app_install_dir }} -aoa -spe"
- name: Install {{ app_label }} from archive
ansible.builtin.import_tasks: install_from_archive.yml
vars:
app_label: WezTerm
app_label: *wezterm_label
app_version: 20221119-145034-49b9839f
app_download_checksum: 7041d2c02d226c0c051cc9f6373d51ac9a2de00025e18582077c76e8ad68abe1
app_download_filename: WezTerm-windows-{{ app_version }}
@ -92,20 +80,21 @@
- name: Install {{ app_label }} from archive
ansible.builtin.import_tasks: install_from_archive.yml
tags: [&jetbrains_label JetBrains Mono Font, odd]
vars:
app_label: JetBrains Mono Font
app_label: *jetbrains_label
app_version: 2.304
app_download_checksum: 6f6376c6ed2960ea8a963cd7387ec9d76e3f629125bc33d1fdcd7eb7012f7bbf
app_download_filename: JetBrainsMono-{{ app_version }}
app_download_url: https://download.jetbrains.com/fonts/{{ app_download_filename }}.zip
app_exe_checksum: a0bf60ef0f83c5ed4d7a75d45838548b1f6873372dfac88f71804491898d138f
app_exe_path: "{{ app_install_dir }}\\fonts\\ttf\\JetBrainsMono-Regular.ttf"
app_install_commands: "{{ default_unzip_install_commands }}"
- name: Install {{ app_label }} from archive
ansible.builtin.include_tasks: install_from_archive.yml
tags: [&cmake_label CMake, even]
vars:
app_label: CMake
app_label: *cmake_label
app_download_filename: "{{ item.download_filename | replace('@VERSION@', app_version) }}"
app_download_url: https://github.com/Kitware/CMake/releases/download/v{{ item.version }}/{{ app_download_filename }}.zip
app_exe_path: "{{ app_install_dir }}\\bin\\cmake.exe"
@ -128,13 +117,89 @@
- name: Install {{ app_label }} from archive
ansible.builtin.import_tasks: install_from_archive.yml
tags: [&doxygen_label Doxygen, odd]
vars:
app_label: Doxygen
app_label: *doxygen_label
app_version: 1.9.4
app_download_checksum: 3b34098c5fb016baa1d29aba101fe9d6843213b966b92a6b12c8856c547ee0c4
app_download_filename: doxygen-{{ app_version }}.windows.x64.bin
app_download_url: https://github.com/doxygen/doxygen/releases/download/Release_{{ app_version | replace('.', '_') }}/{{ app_download_filename }}.zip
app_exe_checksum: 3cb4d89f2b3db7eec2b6797dc6b49cdfe9adda954575898895260f66f312d730
app_exe_path: "{{ app_install_dir }}\\doxygen.exe"
app_install_commands: "{{ default_unzip_install_commands }}"
- name: Install {{ app_label}} from archive
ansible.builtin.import_tasks: install_from_archive.yml
tags: [&git_label Git, even]
vars:
app_label: *git_label
app_version: 2.39.1
app_download_checksum: b898306a44084b5fa13b9a52e06408d97234389d07ae41d9409bdf58cad3d227
app_download_filename: PortableGit-{{ app_version }}-64-bit.7z.exe
app_download_url: https://github.com/git-for-windows/git/releases/download/v{{ app_version }}.windows.1/{{ app_download_filename }}
app_exe_checksum: 2fc6d5be237efb6b429d8f40975f1a1cfe3bcac863d9335e24096c8b0ec38105
app_exe_path: "{{ app_install_dir }}\\cmd\\git.exe"
- ansible.builtin.include_tasks: install_from_archive.yml
vars:
app_label: GCC MinGW ARM
app_version: "{{ item.version }}"
app_download_filename: "gcc-v{{ app_version }}-{{ item.arch }}"
app_download_url: https://github.com/mmozeiko/build-gcc-arm/releases/download/gcc-v{{ app_version }}/{{ app_download_filename }}.7z
app_exe_path: "{{ app_install_dir }}\\bin\\{{ item.arch }}-g++.exe"
app_install_commands: "{{ default_unzip_remove_dupe_root_install_commands }}"
loop:
- version: 12.2.0
arch: aarch64-none-elf
download_checksum: 729e8af6aecd85cce63435b94c310c01983091b5db54842cd6604298f29d047f
exe_checksum: a26baffa86bc3401790d682f13f9b321ea56153eae7dd4f332bde40a6b76fcb3
- version: 12.2.0
arch: arm-none-eabi
download_checksum: aa581b3a5d446bb2d9827f2ea1f02b066b6713d4543d24abbd3181f626036c39
exe_checksum: fa48985c43cf82b426c461381e4c50d0ac3e9425f7e97bf116e1bab4b3a2a388
- version: 11.3.0
arch: aarch64-none-elf
download_checksum: a000bdeeb225145a1450c1b9b1094ef71c13fc4de2ab300a65acbf51cd107c7d
exe_checksum: 47eaef0e603c9fcae18f2efada305888503e878053119ede3a9e0b8b8beac2ee
- version: 11.3.0
arch: arm-none-eabi
download_checksum: 797ed71f60fae386c8875bb4e75e244afb15ded9e00ac77b6670a62be7614cc6
exe_checksum: a36f2ea6846badf7c91631f118e88967f25d6e479a9beea158445ce75403a655
- version: 10.3.0
arch: aarch64-none-elf
download_checksum: 095ab5a12059fa5dc59f415c059eb577f443a766eb1dd312fbede0f59940f432
exe_checksum: f2b2d3c6dab0f84a151835540f25e6d6f9442d00bf546bc4c709fad4b6fdda06
- version: 10.3.0
arch: arm-none-eabi
download_checksum: af0fc2da062aa6423a91213e231ecc5981136b9b0655837ebdbbc5ad879d2d9e
exe_checksum: c3dc49b561d177b3586992dfea86067eb8799e1586a7f26cea5b0ea97926632e
- ansible.builtin.include_tasks: install_from_archive.yml
vars:
app_label: GCC MinGW
app_version: "{{ item.version }}"
app_download_filename: "gcc-v{{ app_version }}-mingw-v{{ item.mingw_version }}-x86_64"
app_download_url: https://github.com/mmozeiko/build-gcc/releases/download/gcc-v{{ app_version }}-mingw-v{{ item.mingw_version }}/{{ app_download_filename }}.7z
app_exe_path: "{{ app_install_dir }}\\bin\\gcc.exe"
app_install_commands: "{{ default_unzip_remove_dupe_root_install_commands }}"
loop:
- version: 12.2.0
mingw_version: 10.0.0
download_checksum: 5cbe5ea7533f6d24af3a57fe7022032f420b15d7c4e38c0d16534a42d33213a4
exe_checksum: 886b0f25256ddbd0f4ad09e6e3b81279f9a8b6a1b5c32c714c9c201d802caa39
- version: 11.3.0
mingw_version: 10.0.0
download_checksum: e2c5c64659aeda77680c5eec80bbaa4db3f117b21febeb3f13fd76d580604fd0
exe_checksum: e92ecfa0171f2ab0c3ca39f2121ab5e887b3a378399a4be7e056820f5841c7a5
- version: 10.3.0
mingw_version: 8.0.0
download_checksum: c8f38f6b1d264d7e008009bd32a04ca71b4ee3a3113e67930ab31c2e06818317
exe_checksum: 5c93b6da129ea01ee5fc87d5c7db948fc3bc62bae261ded9a883f1fa543571d2

View File

@ -6,11 +6,25 @@ REM https://stackoverflow.com/questions/58345011/setup-windows-10-workstation-us
set script_dir_backslash=%~dp0
set script_dir=%script_dir_backslash:~0,-1%
REM Disable the virtual adapter for WSL. Virtual adapters for WSL2 are created
REM using Hyper-V and are forced to the public profile. PSRemoting can not be
REM enabled if there are any adapters with a public profile for security
REM reasons. Here we disable the adapter and re-enable it afterwards.
powershell -Command "Disable-NetAdapter -Name \"vEthernet (WSL)\" -Confirm:$false"
REM Enable remote control capabilities
powershell -Command "Enable-PSRemoting" || goto :cleanup
REM Allow basic unencrypted authentication
powershell -Command "Set-Item -Path WSMan:\localhost\Service\Auth\Basic -Value $true" || goto :cleanup
powershell -Command "Set-Item -Path WSMan:\localhost\Service\AllowUnencrypted -Value $true" || goto :cleanup
REM Re-enable the adapter after setting up all the options
powershell -Command "Enable-NetAdapter -Name \"vEthernet (WSL)\" -Confirm:$false" || goto :cleanup
goto :eof
:cleanup
REM Ensure the adapter is re-enabled.
powershell -Command "Enable-NetAdapter -Name \"vEthernet (WSL)\" -Confirm:$false" || goto :cleanup
call %script_dir%\win_ansible_end_setup.bat