ansible-role--bashrc/tasks/task_scripts.yml

51 lines
1.1 KiB
YAML
Raw Normal View History

2021-12-28 11:45:51 +00:00
---
- name: List installable sh scripts
become: false
local_action:
module: ansible.builtin.shell
cmd: ls -1 "{{role_path}}/files/bashrc.d/"*.sh
register: bash_scripts
failed_when: bash_scripts.rc != 0
# changed_when: False
- name: Debug scripts
ansible.builtin.debug:
var: bash_scripts
- name: Debug users
ansible.builtin.debug:
var: bash_users
# tasks file for roles/glenux.bash
- name: Install main configuration files for bash
copy:
src: "{{item[1]}}"
dest: "~/.{{item[1]|basename}}"
mode: 0644
become: true
become_user: "{{item[0]}}"
with_nested:
- "{{bash_users}}"
- ['bashrc', 'bash_profile', 'bash_aliases']
- meta: end_host
- name: Create bashrc.d directory
file:
path: ~/.bashrc.d
state: directory
become: true
become_user: "{{item}}"
with_items: "{{bash_users}}"
- name: Install bashrc.d files
copy:
src: "{{item[1]}}"
dest: "~/.bashrc.d/{{item[1]|basename}}"
become: true
become_user: "{{item[0]}}"
with_nested:
- "{{bash_users}}"
- "{{bash_scripts.stdout_lines}}"