Add support for proxy networks & cleanup playbook vars

This commit is contained in:
Kenneth Benzie 2024-04-19 13:17:53 +01:00
parent a1296840f6
commit 5309683d94
30 changed files with 57 additions and 28 deletions

View File

@ -1,4 +1,6 @@
--- ---
- hosts: localhost - hosts: localhost
vars_files:
- vars/environment.yaml
roles: roles:
- 1password - 1password

View File

@ -2,10 +2,8 @@
- import_playbook: LinuxCLI.yaml - import_playbook: LinuxCLI.yaml
- import_playbook: UnixGUI.yaml - import_playbook: UnixGUI.yaml
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: firefox - role: firefox
- role: kitty - role: kitty

View File

@ -1,14 +1,14 @@
--- ---
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: rpmfusion - role: rpmfusion
when: ansible_os_family == 'RedHat' and ansible_distribution == 'Fedora' when: ansible_os_family == 'RedHat' and ansible_distribution == 'Fedora'
- import_playbook: UnixCLI.yaml - import_playbook: UnixCLI.yaml
- hosts: localhost - hosts: localhost
vars_files:
- vars/environment.yaml
roles: roles:
- role: gdb - role: gdb
- role: podman - role: podman

View File

@ -1,9 +1,7 @@
--- ---
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: sudo - role: sudo
when: ansible_user_id != "root" when: ansible_user_id != "root"

View File

@ -1,9 +1,7 @@
--- ---
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: flatpak - role: flatpak
when: ansible_os_family != "Darwin" when: ansible_os_family != "Darwin"

View File

@ -1,9 +1,7 @@
--- ---
- import_playbook: LinuxCLI.yaml - import_playbook: LinuxCLI.yaml
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: wsl - role: wsl

View File

@ -1,9 +1,7 @@
--- ---
- hosts: windows - hosts: windows
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: python - role: python
- role: git - role: git

View File

@ -1,14 +1,14 @@
--- ---
- import_playbook: UnixCLI.yaml - import_playbook: UnixCLI.yaml
- hosts: localhost - hosts: localhost
vars_files:
- vars/environment.yaml
roles: roles:
- role: system-info - role: system-info
- import_playbook: UnixGUI.yaml - import_playbook: UnixGUI.yaml
- hosts: localhost - hosts: localhost
vars: vars_files:
github_auth_headers: >- - vars/environment.yaml
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
roles: roles:
- role: mas - role: mas

View File

@ -0,0 +1,15 @@
---
# GitHub may rate limit unauthenticated API requests, this is more likely when
# behind a network proxy. Set the GITHUB_TOKEN environment variable to
# authenticate any GitHub API requests executed while playing roles.
github_auth_headers: >-
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
# When working behind a network proxy, set the http_proxy and https_proxy
# environment variables. These will be passed through to uses of the `get_url`
# module when playing roles.
proxy_environment: >-
{{ { 'http_proxy': lookup('env', 'http_proxy'),
'https_proxy': lookup('env', 'https_proxy') }
if lookup('env', 'http_proxy') and lookup('env', 'https_proxy') else {} }}

View File

@ -16,6 +16,7 @@
get_url: get_url:
url: https://downloads.1password.com/linux/keys/1password.asc url: https://downloads.1password.com/linux/keys/1password.asc
dest: '{{keyring}}' dest: '{{keyring}}'
environment: '{{proxy_environment}}'
- name: set compatible architecture - name: set compatible architecture
when: ansible_machine == 'x86_64' when: ansible_machine == 'x86_64'

View File

@ -16,6 +16,7 @@
win_get_url: win_get_url:
url: https://downloads.1password.com/win/1PasswordSetup-latest.exe url: https://downloads.1password.com/win/1PasswordSetup-latest.exe
dest: '{{installer_exe}}' dest: '{{installer_exe}}'
environment: '{{proxy_environment}}'
- name: run installer - name: run installer
when: not app_stat.stat.exists when: not app_stat.stat.exists
@ -68,6 +69,7 @@
win_get_url: win_get_url:
url: '{{latest.downloads.Windows.amd64}}' url: '{{latest.downloads.Windows.amd64}}'
dest: '{{cli_zip}}' dest: '{{cli_zip}}'
environment: '{{proxy_environment}}'
- name: unzip op zip archive - name: unzip op zip archive
when: cli_installed_version is not defined or cli_installed_version != latest.version when: cli_installed_version is not defined or cli_installed_version != latest.version

View File

@ -51,6 +51,7 @@
get_url: get_url:
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{bat_deb}}' dest: '{{bat_deb}}'
environment: '{{proxy_environment}}'
- name: install .deb file - name: install .deb file
when: installed_version is not defined or installed_version != latest_version when: installed_version is not defined or installed_version != latest_version

View File

@ -17,6 +17,7 @@
get_url: get_url:
url: https://packages.mozilla.org/apt/repo-signing-key.gpg url: https://packages.mozilla.org/apt/repo-signing-key.gpg
dest: /etc/apt/keyrings/packages.mozilla.org.asc dest: /etc/apt/keyrings/packages.mozilla.org.asc
environment: '{{proxy_environment}}'
- name: add mozilla apt repo - name: add mozilla apt repo
become: true become: true

View File

@ -37,6 +37,7 @@
get_url: get_url:
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{ansible_env.HOME}}/.local/share/fonts/tmp.zip' dest: '{{ansible_env.HOME}}/.local/share/fonts/tmp.zip'
environment: '{{proxy_environment}}'
- name: install Caskaydia Cove Nerd Font - name: install Caskaydia Cove Nerd Font
when: needs_installed when: needs_installed

View File

@ -15,6 +15,7 @@
url: https://cli.github.com/packages/githubcli-archive-keyring.gpg url: https://cli.github.com/packages/githubcli-archive-keyring.gpg
dest: /usr/share/keyrings/githubcli-archive-keyring.gpg dest: /usr/share/keyrings/githubcli-archive-keyring.gpg
mode: 0644 mode: 0644
environment: '{{proxy_environment}}'
- name: add apt repository list - name: add apt repository list
become: true become: true

View File

@ -4,6 +4,7 @@
get_url: get_url:
url: https://cli.github.com/packages/rpm/gh-cli.repo url: https://cli.github.com/packages/rpm/gh-cli.repo
dest: /etc/yum.repos.d/gh-cli.repo dest: /etc/yum.repos.d/gh-cli.repo
environment: '{{proxy_environment}}'
- name: install dnf package - name: install dnf package
become: true become: true

View File

@ -19,6 +19,7 @@
win_get_url: win_get_url:
url: '{{git_asset.browser_download_url}}' url: '{{git_asset.browser_download_url}}'
dest: '{{git_installer_path}}' dest: '{{git_installer_path}}'
environment: '{{proxy_environment}}'
- name: run installer command - name: run installer command
win_command: win_command:

View File

@ -40,6 +40,7 @@
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{tea_package_exe}}' dest: '{{tea_package_exe}}'
mode: '0755' mode: '0755'
environment: '{{proxy_environment}}'
- name: install package - name: install package
when: install_required when: install_required

View File

@ -48,6 +48,7 @@
get_url: get_url:
url: '{{asset.url}}' url: '{{asset.url}}'
dest: '{{tempdir.path}}/glab.deb' dest: '{{tempdir.path}}/glab.deb'
environment: '{{proxy_environment}}'
- name: install .deb file - name: install .deb file
when: glab_version is not defined or glab_version != latest_version when: glab_version is not defined or glab_version != latest_version

View File

@ -40,3 +40,4 @@
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{jp_exe}}' dest: '{{jp_exe}}'
mode: +x mode: +x
environment: '{{proxy_environment}}'

View File

@ -50,3 +50,4 @@
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{ansible_env.HOME}}/.local/bin/jp' dest: '{{ansible_env.HOME}}/.local/bin/jp'
mode: '0755' mode: '0755'
environment: '{{proxy_environment}}'

View File

@ -57,6 +57,7 @@
get_url: get_url:
url: https://apt.llvm.org/llvm-snapshot.gpg.key url: https://apt.llvm.org/llvm-snapshot.gpg.key
dest: '{{keyring}}' dest: '{{keyring}}'
environment: '{{proxy_environment}}'
- name: add upstream deb repository - name: add upstream deb repository
become: true become: true

View File

@ -79,6 +79,7 @@
get_url: get_url:
url: '{{asset[0].browser_download_url}}' url: '{{asset[0].browser_download_url}}'
dest: '{{package_path}}' dest: '{{package_path}}'
environment: '{{proxy_environment}}'
- name: extract package archive - name: extract package archive
when: install_required when: install_required

View File

@ -13,6 +13,7 @@
get_url: get_url:
url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz' url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz'
dest: ~/.local/src/node/node.tar.gz dest: ~/.local/src/node/node.tar.gz
environment: '{{proxy_environment}}'
- name: extract downloaded package - name: extract downloaded package
unarchive: unarchive:

View File

@ -18,6 +18,7 @@
get_url: get_url:
url: https://gist.githubusercontent.com/nicm/ea9cf3c93f22e0246ec858122d9abea1/raw/37ae29fc86e88b48dbc8a674478ad3e7a009f357/tmux-256color url: https://gist.githubusercontent.com/nicm/ea9cf3c93f22e0246ec858122d9abea1/raw/37ae29fc86e88b48dbc8a674478ad3e7a009f357/tmux-256color
dest: ~/tmux-256color dest: ~/tmux-256color
environment: '{{proxy_environment}}'
- name: compile terminal info - name: compile terminal info
when: terminfo_exists.rc == 1 when: terminfo_exists.rc == 1

View File

@ -7,6 +7,7 @@
dest: '{{ulauncher_keyring_path}}' dest: '{{ulauncher_keyring_path}}'
mode: '0644' mode: '0644'
force: true force: true
environment: '{{proxy_environment}}'
- name: add apt sources list - name: add apt sources list
when: ansible_distribution == 'Debian' when: ansible_distribution == 'Debian'

View File

@ -28,6 +28,7 @@
url: 'https://cdn-2.webcatalog.io/webcatalog/{{appimage}}' url: 'https://cdn-2.webcatalog.io/webcatalog/{{appimage}}'
dest: '{{ansible_env.HOME}}/.local/bin/{{appimage}}' dest: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
mode: '0755' mode: '0755'
environment: '{{proxy_environment}}'
- name: create directories - name: create directories
file: file:

View File

@ -63,6 +63,7 @@
get_url: get_url:
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{install_dir}}/xremap.zip' dest: '{{install_dir}}/xremap.zip'
environment: '{{proxy_environment}}'
- name: extract release archive - name: extract release archive
when: needs_installed when: needs_installed

View File

@ -36,3 +36,4 @@
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{yq_exe}}' dest: '{{yq_exe}}'
mode: +x mode: +x
environment: '{{proxy_environment}}'

View File

@ -50,3 +50,4 @@
url: '{{asset.browser_download_url}}' url: '{{asset.browser_download_url}}'
dest: '{{ansible_env.HOME}}/.local/bin/yq' dest: '{{ansible_env.HOME}}/.local/bin/yq'
mode: '0755' mode: '0755'
environment: '{{proxy_environment}}'