Skip to content

Commit 54ce6e4

Browse files
committed
fix: Update ansible built-in variable reference to get rid of deprecation warnings
1 parent c16323a commit 54ce6e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+200
-200
lines changed

ansible/roles/config/tasks/ansible.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
vars:
55
app: ansible-lint
66
source_file: ansible-lint
7-
target_file: "{{ ansible_env.HOME }}/.ansible-lint"
7+
target_file: "{{ ansible_facts['env']['HOME'] }}/.ansible-lint"
88
ansible.builtin.include_role:
99
name: common
1010
tasks_from: config_file.yml

ansible/roles/config/tasks/git.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vars:
66
app: git
77
source_template: gitconfig.j2
8-
target_file: "{{ ansible_env.HOME }}/.gitconfig"
8+
target_file: "{{ ansible_facts['env']['HOME'] }}/.gitconfig"
99
ansible.builtin.include_role:
1010
name: common
1111
tasks_from: config_file.yml

ansible/roles/config/tasks/lazygit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# Source: https://github.com/jesseduffield/lazygit
33
- name: "[Config][Lazygit] Ensure lazygit config directory"
44
ansible.builtin.file:
5-
path: "{{ ansible_env.HOME }}/.config/lazygit"
5+
path: "{{ ansible_facts['env']['HOME'] }}/.config/lazygit"
66
state: directory
77
mode: '0755'
88

99
- name: "[Config][Lazygit] Configure config.yml"
1010
vars:
1111
app: lazygit
1212
source_file: lazygit.yml
13-
target_file: "{{ ansible_env.HOME }}/.config/lazygit/config.yml"
13+
target_file: "{{ ansible_facts['env']['HOME'] }}/.config/lazygit/config.yml"
1414
ansible.builtin.include_role:
1515
name: common
1616
tasks_from: config_file.yml

ansible/roles/config/tasks/neovim-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
ansible.builtin.command: "nvim --headless +q"
1212
failed_when: false
1313
environment:
14-
PATH: "{{ ansible_env.HOME }}/.local/bin/:{{ ansible_env.PATH }}"
14+
PATH: "{{ ansible_facts['env']['HOME'] }}/.local/bin/:{{ ansible_env.PATH }}"
1515
NVIM_APPNAME: "{{ neovim_config_appname }}"
1616

1717
- name: "[Neovim config] Save used version"

ansible/roles/config/tasks/p10k.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
vars:
66
app: p10k
77
source_file: p10k.zsh
8-
target_file: "{{ ansible_env.HOME }}/.p10k.zsh"
8+
target_file: "{{ ansible_facts['env']['HOME'] }}/.p10k.zsh"
99
ansible.builtin.include_role:
1010
name: common
1111
tasks_from: config_file.yml

ansible/roles/config/tasks/tmux.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
vars:
44
app: Tmux
55
source_file: tmux.conf
6-
target_file: "{{ ansible_env.HOME }}/.tmux.conf"
6+
target_file: "{{ ansible_facts['env']['HOME'] }}/.tmux.conf"
77
ansible.builtin.include_role:
88
name: common
99
tasks_from: config_file.yml
1010

1111
# TODO: Add changed_when/failed_when
1212
- name: "[Config][Tmux] Install plugins" # noqa no-changed-when
13-
ansible.builtin.command: "{{ ansible_env.HOME }}/.tmux/plugins/tpm/bin/install_plugins"
13+
ansible.builtin.command: "{{ ansible_facts['env']['HOME'] }}/.tmux/plugins/tpm/bin/install_plugins"
1414

1515
# TODO: Add changed_when/failed_when
1616
- name: "[Config][Tmux] Update plugins" # noqa no-changed-when
17-
ansible.builtin.command: "{{ ansible_env.HOME }}/.tmux/plugins/tpm/bin/update_plugins all"
17+
ansible.builtin.command: "{{ ansible_facts['env']['HOME'] }}/.tmux/plugins/tpm/bin/update_plugins all"
1818

19-
- name: "[Config][Tmuxp] Create directory in {{ ansible_env.HOME }}/.tmuxp"
19+
- name: "[Config][Tmuxp] Create directory in {{ ansible_facts['env']['HOME'] }}/.tmuxp"
2020
ansible.builtin.file:
21-
path: "{{ ansible_env.HOME }}/.tmuxp"
21+
path: "{{ ansible_facts['env']['HOME'] }}/.tmuxp"
2222
state: directory
2323
mode: '0755'
2424

25-
- name: "[Config][Tmuxp] Check for existing files in {{ ansible_env.HOME }}/.tmuxp"
25+
- name: "[Config][Tmuxp] Check for existing files in {{ ansible_facts['env']['HOME'] }}/.tmuxp"
2626
ansible.builtin.find:
27-
paths: "{{ ansible_env.HOME }}/.tmuxp"
27+
paths: "{{ ansible_facts['env']['HOME'] }}/.tmuxp"
2828
file_type: file
2929
recurse: no
3030
hidden: true
@@ -35,7 +35,7 @@
3535
vars:
3636
app: Tmuxp
3737
source_file: tmuxp-default.yaml
38-
target_file: "{{ ansible_env.HOME }}/.tmuxp/default_session.yaml"
38+
target_file: "{{ ansible_facts['env']['HOME'] }}/.tmuxp/default_session.yaml"
3939
ansible.builtin.include_role:
4040
name: common
4141
tasks_from: config_file.yml

ansible/roles/config/tasks/zsh.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- name: "[Config][ZSH] Get exact node version"
55
ansible.builtin.shell: |
66
set -e -o pipefail
7-
. {{ ansible_env.HOME }}/.local/opt/nvm/nvm.sh
7+
. {{ ansible_facts['env']['HOME'] }}/.local/opt/nvm/nvm.sh
88
nvm use {{ node_version | default('default') }} 2>&1 1>/dev/null
99
nvm list current | grep -Eo 'v[0-9]*\.[0-9]*\.[0-9]*'
1010
args:
@@ -16,7 +16,7 @@
1616
- name: "[Config][ZSH] Resolve EZA version for FPATH"
1717
ansible.builtin.shell: |
1818
set -e -o pipefail
19-
ls -1d {{ ansible_env.HOME }}/.local/opt/eza-* 2>/dev/null | sort -V | tail -1 | xargs -I{} basename {} | cut -d'-' -f2
19+
ls -1d {{ ansible_facts['env']['HOME'] }}/.local/opt/eza-* 2>/dev/null | sort -V | tail -1 | xargs -I{} basename {} | cut -d'-' -f2
2020
args:
2121
executable: /bin/bash
2222
changed_when: false
@@ -33,7 +33,7 @@
3333
vars:
3434
app: ZSH
3535
source_template: zshrc.j2
36-
target_file: "{{ ansible_env.HOME }}/.zshrc"
36+
target_file: "{{ ansible_facts['env']['HOME'] }}/.zshrc"
3737
ansible.builtin.include_role:
3838
name: common
3939
tasks_from: config_file.yml

ansible/roles/config/vars/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ git: # .gitconfig info
1010
config_tasks_exclude: []
1111

1212
# Path where to save configuration files
13-
config_backup_dir: "{{ ansible_env.HOME }}/.configs_backup"
13+
config_backup_dir: "{{ ansible_facts['env']['HOME'] }}/.configs_backup"
1414

1515
# Switch all config overwrites on/off
1616
config_files_overwrite: true
@@ -22,4 +22,4 @@ config_files_backup: true
2222
neovim_config_url: https://github.com/Ziwi01/astronvim.git
2323
neovim_config_version: main
2424
neovim_config_appname: astronvim
25-
neovim_config_path: "{{ ansible_env.HOME }}/.config/{{ neovim_config_appname }}"
25+
neovim_config_path: "{{ ansible_facts['env']['HOME'] }}/.config/{{ neovim_config_appname }}"

ansible/roles/software/tasks/ansible.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- name: "[Ansible] Get NPM version string"
88
ansible.builtin.shell: |
99
set -e -o pipefail
10-
source {{ ansible_env.HOME }}/.local/opt/nvm/nvm.sh || echo 'nvm.sh cannot be found in this directory'
10+
source {{ ansible_facts['env']['HOME'] }}/.local/opt/nvm/nvm.sh || echo 'nvm.sh cannot be found in this directory'
1111
nvm list current | grep -E 'v[0-9]*\.[0-9]*\.[0-9]*' -o || echo 'Cannot get current NVM version'
1212
changed_when: false
1313
args:
@@ -22,23 +22,23 @@
2222
args:
2323
executable: /bin/bash
2424
environment:
25-
PATH: "{{ ansible_env.HOME }}/.local/opt/nvm/versions/node/{{ npm_version.stdout }}/bin:{{ ansible_env.PATH }}"
25+
PATH: "{{ ansible_facts['env']['HOME'] }}/.local/opt/nvm/versions/node/{{ npm_version.stdout }}/bin:{{ ansible_env.PATH }}"
2626

2727
#
2828
# ansible-lint
2929
#
3030
- name: "[Ansible] Install Ansible PIP specific version"
3131
ansible.builtin.pip:
3232
name: "ansible=={{ ansible_pip_version }}"
33-
executable: "{{ ansible_env.HOME }}/.pyenv/shims/pip3"
33+
executable: "{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3"
3434
register: pip_out
3535
changed_when: "'Requirement already satisfied' not in pip_out.stdout"
3636
when: ansible_pip_version != 'latest'
3737

3838
- name: "[Ansible] Install Ansible PIP latest version"
3939
ansible.builtin.pip:
4040
name: "ansible"
41-
executable: "{{ ansible_env.HOME }}/.pyenv/shims/pip3"
41+
executable: "{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3"
4242
extra_args: --upgrade
4343
register: pip_out
4444
changed_when: "'Requirement already satisfied' not in pip_out.stdout"
@@ -47,7 +47,7 @@
4747
- name: "[Ansible] Get installed Ansible version from PIP"
4848
ansible.builtin.shell: |
4949
set -e -o pipefail
50-
{{ ansible_env.HOME }}/.pyenv/shims/pip3 show ansible | grep Version | awk '{print $2}'
50+
{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3 show ansible | grep Version | awk '{print $2}'
5151
changed_when: false
5252
args:
5353
executable: /bin/bash
@@ -73,22 +73,22 @@
7373
- name: "[Ansible] Install ansible-lint PIP specific version"
7474
ansible.builtin.pip:
7575
name: "ansible-lint=={{ ansible_lint_pip_version }}"
76-
executable: "{{ ansible_env.HOME }}/.pyenv/shims/pip3"
76+
executable: "{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3"
7777
register: pip_out
7878
changed_when: "'Requirement already satisfied' not in pip_out.stdout"
7979
when: ansible_lint_pip_version != 'latest'
8080

8181
- name: "[Ansible] Install ansible-lint PIP latest version"
8282
ansible.builtin.pip:
8383
name: "ansible-lint"
84-
executable: "{{ ansible_env.HOME }}/.pyenv/shims/pip3"
84+
executable: "{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3"
8585
extra_args: --upgrade
8686
register: pip_out
8787
changed_when: "'Requirement already satisfied' not in pip_out.stdout"
8888
when: ansible_lint_pip_version == 'latest'
8989

9090
- name: "[Ansible] Get installed Ansible version from PIP"
91-
ansible.builtin.shell: "set -e -o pipefail; {{ ansible_env.HOME }}/.pyenv/shims/pip3 show ansible-lint | grep Version | awk '{print $2}'"
91+
ansible.builtin.shell: "set -e -o pipefail; {{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3 show ansible-lint | grep Version | awk '{print $2}'"
9292
changed_when: false
9393
args:
9494
executable: /bin/bash

ansible/roles/software/tasks/awscli.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
force: true
99
mode: '0644'
1010

11-
- name: "[AWS CLI] Create installation directory in {{ ansible_env.HOME }}/.local/opt"
11+
- name: "[AWS CLI] Create installation directory in {{ ansible_facts['env']['HOME'] }}/.local/opt"
1212
ansible.builtin.file:
13-
path: "{{ ansible_env.HOME }}/.local/opt/awscli-install"
13+
path: "{{ ansible_facts['env']['HOME'] }}/.local/opt/awscli-install"
1414
state: directory
1515
mode: '0755'
1616

1717
- name: "[AWS CLI] Extract binary"
1818
ansible.builtin.unarchive:
1919
src: "/tmp/awscliv2.zip"
20-
dest: "{{ ansible_env.HOME }}/.local/opt/awscli-install"
20+
dest: "{{ ansible_facts['env']['HOME'] }}/.local/opt/awscli-install"
2121

2222
- name: "[AWS CLI] Install/update"
2323
ansible.builtin.shell: |
2424
set -e -o pipefail
25-
./aws/install --bin-dir {{ ansible_env.HOME }}/.local/bin --install-dir {{ ansible_env.HOME }}/.local/opt/aws-cli --update
25+
./aws/install --bin-dir {{ ansible_facts['env']['HOME'] }}/.local/bin --install-dir {{ ansible_facts['env']['HOME'] }}/.local/opt/aws-cli --update
2626
register: aws_install
2727
changed_when: aws_install.stdout is not regex('^Found same AWS CLI version:')
2828
args:
2929
executable: /bin/bash
30-
chdir: "{{ ansible_env.HOME }}/.local/opt/awscli-install"
30+
chdir: "{{ ansible_facts['env']['HOME'] }}/.local/opt/awscli-install"
3131

3232
- name: "[AWS CLI] Show install/update info"
3333
ansible.builtin.debug:
@@ -37,4 +37,4 @@
3737
ansible.builtin.pip:
3838
name: awscli
3939
state: absent
40-
executable: "{{ ansible_env.HOME }}/.pyenv/shims/pip3"
40+
executable: "{{ ansible_facts['env']['HOME'] }}/.pyenv/shims/pip3"

0 commit comments

Comments
 (0)