first commit
This commit is contained in:
54
roles/fish/tasks/main.yml
Normal file
54
roles/fish/tasks/main.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
|
||||
- debug:
|
||||
msg: "basic_{{ ansible_facts['distribution']| lower | replace( ' ', '-') }}.yml"
|
||||
|
||||
- name: Load system-specific parameters
|
||||
include_vars: >
|
||||
basic_{{ ansible_facts['distribution']| lower | replace( ' ', '-') }}.yml
|
||||
|
||||
- name: Update pacman mirrorlist on Archlinux
|
||||
command: pacman -Syy
|
||||
when: ansible_facts['distribution'] == "Archlinux"
|
||||
|
||||
- name: Install Packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- "{{ basic_packages }}"
|
||||
|
||||
- name: Gather user information
|
||||
ansible.builtin.getent:
|
||||
database: passwd
|
||||
|
||||
# - name: Get all users with bash or zsh shell
|
||||
# ansible.builtin.shell: |
|
||||
# awk -F: '$7 ~ /bash|zsh/ {print $1}' /etc/passwd
|
||||
# register: users_with_bash_zsh
|
||||
#
|
||||
# - name: Set Fish as default shell for each user
|
||||
# ansible.builtin.user:
|
||||
# name: "{{ item }}"
|
||||
# shell: "{{ fish_shell_path }}"
|
||||
# loop: "{{ users_with_bash_zsh.stdout_lines }}"
|
||||
|
||||
- name: Create a list of users with bash or zsh shell
|
||||
set_fact:
|
||||
my_users: "{{ ansible_facts.getent_passwd | dict2items | selectattr('value.5', 'in', ['/bin/bash', '/usr/bin/bash', '/bin/zsh', '/usr/bin/zsh']) | map(attribute='key') | list }}"
|
||||
|
||||
- name: Debug my_users
|
||||
debug:
|
||||
var: my_users
|
||||
|
||||
- name: Set Fish as default shell for each user
|
||||
ansible.builtin.user:
|
||||
name: "{{ item }}"
|
||||
shell: "{{ fish_shell_path }}"
|
||||
loop: "{{ my_users }}"
|
||||
|
||||
- name: Kopier Config File
|
||||
ansible.builtin.template:
|
||||
src: config.fish.j2
|
||||
dest: /etc/fish/config.fish
|
||||
|
||||
Reference in New Issue
Block a user