Skip to content

Commit

Permalink
Update with support for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos committed Feb 8, 2022
1 parent a195129 commit f33bdf6
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@
user:
name: "{{ item.key }}"
shell: /bin/zsh
with_dict: "{{ __users__ | default({}) }}"
when: >
loop: "{{ __users__ | default({}) | dict2items }}"
when: >-
(ansible_os_family == 'RedHat' or ansible_os_family == 'Debian') and
(item.value.has_key('zsh_default_shell') and item.value.zsh_default_shell)
("zsh_default_shell" in item.value and item.value.zsh_default_shell)
- name: Generate ~.zshrc.
- name: Generate ~/.zshrc.
template:
mode: 0644
src: zshrc.j2
owner: "{{ item.key }}"
dest: "~{{ item.key }}/.zshrc"
with_dict: "{{ __users__ | default({}) }}"
loop: "{{ __users__ | default({}) | dict2items }}"
# loop_control:
# loop_var: user_shell

- name: Check for .zfunctions directory.
file:
state: directory
mode: 0755
owner: "{{ item.key }}"
dest: "~{{ item.key }}/.zfunctions"
with_dict: "{{ __users__ | default({}) }}"
loop: "{{ __users__ | default({}) | dict2items }}"

- name: Upload zfunctions files
copy:
Expand All @@ -49,9 +51,9 @@
directory_mode: yes
force: yes
mode: 0755
with_dict: "{{ __users__ | default({}) }}"
when: >
item.value.has_key('zsh_zfunctions_directory')
loop: "{{ __users__ | default({}) | dict2items }}"
when: >-
"zsh_zfunctions_directory" in item.value
- name: Download zsh prompt file.
get_url:
Expand All @@ -60,8 +62,9 @@
url: "{{ item.value.zsh_prompt_download_url | default(zsh_default_prompt_download_url) }}"
checksum: "{{ item.value.zsh_prompt_download_md5 | default(zsh_default_prompt_download_md5) }}"
dest: "~{{ item.key }}/.zfunctions/prompt_{{ item.value.zsh_prompt_name | default(zsh_default_prompt_name) }}_setup"
with_dict: "{{ __users__ | default({}) }}"
when: item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install
loop: "{{ __users__ | default({}) | dict2items }}"
when: >-
"zsh_prompt_install" in item.value and item.value.zsh_prompt_install
- name: Download zsh prompt additional file.
get_url:
Expand All @@ -70,10 +73,10 @@
url: "{{ item.value.zsh_prompt_additional_url }}"
checksum: "{{ item.value.zsh_prompt_additional_md5 | default(omit) }}"
dest: "~{{ item.key }}/.zfunctions/{{ zsh_prompt_additional_url | basename | replace('.zsh', '') }}"
with_dict: "{{ __users__ | default({}) }}"
when: >
item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install and
item.value.has_key('zsh_prompt_additional_url') and item.value.zsh_prompt_additional_url
loop: "{{ __users__ | default({}) | dict2items }}"
when: >-
"zsh_prompt_install" in item.value and item.value.zsh_prompt_install and
"zsh_prompt_additional_url" in item.value and item.value.zsh_prompt_additional_url
- name: Download zsh additional file if install default prompt.
get_url:
Expand All @@ -82,7 +85,7 @@
url: "{{ zsh_default_prompt_additional_url }}"
checksum: "{{ zsh_default_prompt_additional_md5 | default(omit) }}"
dest: "~{{ item.key }}/.zfunctions/{{ zsh_default_prompt_additional_url | basename | replace('.zsh', '') }}"
with_dict: "{{ __users__ | default({}) }}"
when: >
item.value.has_key('zsh_prompt_install') and item.value.zsh_prompt_install and not
item.value.has_key('zsh_prompt_name')
loop: "{{ __users__ | default({}) | dict2items }}"
when: >-
"zsh_prompt_install" in item.value and item.value.zsh_prompt_install and not
"zsh_prompt_name" in item.value

0 comments on commit f33bdf6

Please sign in to comment.