Added XDG and user SSH configuration tasks contingent on host inventory group
This commit is contained in:
@@ -25,11 +25,13 @@
|
|||||||
tasks_from: deshell
|
tasks_from: deshell
|
||||||
apply:
|
apply:
|
||||||
become: yes
|
become: yes
|
||||||
|
tags:
|
||||||
|
- default
|
||||||
- name: Create global bash aliases
|
- name: Create global bash aliases
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: files/all/bash/bash_aliases
|
src: files/all/bash/bash_aliases
|
||||||
dest: "/etc/bash_aliases"
|
dest: /etc/bash_aliases
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
follow: yes
|
follow: yes
|
||||||
@@ -37,11 +39,13 @@
|
|||||||
backup: yes
|
backup: yes
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
state: present
|
state: present
|
||||||
|
tags:
|
||||||
|
- default
|
||||||
- name: Create global bash functions
|
- name: Create global bash functions
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: files/all/bash/bash_functions
|
src: files/all/bash/bash_functions
|
||||||
dest: "/etc/bash_functions"
|
dest: /etc/bash_functions
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
follow: yes
|
follow: yes
|
||||||
@@ -49,6 +53,8 @@
|
|||||||
backup: yes
|
backup: yes
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
state: present
|
state: present
|
||||||
|
tags:
|
||||||
|
- default
|
||||||
- name: Register bash aliases and functions to global bashrc
|
- name: Register bash aliases and functions to global bashrc
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.blockinfile:
|
ansible.builtin.blockinfile:
|
||||||
@@ -60,7 +66,7 @@
|
|||||||
if [ -f /etc/bash_functions ]; then
|
if [ -f /etc/bash_functions ]; then
|
||||||
. /etc/bash_functions
|
. /etc/bash_functions
|
||||||
fi
|
fi
|
||||||
path: "/etc/bash.bashrc"
|
path: /etc/bash.bashrc
|
||||||
prepend_newline: yes
|
prepend_newline: yes
|
||||||
marker: "# {mark} ANSIBLE MANAGED SYSTEM-WIDE BASH ALIASES AND FUNCTIONS BLOCK"
|
marker: "# {mark} ANSIBLE MANAGED SYSTEM-WIDE BASH ALIASES AND FUNCTIONS BLOCK"
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
@@ -69,4 +75,82 @@
|
|||||||
group: root
|
group: root
|
||||||
backup: yes
|
backup: yes
|
||||||
state: present
|
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