Skip to content

Commit

Permalink
fix ansible-lint failures
Browse files Browse the repository at this point in the history
- name[casing]: notify名のケースも警告されるようになった
- name[prefix]: 孫フォルダも警告されるようになった
  • Loading branch information
c18t committed May 17, 2024
1 parent 9cff465 commit 524675e
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- name: run pre-commit
uses: pre-commit/[email protected]
- name: run ansible-lint
uses: ansible/ansible-lint@v24.2.2
uses: ansible/ansible-lint@v24.5.0
env:
ANSIBLE_HOME: ./ansible
6 changes: 3 additions & 3 deletions ansible/playbooks/handlers/handlers_macos.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Restart Dock
listen: restart_dock
listen: RestartDock
ansible.builtin.command: killall 'Dock'
changed_when: true

- name: Restart Finder
listen: restart_finder
listen: RestartFinder
ansible.builtin.command: killall 'Finder'
changed_when: true

- name: Update global path
listen: update_global_path
listen: UpdateGlobalPath
# import_tasksにすると通知を受け取れなくなる
ansible.builtin.include_tasks: includes/set_global_path.yaml
2 changes: 1 addition & 1 deletion ansible/playbooks/handlers/handlers_wsl.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# update global path
- name: Update global path
listen: update_global_path
listen: UpdateGlobalPath
ansible.builtin.debug:
msg: I have nothing to do.
12 changes: 6 additions & 6 deletions ansible/roles/fish/tasks/includes/change_login_shell_macos.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
- name: change_login_shell_macos | Check user's login shell (for macOSX)
- name: includes | change_login_shell_macos | Check user's login shell (for macOSX)

Check warning on line 2 in ansible/roles/fish/tasks/includes/change_login_shell_macos.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check warning on line 2 in ansible/roles/fish/tasks/includes/change_login_shell_macos.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell: dscl . -read '/Users/{{ user }}' UserShell | grep -q '{{ fish_path }}'
register: check_fish_is_login_shell
failed_when: check_fish_is_login_shell.rc not in [0, 1]
changed_when: false
check_mode: false

- name: change_login_shell_macos | Change login shell to fish
- name: includes | change_login_shell_macos | Change login shell to fish
when: check_fish_is_login_shell.rc != 0
block:
- name: change_login_shell_macos | Find expect
- name: includes | change_login_shell_macos | Find expect
ansible.builtin.command: which expect
register: which_expect
changed_when: false

- name: change_login_shell_macos | Change login shell to fish
- name: includes | change_login_shell_macos | Change login shell to fish
become: true
ansible.builtin.script: common/chsh.exp "{{ fish_path }}" "{{ my_password }}" "{{ user }}"
args:
executable: '{{ which_expect.stdout }}'

- name: change_login_shell_macos | Read current UserShell
- name: includes | change_login_shell_macos | Read current UserShell
ansible.builtin.command: dscl . -read '/Users/{{ user }}' UserShell
register: recheck_fish_is_login_shell
changed_when: false
check_mode: false

- name: change_login_shell_macos | Recheck user's login shell
- name: includes | change_login_shell_macos | Recheck user's login shell

Check warning on line 29 in ansible/roles/fish/tasks/includes/change_login_shell_macos.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check warning on line 29 in ansible/roles/fish/tasks/includes/change_login_shell_macos.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell: >-
echo {{ recheck_fish_is_login_shell.stdout }}
| grep -q '{{ fish_path }}'
Expand Down
12 changes: 6 additions & 6 deletions ansible/roles/fish/tasks/includes/change_login_shell_other.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
- name: change_login_shell_other | Check user's login shell (for other)
- name: includes | change_login_shell_other | Check user's login shell (for other)

Check warning on line 2 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check warning on line 2 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell: cat /etc/passwd | grep -q '{{ home }}:{{ fish_path }}'
register: check_fish_is_login_shell
failed_when: check_fish_is_login_shell.rc not in [0, 1]
changed_when: false
check_mode: false

- name: change_login_shell_other | Change login shell to fish
- name: includes | change_login_shell_other | Change login shell to fish
when: check_fish_is_login_shell.rc != 0
block:
- name: change_login_shell_other | Find expect
- name: includes | change_login_shell_other | Find expect
ansible.builtin.command: which expect
register: which_expect
changed_when: false

- name: change_login_shell_other | Change login shell to fish
- name: includes | change_login_shell_other | Change login shell to fish
become: true
ansible.builtin.script: common/chsh.exp "{{ fish_path }}" "{{ my_password }}" "{{ user }}"
args:
executable: '{{ which_expect.stdout }}'

- name: change_login_shell_other | Read current usershell
- name: includes | change_login_shell_other | Read current usershell

Check warning on line 23 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check warning on line 23 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell: cat /etc/passwd | grep -e '^{{ user }}:'
register: recheck_fish_is_login_shell
changed_when: false
check_mode: false

- name: change_login_shell_other | Recheck user's login shell
- name: includes | change_login_shell_other | Recheck user's login shell

Check warning on line 29 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check warning on line 29 in ansible/roles/fish/tasks/includes/change_login_shell_other.yaml

View workflow job for this annotation

GitHub Actions / pre-commit

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell: >-
echo {{ recheck_fish_is_login_shell.stdout }}
| grep -q '{{ home }}:{{ fish_path }}'
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/fish/tasks/includes/set_brew_prefix.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: set_brew_prefix | Check Homebrew/Linuxbrew
- name: includes | set_brew_prefix | Check Homebrew/Linuxbrew
ansible.builtin.command: which brew
changed_when: false
check_mode: false

- name: set_brew_prefix | Get brew --prefix
- name: includes | set_brew_prefix | Get brew --prefix
ansible.builtin.command: brew --prefix
register: get_brew_prefix
changed_when: false
check_mode: false

- name: set_brew_prefix | Set Homebrew/Linuxbrew prefix
- name: includes | set_brew_prefix | Set Homebrew/Linuxbrew prefix
ansible.builtin.set_fact:
brew_prefix: '{{ get_brew_prefix.stdout }}'
8 changes: 4 additions & 4 deletions ansible/roles/fish/tasks/includes/set_env_macos.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: set_env_macos | Set environment variables (for MacOSX)
- name: includes | set_env_macos | Set environment variables (for MacOSX)
ansible.builtin.shell: >-
set -Ux ANDROID_HOME {{ home }}/Library/Android/sdk;
set -Ux ANDRIOD_SDK_ROOT {{ home }}/Library/Android/sdk;
Expand All @@ -8,18 +8,18 @@
executable: '{{ fish_path }}'
changed_when: false

- name: set_env_macos | Add tools to fish_user_paths (for MacOSX)
- name: includes | set_env_macos | Add tools to fish_user_paths (for MacOSX)
ansible.builtin.shell: set -U fish_user_paths $fish_user_paths "{{ item }}"
args:
executable: '{{ fish_path }}'
when: fish_user_paths is not search(item)
changed_when: true
notify: update_global_path
notify: UpdateGlobalPath
loop:
- '{{ home }}/Library/Android/sdk/tools'
- '{{ home }}/Library/Android/sdk/platform-tools'

- name: set_env_macos | Make PKG_CONFIG_PATH config (for MacOSX)
- name: includes | set_env_macos | Make PKG_CONFIG_PATH config (for MacOSX)
ansible.builtin.copy:
dest: '{{ xdg_config_home }}/fish/conf.d/{{ item }}.fish'
content: >
Expand Down
30 changes: 15 additions & 15 deletions ansible/roles/fish/tasks/includes/set_env_other.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
---
- name: set_env_other | Set_fact
- name: includes | set_env_other | Set_fact
block:
- name: set_env_other | Get brew prefix
- name: includes | set_env_other | Get brew prefix
ansible.builtin.import_tasks: includes/set_brew_prefix.yaml

- name: set_env_other | Echo LIBRARY_PATH (for other)
- name: includes | set_env_other | Echo LIBRARY_PATH (for other)
ansible.builtin.shell: echo $LIBRARY_PATH
args:
executable: '{{ fish_path }}'
register: echo_lib_path
changed_when: false
check_mode: false

- name: set_env_other | Echo LD_LIBRARY_PATH (for other)
- name: includes | set_env_other | Echo LD_LIBRARY_PATH (for other)
ansible.builtin.shell: echo $LD_LIBRARY_PATH
args:
executable: '{{ fish_path }}'
register: echo_ld_lib_path
changed_when: false
check_mode: false

- name: set_env_other | Echo C_INCLUDE_PATH (for other)
- name: includes | set_env_other | Echo C_INCLUDE_PATH (for other)
ansible.builtin.shell: echo $C_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
register: echo_c_include_path
changed_when: false
check_mode: false

- name: set_env_other | Echo CPLUS_INCLUDE_PATH (for other)
- name: includes | set_env_other | Echo CPLUS_INCLUDE_PATH (for other)
ansible.builtin.shell: echo $CPLUS_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
register: echo_cplus_include_path
changed_when: false
check_mode: false

- name: set_env_other | Echo OBJC_INCLUDE_PATH (for other)
- name: includes | set_env_other | Echo OBJC_INCLUDE_PATH (for other)
ansible.builtin.shell: echo $OBJC_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
register: echo_objc_include_path
changed_when: false
check_mode: false

- name: set_env_other | Set lib_path and include_path (for other)
- name: includes | set_env_other | Set lib_path and include_path (for other)
ansible.builtin.set_fact:
lib_path: '{{ echo_lib_path.stdout }}'
ld_lib_path: '{{ echo_ld_lib_path.stdout }}'
c_include_path: '{{ echo_c_include_path.stdout }}'
cplus_include_path: '{{ echo_cplus_include_path.stdout }}'
objc_include_path: '{{ echo_objc_include_path.stdout }}'

- name: set_env_other | Add Linuxbrew to LIBRARY_PATH (for other)
- name: includes | set_env_other | Add Linuxbrew to LIBRARY_PATH (for other)
ansible.builtin.shell: set -Ux LIBRARY_PATH "{{ item }}" $LIBRARY_PATH
args:
executable: '{{ fish_path }}'
Expand All @@ -62,7 +62,7 @@
- '{{ brew_prefix }}/lib'
- '/usr/lib/x86_64-linux-gnu' # linuxbrewのlibより先に読み込ませる(for curl)

- name: set_env_other | Add Linuxbrew to LD_LIBRARY_PATH (for other)
- name: includes | set_env_other | Add Linuxbrew to LD_LIBRARY_PATH (for other)
ansible.builtin.shell: set -Ux LD_LIBRARY_PATH "{{ item }}" $LD_LIBRARY_PATH
args:
executable: '{{ fish_path }}'
Expand All @@ -72,7 +72,7 @@
- '{{ brew_prefix }}/lib'
- '/usr/lib/x86_64-linux-gnu' # linuxbrewのlibより先に読み込ませる(for curl)

- name: set_env_other | Add Linuxbrew to C_INCLUDE_PATH (for other)
- name: includes | set_env_other | Add Linuxbrew to C_INCLUDE_PATH (for other)
ansible.builtin.shell: set -Ux C_INCLUDE_PATH "{{ item }}" $C_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
Expand All @@ -81,7 +81,7 @@
with_items:
- '{{ brew_prefix }}/include'

- name: set_env_other | Add Linuxbrew to CPLUS_INCLUDE_PATH (for other)
- name: includes | set_env_other | Add Linuxbrew to CPLUS_INCLUDE_PATH (for other)
ansible.builtin.shell: set -Ux CPLUS_INCLUDE_PATH "{{ item }}" $CPLUS_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
Expand All @@ -90,7 +90,7 @@
with_items:
- '{{ brew_prefix }}/include'

- name: set_env_other | Add Linuxbrew to OBJC_INCLUDE_PATH (for other)
- name: includes | set_env_other | Add Linuxbrew to OBJC_INCLUDE_PATH (for other)
ansible.builtin.shell: set -Ux OBJC_INCLUDE_PATH "{{ item }}" $OBJC_INCLUDE_PATH
args:
executable: '{{ fish_path }}'
Expand All @@ -99,7 +99,7 @@
with_items:
- '{{ brew_prefix }}/include'

- name: set_env_other | Make PKG_CONFIG_PATH config (for other)
- name: includes | set_env_other | Make PKG_CONFIG_PATH config (for other)
ansible.builtin.copy:
dest: '{{ xdg_config_home }}/fish/conf.d/{{ item }}.fish'
content: >
Expand All @@ -108,7 +108,7 @@
mode: 0644
with_items: []

- name: set_env_other | Add other PKG_CONFIG_PATH config (for other)
- name: includes | set_env_other | Add other PKG_CONFIG_PATH config (for other)
ansible.builtin.copy:
dest: '{{ xdg_config_home }}/fish/conf.d/{{ item.name }}.fish'
content: >
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/fish/tasks/includes/set_fish_path.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
- name: set_fish_path | Find fish
- name: includes | set_fish_path | Find fish
ansible.builtin.command: which fish
register: which_fish
changed_when: false
check_mode: false

- name: set_fish_path | Set fish_path
- name: includes | set_fish_path | Set fish_path
ansible.builtin.set_fact:
fish_path: '{{ which_fish.stdout }}'
4 changes: 2 additions & 2 deletions ansible/roles/fish/tasks/includes/set_fish_user_paths.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: set_fish_user_paths | Check fish_user_paths
- name: includes | set_fish_user_paths | Check fish_user_paths
ansible.builtin.shell: echo $fish_user_paths
args:
executable: '{{ fish_path }}'
register: check_fish_user_paths
changed_when: false
check_mode: false

- name: set_fish_user_paths | Set fish_user_paths
- name: includes | set_fish_user_paths | Set fish_user_paths
ansible.builtin.set_fact:
fish_user_paths: '{{ check_fish_user_paths.stdout }}'
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
- name: 10-make-directories-windows | Make standard directories
- name: includes | 10-make-directories-windows | Make standard directories
ansible.windows.win_file:
state: directory
path: '{{ home }}/{{ item }}'
loop: '{{ home_standard_directories }}'

- name: 10-make-directories-windows | Copy desktop.ini
- name: includes | 10-make-directories-windows | Copy desktop.ini
ansible.windows.win_copy:
src: '{{ item }}_desktop.ini'
dest: '{{ home }}\{{ item }}\desktop.ini'
loop: '{{ home_standard_directories }}'

- name: 10-make-directories-windows | Make config directories
- name: includes | 10-make-directories-windows | Make config directories
ansible.windows.win_file:
state: directory
path: '{{ item }}'
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/home/tasks/includes/10-make-directories.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: 10-make-directories | Make standard directories
- name: includes | 10-make-directories | Make standard directories
ansible.builtin.file:
state: directory
follow: true
path: '{{ home }}/{{ item }}'
mode: 0755
loop: '{{ home_standard_directories }}'

- name: 10-make-directories | Make config directories
- name: includes | 10-make-directories | Make config directories
ansible.builtin.file:
state: directory
follow: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: 11-make-symbolic-links-windows.wsl | Link to host google drive directory
- name: includes | 11-make-symbolic-links-windows.wsl | Link to host google drive directory
become: true
ansible.builtin.file:
state: link
Expand All @@ -9,5 +9,5 @@
src: '/mnt/g/マイドライブ'
dest: '{{ home }}/GoogleDrive'

- name: 11-make-symbolic-links-windows.wsl | Make symbolic links
- name: includes | 11-make-symbolic-links-windows.wsl | Make symbolic links
ansible.builtin.import_tasks: 11-make-symbolic-links.yaml
Loading

0 comments on commit 524675e

Please sign in to comment.