You've already forked ansible-role-unix-users
							
							refac: use .yaml instead of .yml extension
This commit is contained in:
		
							
								
								
									
										30
									
								
								tasks/create_shell_rc_file.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								tasks/create_shell_rc_file.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
- name: "Determine shell rc directory"
 | 
			
		||||
  ansible.builtin.set_fact:
 | 
			
		||||
    # path_join examples: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/path_join_filter.html#examples
 | 
			
		||||
    _shell_rc_file: "{{ (user_user_home, '.bashrc.d', shell_rc_file.file) | path_join }}"
 | 
			
		||||
 | 
			
		||||
- name: "Create shell rc directory: {{ _shell_rc_file | dirname }}"
 | 
			
		||||
  ansible.builtin.file:
 | 
			
		||||
    path: "{{ _shell_rc_file | dirname }}"
 | 
			
		||||
    owner: "{{ unix_user.key }}"
 | 
			
		||||
    group: "{{ unix_user.value.group | default('users') }}"
 | 
			
		||||
    mode: "0755"
 | 
			
		||||
    state: "directory"
 | 
			
		||||
 | 
			
		||||
- name: "Create shell rc file: {{ _shell_rc_file }}"
 | 
			
		||||
  ansible.builtin.template:
 | 
			
		||||
    src: shell_rc_file.j2
 | 
			
		||||
    dest: "{{ _shell_rc_file }}"
 | 
			
		||||
    owner: "{{ unix_user.key }}"
 | 
			
		||||
    group: "{{ unix_user.value.group | default('users') }}"
 | 
			
		||||
    mode: "0644"
 | 
			
		||||
 | 
			
		||||
- name: "Source shell rc file: {{ _shell_rc_file }}"
 | 
			
		||||
  ansible.builtin.lineinfile:
 | 
			
		||||
    path: "{{ user_user_home }}/.bashrc"
 | 
			
		||||
    line: "source \"{{ _shell_rc_file }}\""
 | 
			
		||||
    owner: "{{ unix_user.key }}"
 | 
			
		||||
    group: "{{ unix_user.value.group | default('users') }}"
 | 
			
		||||
    state: "present"
 | 
			
		||||
		Reference in New Issue
	
	Block a user