--- - 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 }}"