Commit ecfb136e authored by Alanyalioglu, Cetin's avatar Alanyalioglu, Cetin 🐈
Browse files

First test

parent cb7e58e7
# Workstation configuration with CentOS 7
# An attempt to automate personal CentOS 8 workstation config
Go through the following steps to configure a CentOS 7 workstation.
### Install Ansible and packages required to install Ansible
## Structure
The way this setup is structured probably does not conform with ansible best practice suggestions. Enabling or disabling a feature is controlled via tags, no roles are defined.
## Steps to follow
* Start with a minimal CentOS 8 installation.
* Install ansible and dependencies
```
yum install epel-release
yum check-update
yum install ansible
yum install git
```
### Run ansible-pull
* Either run ansible-pull, which will make use of `local.yml`:
```
ansible-pull -U <repo-url> --checkout '<branch>'
ansible-pull -U <repo-url> --checkout '<branch>' --tags <tags>
```
### Items to add - notes
**Enable PowerTools for KDE**
```dnf config-manager --enable PowerTools```
bash-completion
dnf -y groupinstall kde-desktop
```systemctl set-default graphical.target```
```systemctl enable sddm -f```
dnf -y groupinstall "Development Tools"
mesa-libGL-devel
qt5-devel
extra-cmake-modules
kf5-kconfigwidgets-devel
kdecoration-devel
kf5-ki18n-devel
kf5-kguiaddons-devel
kf5-kwindowsystem-devel
### Plasma Configuration Saver
spectacle
kdialog
### Before customization
https://github.com/ishovkun/SierraBreeze
(kf5-devel libs should be installed beforehand)
### Latte dock
kf5-kactivities-devel
kf5-karchive-devel
kf5-kcrash-devel
kf5-kdeclarative-devel
kf5-kglobalaccel-devel
kf5-kiconthemes-devel
kf5-kio-devel
kf5-knewstuff-devel
kf5-knotifications-devel
kf5-plasma-devel
kf5-kwayland-devel
kf5-kdbusaddons-devel
xcb-util-devel
libSM-devel
app/view/contextmenu.h , add #include <QPointer>
https://github.com/KDE/latte-dock
### Chrome
dnf install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
### Install fira code
look git script
### Other packages
okular
(activate Raven repository to get Kmail)
kmail
korganizer
* Or clone the repository:
```
# ansible-playbook --tags <tags> playbook.yml
```
### TODO
fonts:
ms fonts
consolas
-- -*- lua -*-
help([[ anaconda3/2020.02]])
-- information
whatis("Name : anaconda3 2020.02, python 3.7.6")
whatis("Version : anaconda3 2020.02")
whatis("Category : compiler")
whatis("Description : python environment")
whatis("URL : http://www.continuum.io/ ")
whatis("Installed on : 15/07/2020")
-- family
family("python")
-- local variables
local version = "2020.02"
local base = "/opt/anaconda3/2020.02"
-- set environment
setenv("ANACONDA_ROOT",base)
prepend_path("PATH",pathJoin(base,"bin"))
-- source initialization script (sh or csh)
execute{cmd="source " .. base .. "/etc/profile.d/conda."..myShellType(),modeA={"load"}}
-- unload
if (myShellType() == "csh") then
cmd = "unsetenv CONDA_EXE; unsetenv _CONDA_ROOT; unsetenv _CONDA_EXE; " ..
"unsetenv CONDA_SHLVL; unalias conda"
execute{cmd=cmd, modeA={"unload"}}
end
if (myShellType() == "sh") then
-- bash sets environment variables, shell functions and path to condabin
if (mode() == "unload") then
remove_path("PATH", pathJoin(base,"condabin"))
end
cmd = "unset CONDA_EXE; unset _CE_CONDA; unset _CE_M; " ..
"unset -f __conda_activate; unset -f __conda_reactivate; " ..
"unset -f __conda_hashr; unset CONDA_SHLVL; unset _CONDA_EXE; " ..
"unset _CONDA_ROOT; unset -f conda"
execute{cmd=cmd, modeA={"unload"}}
end
-- messages
LmodMessage("Lmod: ", mode().."ing", myModuleName(), "/", myModuleVersion())
ansible ALL=(ALL) NOPASSWD: ALL
# Part of CentOS 8 workstation configuration automation files
- hosts: localhost
become: true
pre_tasks:
......@@ -6,12 +8,11 @@
changed_when: False
tasks:
- include: tasks/users.yml
- include: tasks/additional_repositories.yml
- include: tasks/install_kde.yml
- include: tasks/kde.yml
- include: tasks/packages.yml
- include: tasks/profile_settings.yml
- include: tasks/kde_customization.yml
- include: tasks/vim.yml
- include: tasks/anaconda.yml
- include: tasks/environment_modules.yml
- include: tasks/lmod.yml
# Part of CentOS 8 workstation configuration automation files
- hosts: all
become: true
pre_tasks:
- name: update_repositories
dnf: update_cache=yes
changed_when: False
tasks:
- include: tasks/additional_repositories.yml
- include: tasks/kde.yml
- include: tasks/packages.yml
- include: tasks/profile_settings.yml
- include: tasks/kde_customization.yml
- include: tasks/vim.yml
- include: tasks/anaconda.yml
- include: tasks/lmod.yml
# Enable additional software repositories
# Part of CentOS 8 workstation configuration automation files
- block:
......@@ -7,6 +8,11 @@
name: epel-release
state: latest
- name: Enable ELRepo Repository
dnf:
name: 'https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm'
state: latest
- name: Enable Raven Repository
dnf:
name: 'https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-1.el8.noarch.rpm'
......@@ -21,4 +27,4 @@
dest: '/etc/yum.repos.d/TurboVNC.repo'
tags:
- enable_repos
- enable_additional_repositories
# Installation of anaconda (system wide)
# System wide installation of anaconda3
# Part of CentOS 8 workstation configuration automation files
- block:
- name: check if installer already exists
- name: Presence check: anaconda3 installer
stat:
path: '/tmp/anaconda_installer.sh'
register: anaconda_installer_exists
- name: download installer
- name: Download: anaconda3 installer
get_url:
url: '{{ anaconda_installer_url }}'
dest: '/tmp/anaconda_installer.sh'
when: not anaconda_installer_exists.stat.exists
- name: install
- name: Installation check: anaconda3
stat:
path: '{{ anaconda_installation_path }}'
register: anaconda_installed
- name: Installation: anaconda3
shell: 'bash anaconda_installer.sh -b -p {{ anaconda_installation_path }}'
args:
chdir: '/tmp'
creates: '{{ anaconda_installation_path }}'
when: not anaconda_installed.stat.exists
tags:
- anaconda
vars:
anaconda_installer_url: 'https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh'
anaconda_installation_path: '/opt/anaconda'
anaconda_installation_path: '/opt/anaconda3/2020.02'
- name: install cron job (ansible-pull)
cron: user="ansible" name="ansible provision" minute="*/10" job="/usr/bin/ansible-pull -o -U https://github.com/m0rningl0rd/workstation-centos7.git --checkout 'dev' > /dev/null"
- name: Install KDE Plasma
dnf:
name: '@kde-desktop'
state: present
# Below item(s) do not work, need to execute manually
# - name: Enable KDE Plasma
# command: systemctl set-default graphical.target
# command: systemctl enable sddm -f
# Installation of KDE Plasma
# Part of CentOS 8 workstation configuration automation files
- name: Install KDE Plasma
dnf:
name: '@kde-desktop'
state: present
tags:
- kde
- name: Display information message
debug:
msg:
- 'Below commands should be executed manually:'
- 'systemctl set-default graphical.target'
- 'systemctl enable sddm -f'
tags:
-kde
# Stuff related to KDE customization
# Part of CentOS 8 workstation configuration automation files
# SierraBreeze icon set
- name: SierraBreezeEnhanced installation check
- name: Installation check: SierraBreezeEnhanced
stat:
path: '/usr/lib/libsierrabreezeenhancedcommon5.so.0'
register: sierra_breeze_installed
tags:
- test
- kde_customization
- block:
- name: clone repository
- name: Clone repository: SierraBreezeEnhanced
git:
repo: '{{ repo_name }}'
dest: '{{ tmp_dir }}'
update: yes
- name: create build directory
- name: Create build directory: SierraBreezeEnhanced
file:
path: '{{ tmp_dir }}/build'
state: directory
recurse: no
- name: cmake
- name: cmake: SierraBreezeEnhanced
shell: >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
......@@ -35,23 +35,22 @@
chdir: '{{ tmp_dir }}/build'
creates: '{{ tmp_dir }}/build/Makefile'
- name: make
- name: make: SierraBreezeEnhanced
make:
chdir: '{{ tmp_dir }}/build'
- name: install
- name: Installation: SierraBreezeEnhanced
make:
chdir: '{{ tmp_dir }}/build'
target: install
- name: cleanup
- name: Cleanup: SierraBreezeEnhanced
file:
path: '{{ tmp_dir }}'
state: absent
tags:
- kde_customization
- test
vars:
repo_name: 'https://github.com/m0rningl0rd/SierraBreezeEnhanced'
......@@ -60,42 +59,60 @@
when: not sierra_breeze_installed.stat.exists
# Latte Dock
# TODO: Execute only when produced libraries are not present
# TODO: Somehow log output of make & cmake commands
- name: Installation check: latte-dock
stat:
path: '/usr/bin/latte-dock'
register: latte_dock_installed
tags:
- kde_customization
- block:
- name: Clone repository
- name: Clone repository: latte-dock
git:
repo: https://github.com/{{ repo_name }}
dest: /tmp/{{ repo_name }}
repo: '{{ repo_name }}'
dest: '{{ tmp_dir }}'
update: yes
- name: Create build directory
- name: Create build directory: latte-dock
file:
path: /tmp/{{ repo_name }}/build
path: '{{ tmp_dir }}/build'
state: directory
recurse: no
- name: Build
command: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_L10N_AUTO_TRANSLATIONS=OFF
- name: cmake: latte-dock
shell: >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_BUILD_TYPE=Release
-DKDE_L10N_AUTO_TRANSLATIONS=OFF
args:
chdir: /tmp/{{ repo_name }}/build
chdir: '{{ tmp_dir }}/build'
- name: Install
command: make install
args:
chdir: /tmp/{{ repo_name }}/build
- name: make: latte-dock
make:
chdir: '{{ tmp_dir }}/build'
- name: Installation: latte-dock
make:
chdir: '{{ tmp_dir }}/build'
target: install
- name: Cleanup: latte-dock
file:
path: '{{ tmp_dir }}'
state: absent
tags:
- kde_customization
vars:
repo_name: m0rningl0rd/latte-dock
repo_name: 'https://github.com/m0rningl0rd/latte-dock'
tmp_dir: '/tmp/latte-dock'
# Fira fonts
# FiraCode font family
# TODO: Check if already installed, even though it is checked in the script
- name: Install Fira Code font family
become: yes
- name: Installation: FiraCode font family
shell: files/install-fira-fonts.sh
tags:
- kde_customization
......
# Environment modules
# TODO: Installation detection
# Lua
- block:
- name: download
get_url:
url: https://sourceforge.net/projects/lmod/files/lua-{{ lua_version }}.tar.bz2
dest: /tmp/lua-{{ lua_version }}.tar.bz2
- name: extract
unarchive:
src: /tmp/lua-{{ lua_version }}.tar.bz2
dest: /tmp/
- name: configure
shell: ./configure --prefix={{ lua_prefix }}
args:
chdir: /tmp/lua-{{ lua_version }}
creates: config.log
- name: make
make:
chdir: /tmp/lua-{{ lua_version }}
- name: install
make:
chdir: /tmp/lua-{{ lua_version }}
target: install
# Lmod environment management
# Part of CentOS 8 workstation configuration automation files
- name: Installation check: Lmod
stat:
path: '/opt/lmod/lmod'
register: lmod_installed
tags:
- lua
vars:
lua_version: 5.1.4.9
lua_prefix: /opt/lua/{{ lua_version }}
- lmod
# Lmod
- block:
- name: clone repository
- name: Clone repository: Lmod
git:
repo: https://github.com/{{ repo_name }}
dest: /tmp/{{ repo_name }}
repo: '{{ repo_name }}'
dest: '{{ tmp_dir }}'
update: yes
- name: configure
- name: Configure: Lmod
shell: >
./configure
--prefix={{ lmod_prefix }}
......@@ -53,35 +24,61 @@
--with-spiderCacheDir={{ lmod_spider_cache_dir }}
--with-updateSystemFn={{ lmod_spider_cache_stamp }}
args:
chdir: /tmp/{{ repo_name }}
creates: config.log
chdir: '{{ tmp_dir }}'
creates: 'config.log'
- name: make
- name: make: Lmod
make:
chdir: /tmp/{{ repo_name }}
chdir: '{{ tmp_dir }}'
- name: install
- name: Installation: Lmod
make:
chdir: /tmp/{{ repo_name }}
chdir: '{{ tmp_dir }}'
target: install
- name: create bash profile link
- name: Link: Lmod bash profile
file:
src: '{{ lmod_prefix }}/lmod/lmod/init/profile'
dest: '/etc/profile.d/z00_lmod.sh'
state: link
- name: create zsh profile link
- name: Link: Lmod zsh profile
file:
src: '{{ lmod_prefix }}/lmod/lmod/init/cshrc'
dest: '/etc/profile.d/z00_lmod.csh'
state: link
- name: Create modulefiles directory
file:
path: '{{ lmod_modules_root }}'
state: directory
owner: root
group: root
mode: '0755'
- name: Setup .modulespath file
shell: 'echo {{ lmod_modules_root }} >> {{ lmod_prefix }}/lmod/lmod/init/.modulespath'
args:
creates: '{{ lmod_prefix }}/lmod/lmod/init/.modulespath'
- name: File permissions: .modulespath
file:
path: '{{ lmod_prefix }}/lmod/lmod/init/.modulespath'
owner: root
group: root
mode: '0644'
- name: Cleanup: Lmod
file:
path: '{{ tmp_dir }}'
state: absent
tags:
- lmod
vars:
repo_name: 'TACC/Lmod'
repo_name: 'https://github.com/TACC/Lmod'
tmp_dir: '/tmp/lmod'
lmod_prefix: '/opt'
lmod_modules_root: '/opt/modules'
lmod_spider_cache_dir: '{{ lmod_modules_root }}/.spider-cache'
......
# Install required packages
# Part of CentOS 8 workstation configuration automation files
- name: install packages
tags:
- packages
......@@ -6,6 +9,7 @@
- '@Development Tools'
- htop
- tmux
- git
- glibc-all-langpacks
- bash-completion
- mesa-libGL-devel
......@@ -74,5 +78,29 @@
- perl-ExtUtils-Embed
- turbovnc
- fuse-sshfs
- glibc.i686
- glib2.i686
- bzip2-libs.i686
- libpng.i686
- libtiff.i686
- libXft.i686
- libXxf86vm.i686
- sssd-client.i686
- libpng12
- libpng12.i686
- libXp
- libXp.i686
- openmotif
- zlib
- redhat-lsb
- compat-libtiff3
- xorg-x11-fonts-cyrillic
- xorg-x11-fonts-ISO8859-1-75dpi
- xterm
- libstdc++.i686
- libstdc++-devel.i686
- gtk2.i686
- libSM.i686
- libXt.i686
state: present
update_cache: True
# Modifications in /etc/profile.d
# Part of CentOS 8 workstation configuration automation files
# JAVA
# TODO: The java version name is hradcoded in java.sh, needs care
- name: java profile installation check
# java
# TODO: The java path is hardcoded in java.sh, needs care
- name: Installation check: /etc/profile.d/java.sh
stat:
path: '/etc/profile.d/java.sh'
register: java_profile_installed
tags:
- profile_settings
- name: show information
- name: Show information
debug:
msg: '{% if java_profile_installed.stat.exists %} Java profile already installed. {% else %} Java profile not installed, proceeding with installation.. {% endif %}'
tags:
- profile_settings
- name: java profile
- name: Installation: /etc/profile.d/java.sh
copy: src=files/java.sh dest=/etc/profile.d/java.sh
when: not java_profile_installed.stat.exists
tags:
......
- name: create ansible user
user: name=ansible uid=900
- name: copy sudoers ansible
copy: src=files/sudoers_ansible dest=/etc/sudoers.d/ansible owner=root group=root mode=0440