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
vars_files:
- vars/environment.yaml
roles:
- 1password

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
---
- import_playbook: UnixCLI.yaml
- hosts: localhost
vars_files:
- vars/environment.yaml
roles:
- role: system-info
- import_playbook: UnixGUI.yaml
- hosts: localhost
vars:
github_auth_headers: >-
{{ { 'Authorization': 'Bearer ' + lookup('env', 'GITHUB_TOKEN') }
if lookup('env', 'GITHUB_TOKEN') else {} }}
vars_files:
- vars/environment.yaml
roles:
- 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:
url: https://downloads.1password.com/linux/keys/1password.asc
dest: '{{keyring}}'
environment: '{{proxy_environment}}'
- name: set compatible architecture
when: ansible_machine == 'x86_64'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,7 @@
get_url:
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
environment: '{{proxy_environment}}'
- name: extract downloaded package
unarchive:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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