From 67c0e448276e46fafd47db73dfc0031786a18dc0 Mon Sep 17 00:00:00 2001 From: binary Date: Mon, 2 Nov 2020 13:20:53 +0100 Subject: Refactor utils and hostname to common role --- roles/common/tasks/main.yml | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 roles/common/tasks/main.yml (limited to 'roles/common/tasks/main.yml') diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..7dbc5dd --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,52 @@ + +# common ~~ tasks/main.yml + +--- + +- name: Check installation of package "{{ item }}" + become: yes + + package: + name: "{{ item }}" + state: present + + loop: + - "{{ packages.zsh }}" + - "{{ packages.curl }}" + - "{{ packages.tmux }}" + - "{{ packages.wget }}" + - "{{ packages.figlet }}" + - "{{ packages.neovim }}" + + ignore_errors: yes + + +- name: Copy zshrc configuration file + copy: + src: zshrc + dest: /etc/zshrc + owner: root + group: "{{ group.root }}" + mode: 0644 + +- name: Copy tmux configuration file + copy: + src: tmux.conf + dest: /etc/tmux.conf + owner: root + group: "{{ group.root }}" + mode: 0644 + +- name: Synchronize host hostname with config hostname + hostname: + name: "{{ inventory_hostname }}" + +- name: Retrieve all valid users for zsh + shell: awk -F ":" '{ if($3 > 999 && $3 < 16000) { print $1 }}' /etc/passwd + register: valid_users_shell + +- name: Change shell for all valid users to zsh + user: + name: "{{ item }}" + shell: "{{ path_zsh_bin }}" + loop: "{{ valid_users_shell.stdout_lines }}" -- cgit v1.2.3