initial commit

This commit is contained in:
Ludovic Cartier 2024-12-17 17:30:08 +01:00
parent 138a75dbab
commit d82b98593f
2 changed files with 77 additions and 0 deletions

56
tasks/main.yml Normal file
View File

@ -0,0 +1,56 @@
---
- 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 }}"

View File

@ -0,0 +1,21 @@
# {{ ansible_managed }}
if [ "$EUID" -eq 0 ]; then
POWERLINE_HOSTNAME_BG="rouge"
POWERLINE_HOSTNAME_FG="blanc"
else
POWERLINE_HOSTNAME_BG="{{ powerline_hostname_bg | default('blanc') }}"
POWERLINE_HOSTNAME_FG="{{ powerline_hostname_fg | default('noir-fedora') }}"
fi
#{% if powerline_hostname_bg is defined %}
#POWERLINE_HOSTNAME_BG="{{ powerline_hostname_bg }}"
#{% endif %}
#{% if powerline_hostname_fg is defined %}
#POWERLINE_HOSTNAME_FG="{{ powerline_hostname_fg }}"
#{% endif %}
. ${HOME}/.config/powerline.bash
PROMPT_COMMAND='__update_ps1 $?'
POWERLINE_SEGMENTS="logo heure hostname pwd python git git_sync docker status jobs"