2024-12-17 17:30:08 +01:00

57 lines
1.5 KiB
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: powerline.bash | verify vars
assert:
that:
- powerline_bash_user is defined
- name: powerline.bash | get user info
getent:
database: passwd
#- debug:
# msg: "{{ item }}: homedir is {{ getent_passwd[item][4] }} & group is {{ getent_passwd[item][2] }}"
# with_items:
# - "{{ powerline_bash_user }}"
- name: powerline.bash | create config directory
file:
path: "{{ getent_passwd[item][4] }}/.config"
state: directory
owner: "{{ item }}"
group: "{{ getent_passwd[item][2] }}"
mode: '0755'
loop: "{{ powerline_bash_user }}"
- name: powerline.bash | get powerline.bash
get_url:
url: https://gitlab.com/bersace/powerline.bash/raw/master/powerline.bash
dest: "{{ getent_passwd[item][4] }}/.config/powerline.bash"
owner: "{{ item }}"
group: "{{ getent_passwd[item][2] }}"
force: yes
loop: "{{ powerline_bash_user }}"
- name: powerline.bash | create configuration file
template:
src: powerline.custom.j2
dest: "{{ getent_passwd[item][4] }}/.config/powerline.custom"
owner: "{{ item }}"
group: "{{ getent_passwd[item][2] }}"
mode: 0644
loop: "{{ powerline_bash_user }}"
- name: powerline.bash | append .bashrc
blockinfile:
path: "{{ getent_passwd[item][4] }}/.bashrc"
block: |
# enable powerline.bash
# https://gitlab.com/bersace/powerline.bash
if [ -f ~/.config/powerline.custom ]; then
. ~/.config/powerline.custom
fi
insertafter: EOF
backup: yes
validate: /bin/bash -n %s
loop: "{{ powerline_bash_user }}"