Added XDG and user SSH configuration tasks contingent on host inventory group
This commit is contained in:
@@ -25,11 +25,13 @@
|
||||
tasks_from: deshell
|
||||
apply:
|
||||
become: yes
|
||||
tags:
|
||||
- default
|
||||
- name: Create global bash aliases
|
||||
become: yes
|
||||
ansible.builtin.copy:
|
||||
src: files/all/bash/bash_aliases
|
||||
dest: "/etc/bash_aliases"
|
||||
dest: /etc/bash_aliases
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
@@ -37,11 +39,13 @@
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- name: Create global bash functions
|
||||
become: yes
|
||||
ansible.builtin.copy:
|
||||
src: files/all/bash/bash_functions
|
||||
dest: "/etc/bash_functions"
|
||||
dest: /etc/bash_functions
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
@@ -49,6 +53,8 @@
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- name: Register bash aliases and functions to global bashrc
|
||||
become: yes
|
||||
ansible.builtin.blockinfile:
|
||||
@@ -60,7 +66,7 @@
|
||||
if [ -f /etc/bash_functions ]; then
|
||||
. /etc/bash_functions
|
||||
fi
|
||||
path: "/etc/bash.bashrc"
|
||||
path: /etc/bash.bashrc
|
||||
prepend_newline: yes
|
||||
marker: "# {mark} ANSIBLE MANAGED SYSTEM-WIDE BASH ALIASES AND FUNCTIONS BLOCK"
|
||||
insertafter: EOF
|
||||
@@ -69,4 +75,82 @@
|
||||
group: root
|
||||
backup: yes
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- name: Start XDG configuration tasks if in servers group
|
||||
when: "'servers' in group_names and ansible_connection != 'local'"
|
||||
become: yes
|
||||
block:
|
||||
- name: Create XDG user home directory environment variables
|
||||
ansible.builtin.copy:
|
||||
src: files/servers/xdg/user-dirs.defaults
|
||||
dest: /etc/xdg/user-dirs.defaults
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
force: yes
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
- name: Create XDG user home directory environment variables
|
||||
ansible.builtin.copy:
|
||||
src: "files/servers/{{ ansible_facts['user_id'] }}/xdg/user-dirs.dirs"
|
||||
dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs"
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
force: yes
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- servers_exclusive
|
||||
- name: Start XDG configuration tasks if in locals group
|
||||
when: "'locals' in group_names or ansible_connection == 'local'"
|
||||
become: yes
|
||||
block:
|
||||
- name: Create XDG user home directory environment variables
|
||||
ansible.builtin.copy:
|
||||
src: files/locals/xdg/user-dirs.defaults
|
||||
dest: /etc/xdg/user-dirs.defaults
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
force: yes
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
- name: Create XDG user home directory environment variables
|
||||
ansible.builtin.copy:
|
||||
src: "files/locals/{{ ansible_facts['user_id'] }}/xdg/user-dirs.dirs"
|
||||
dest: "{{ ansible_facts['user_dir'] }}/.config/user-dirs.dirs"
|
||||
owner: root
|
||||
group: root
|
||||
follow: yes
|
||||
force: yes
|
||||
backup: yes
|
||||
mode: "0644"
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- locals_exclusive
|
||||
- name: Start SSH configuration tasks if in locals group
|
||||
when: "'locals' in group_names or ansible_connection == 'local'"
|
||||
become: yes
|
||||
block:
|
||||
- name: Create user SSH configuration
|
||||
ansible.builtin.copy:
|
||||
src: "files/locals/ssh/{{ ansible_facts['user_id'] }}/config"
|
||||
dest: "{{ ansible_facts['user_dir'] }}/.ssh/config"
|
||||
follow: yes
|
||||
force: yes
|
||||
backup: yes
|
||||
owner: "{{ ansible_facts['user_id'] }}"
|
||||
group: "{{ ansible_facts['user_id'] }}"
|
||||
mode: "0600"
|
||||
state: present
|
||||
tags:
|
||||
- default
|
||||
- locals_exclusive
|
||||
|
Reference in New Issue
Block a user