[CODE] add support for Centos + extend ArchLinux support

This commit is contained in:
Jannik Beyerstedt 2020-01-26 17:09:52 +01:00
parent 00c4c7eb96
commit c724080b34
10 changed files with 177 additions and 0 deletions

View file

@ -0,0 +1,16 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - ArchLinux Version
- name: essentials - Install essential utilities
become: yes
package:
name: "{{ packages }}"
state: present
vars:
packages:
- git
- curl
- wget
- zsh
- vim
- tmux

View file

@ -0,0 +1,15 @@
---
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh) - CentOS Version
- name: essentials - Install essential utilities
become: yes
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- git
- curl
- zsh
- vim
- tmux

15
tasks/tools-Archlinux.yml Normal file
View file

@ -0,0 +1,15 @@
---
# Common/Tools: Additional Tools (depending on OS) - ArchLinux Version
# (bind-tools includes dig)
- name: tools - Install basic utilities
become: yes
package:
name: "{{ packages }}"
state: present
vars:
packages:
- rsync
- bind-tools
- htop
- unzip

15
tasks/tools-Centos.yml Normal file
View file

@ -0,0 +1,15 @@
---
# Common/Tools: Additional Tools (depending on OS) - CentOS Version
# (bind-utils includes dig)
- name: tools - Install basic utilities
become: yes
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- rsync
- bind-utils
- htop
- unzip

9
tasks/update-Centos.yml Normal file
View file

@ -0,0 +1,9 @@
---
# Common/Update: Install All Updates - CentOS Version
- name: update - Update and upgrade all packages
become: yes
yum:
name: "*"
state: latest
update_cache: yes

View file

@ -6,3 +6,4 @@
with_first_found: with_first_found:
- "update-{{ ansible_distribution }}.yml" - "update-{{ ansible_distribution }}.yml"
- "update-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml" - "update-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
ignore_errors: true

View file

@ -0,0 +1,45 @@
---
# Common/Usersetup: Auto-setup a user shell and prepare dotfiles - ArchLinux Version
# Will run once per user, because of lockfile `~/.ansbl-common-usersetup`
- name: usersetup - Check, if usersetup already ran
stat:
path: .ansbl-common-usersetup
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
become: yes
user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
# TODO: adapt to ArchLinux systems, if needed
# - name: usersetup - Install locales package
# become: yes
# apt:
# name: locales
# state: present
# - name: usersetup - Setup locale en_US
# become: yes
# locale_gen:
# name: en_US.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
# - name: usersetup - Setup locale de_DE
# become: yes
# locale_gen:
# name: de_DE.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

View file

@ -0,0 +1,45 @@
---
# Common/Usersetup: Auto-setup a user shell and prepare dotfiles - CentOS Version
# Will run once per user, because of lockfile `~/.ansbl-common-usersetup`
- name: usersetup - Check, if usersetup already ran
stat:
path: .ansbl-common-usersetup
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
become: yes
user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
# TODO: adapt to CentOS/ RHEL systems, if needed
# - name: usersetup - Install locales package
# become: yes
# apt:
# name: locales
# state: present
# - name: usersetup - Setup locale en_US
# become: yes
# locale_gen:
# name: en_US.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
# - name: usersetup - Setup locale de_DE
# become: yes
# locale_gen:
# name: de_DE.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

View file

@ -2,6 +2,7 @@
# Common/Usertools: User's Main Machine/ Developer Tools - ArchLinux Version # Common/Usertools: User's Main Machine/ Developer Tools - ArchLinux Version
- name: usertools - Install user's working utilities - name: usertools - Install user's working utilities
become: yes
package: package:
name: "{{ packages }}" name: "{{ packages }}"
state: present state: present

View file

@ -0,0 +1,15 @@
---
# Common/Usertools: User's Main Machine/ Developer Tools - CentOS Version
- name: usertools - Install user's working utilities
become: yes
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- nmap
- rsync
- icdiff
- iftop
- ansible