initial commit
This commit is contained in:
		
							
								
								
									
										56
									
								
								tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								tasks/main.yml
									
									
									
									
									
										Normal 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 }}" | ||||
							
								
								
									
										21
									
								
								templates/powerline.custom.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								templates/powerline.custom.j2
									
									
									
									
									
										Normal 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" | ||||
		Reference in New Issue
	
	Block a user