Skip to content
Snippets Groups Projects
Commit ecfb136e authored by Alanyalioglu, Cetin's avatar Alanyalioglu, Cetin :cat2:
Browse files

First test

parent cb7e58e7
Branches dev
No related tags found
1 merge request!1Merging with master
# 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. 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 install epel-release
yum check-update yum check-update
yum install ansible 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 * Or clone the repository:
**Enable PowerTools for KDE** ```
```dnf config-manager --enable PowerTools``` # ansible-playbook --tags <tags> playbook.yml
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
### 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 - hosts: localhost
become: true become: true
pre_tasks: pre_tasks:
...@@ -6,12 +8,11 @@ ...@@ -6,12 +8,11 @@
changed_when: False changed_when: False
tasks: tasks:
- include: tasks/users.yml
- include: tasks/additional_repositories.yml - include: tasks/additional_repositories.yml
- include: tasks/install_kde.yml - include: tasks/kde.yml
- include: tasks/packages.yml - include: tasks/packages.yml
- include: tasks/profile_settings.yml - include: tasks/profile_settings.yml
- include: tasks/kde_customization.yml - include: tasks/kde_customization.yml
- include: tasks/vim.yml - include: tasks/vim.yml
- include: tasks/anaconda.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 # Enable additional software repositories
# Part of CentOS 8 workstation configuration automation files
- block: - block:
...@@ -7,6 +8,11 @@ ...@@ -7,6 +8,11 @@
name: epel-release name: epel-release
state: latest 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 - name: Enable Raven Repository
dnf: dnf:
name: 'https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-1.el8.noarch.rpm' name: 'https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-1.el8.noarch.rpm'
...@@ -21,4 +27,4 @@ ...@@ -21,4 +27,4 @@
dest: '/etc/yum.repos.d/TurboVNC.repo' dest: '/etc/yum.repos.d/TurboVNC.repo'
tags: 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: - block:
- name: check if installer already exists - name: Presence check: anaconda3 installer
stat: stat:
path: '/tmp/anaconda_installer.sh' path: '/tmp/anaconda_installer.sh'
register: anaconda_installer_exists register: anaconda_installer_exists
- name: download installer - name: Download: anaconda3 installer
get_url: get_url:
url: '{{ anaconda_installer_url }}' url: '{{ anaconda_installer_url }}'
dest: '/tmp/anaconda_installer.sh' dest: '/tmp/anaconda_installer.sh'
when: not anaconda_installer_exists.stat.exists 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 }}' shell: 'bash anaconda_installer.sh -b -p {{ anaconda_installation_path }}'
args: args:
chdir: '/tmp' chdir: '/tmp'
creates: '{{ anaconda_installation_path }}' creates: '{{ anaconda_installation_path }}'
when: not anaconda_installed.stat.exists
tags: tags:
- anaconda - anaconda
vars: vars:
anaconda_installer_url: 'https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh' 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 # Stuff related to KDE customization
# Part of CentOS 8 workstation configuration automation files
# SierraBreeze icon set # SierraBreeze icon set
- name: SierraBreezeEnhanced installation check - name: Installation check: SierraBreezeEnhanced
stat: stat:
path: '/usr/lib/libsierrabreezeenhancedcommon5.so.0' path: '/usr/lib/libsierrabreezeenhancedcommon5.so.0'
register: sierra_breeze_installed register: sierra_breeze_installed
tags: tags:
- test
- kde_customization - kde_customization
- block: - block:
- name: clone repository - name: Clone repository: SierraBreezeEnhanced
git: git:
repo: '{{ repo_name }}' repo: '{{ repo_name }}'
dest: '{{ tmp_dir }}' dest: '{{ tmp_dir }}'
update: yes update: yes
- name: create build directory - name: Create build directory: SierraBreezeEnhanced
file: file:
path: '{{ tmp_dir }}/build' path: '{{ tmp_dir }}/build'
state: directory state: directory
recurse: no recurse: no
- name: cmake - name: cmake: SierraBreezeEnhanced
shell: > shell: >
cmake .. cmake ..
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_PREFIX=/usr
...@@ -35,23 +35,22 @@ ...@@ -35,23 +35,22 @@
chdir: '{{ tmp_dir }}/build' chdir: '{{ tmp_dir }}/build'
creates: '{{ tmp_dir }}/build/Makefile' creates: '{{ tmp_dir }}/build/Makefile'
- name: make - name: make: SierraBreezeEnhanced
make: make:
chdir: '{{ tmp_dir }}/build' chdir: '{{ tmp_dir }}/build'
- name: install - name: Installation: SierraBreezeEnhanced
make: make:
chdir: '{{ tmp_dir }}/build' chdir: '{{ tmp_dir }}/build'
target: install target: install
- name: cleanup - name: Cleanup: SierraBreezeEnhanced
file: file:
path: '{{ tmp_dir }}' path: '{{ tmp_dir }}'
state: absent state: absent
tags: tags:
- kde_customization - kde_customization
- test
vars: vars:
repo_name: 'https://github.com/m0rningl0rd/SierraBreezeEnhanced' repo_name: 'https://github.com/m0rningl0rd/SierraBreezeEnhanced'
...@@ -60,42 +59,60 @@ ...@@ -60,42 +59,60 @@
when: not sierra_breeze_installed.stat.exists when: not sierra_breeze_installed.stat.exists
# Latte Dock # Latte Dock
# TODO: Execute only when produced libraries are not present - name: Installation check: latte-dock
# TODO: Somehow log output of make & cmake commands stat:
path: '/usr/bin/latte-dock'
register: latte_dock_installed
tags:
- kde_customization
- block: - block:
- name: Clone repository - name: Clone repository: latte-dock
git: git:
repo: https://github.com/{{ repo_name }} repo: '{{ repo_name }}'
dest: /tmp/{{ repo_name }} dest: '{{ tmp_dir }}'
update: yes update: yes
- name: Create build directory - name: Create build directory: latte-dock
file: file:
path: /tmp/{{ repo_name }}/build path: '{{ tmp_dir }}/build'
state: directory state: directory
recurse: no recurse: no
- name: Build - name: cmake: latte-dock
command: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_L10N_AUTO_TRANSLATIONS=OFF shell: >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_BUILD_TYPE=Release
-DKDE_L10N_AUTO_TRANSLATIONS=OFF
args: args:
chdir: /tmp/{{ repo_name }}/build chdir: '{{ tmp_dir }}/build'
- name: Install - name: make: latte-dock
command: make install make:
args: chdir: '{{ tmp_dir }}/build'
chdir: /tmp/{{ repo_name }}/build
- name: Installation: latte-dock
make:
chdir: '{{ tmp_dir }}/build'
target: install
- name: Cleanup: latte-dock
file:
path: '{{ tmp_dir }}'
state: absent
tags: tags:
- kde_customization - kde_customization
vars: 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 # TODO: Check if already installed, even though it is checked in the script
- name: Install Fira Code font family - name: Installation: FiraCode font family
become: yes
shell: files/install-fira-fonts.sh shell: files/install-fira-fonts.sh
tags: tags:
- kde_customization - kde_customization
......
# Environment modules # Lmod environment management
# TODO: Installation detection # Part of CentOS 8 workstation configuration automation files
# 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
- name: Installation check: Lmod
stat:
path: '/opt/lmod/lmod'
register: lmod_installed
tags: tags:
- lua - lmod
vars:
lua_version: 5.1.4.9
lua_prefix: /opt/lua/{{ lua_version }}
# Lmod
- block: - block:
- name: clone repository - name: Clone repository: Lmod
git: git:
repo: https://github.com/{{ repo_name }} repo: '{{ repo_name }}'
dest: /tmp/{{ repo_name }} dest: '{{ tmp_dir }}'
update: yes update: yes
- name: configure - name: Configure: Lmod
shell: > shell: >
./configure ./configure
--prefix={{ lmod_prefix }} --prefix={{ lmod_prefix }}
...@@ -53,35 +24,61 @@ ...@@ -53,35 +24,61 @@
--with-spiderCacheDir={{ lmod_spider_cache_dir }} --with-spiderCacheDir={{ lmod_spider_cache_dir }}
--with-updateSystemFn={{ lmod_spider_cache_stamp }} --with-updateSystemFn={{ lmod_spider_cache_stamp }}
args: args:
chdir: /tmp/{{ repo_name }} chdir: '{{ tmp_dir }}'
creates: config.log creates: 'config.log'
- name: make - name: make: Lmod
make: make:
chdir: /tmp/{{ repo_name }} chdir: '{{ tmp_dir }}'
- name: install - name: Installation: Lmod
make: make:
chdir: /tmp/{{ repo_name }} chdir: '{{ tmp_dir }}'
target: install target: install
- name: create bash profile link - name: Link: Lmod bash profile
file: file:
src: '{{ lmod_prefix }}/lmod/lmod/init/profile' src: '{{ lmod_prefix }}/lmod/lmod/init/profile'
dest: '/etc/profile.d/z00_lmod.sh' dest: '/etc/profile.d/z00_lmod.sh'
state: link state: link
- name: create zsh profile link - name: Link: Lmod zsh profile
file: file:
src: '{{ lmod_prefix }}/lmod/lmod/init/cshrc' src: '{{ lmod_prefix }}/lmod/lmod/init/cshrc'
dest: '/etc/profile.d/z00_lmod.csh' dest: '/etc/profile.d/z00_lmod.csh'
state: link 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: tags:
- lmod - lmod
vars: vars:
repo_name: 'TACC/Lmod' repo_name: 'https://github.com/TACC/Lmod'
tmp_dir: '/tmp/lmod'
lmod_prefix: '/opt' lmod_prefix: '/opt'
lmod_modules_root: '/opt/modules' lmod_modules_root: '/opt/modules'
lmod_spider_cache_dir: '{{ lmod_modules_root }}/.spider-cache' lmod_spider_cache_dir: '{{ lmod_modules_root }}/.spider-cache'
......
# Install required packages
# Part of CentOS 8 workstation configuration automation files
- name: install packages - name: install packages
tags: tags:
- packages - packages
...@@ -6,6 +9,7 @@ ...@@ -6,6 +9,7 @@
- '@Development Tools' - '@Development Tools'
- htop - htop
- tmux - tmux
- git
- glibc-all-langpacks - glibc-all-langpacks
- bash-completion - bash-completion
- mesa-libGL-devel - mesa-libGL-devel
...@@ -74,5 +78,29 @@ ...@@ -74,5 +78,29 @@
- perl-ExtUtils-Embed - perl-ExtUtils-Embed
- turbovnc - turbovnc
- fuse-sshfs - 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 state: present
update_cache: True update_cache: True
# Modifications in /etc/profile.d # Modifications in /etc/profile.d
# Part of CentOS 8 workstation configuration automation files
# JAVA # java
# TODO: The java version name is hradcoded in java.sh, needs care # TODO: The java path is hardcoded in java.sh, needs care
- name: java profile installation check - name: Installation check: /etc/profile.d/java.sh
stat: stat:
path: '/etc/profile.d/java.sh' path: '/etc/profile.d/java.sh'
register: java_profile_installed register: java_profile_installed
tags: tags:
- profile_settings - profile_settings
- name: show information - name: Show information
debug: debug:
msg: '{% if java_profile_installed.stat.exists %} Java profile already installed. {% else %} Java profile not installed, proceeding with installation.. {% endif %}' msg: '{% if java_profile_installed.stat.exists %} Java profile already installed. {% else %} Java profile not installed, proceeding with installation.. {% endif %}'
tags: tags:
- profile_settings - profile_settings
- name: java profile - name: Installation: /etc/profile.d/java.sh
copy: src=files/java.sh dest=/etc/profile.d/java.sh copy: src=files/java.sh dest=/etc/profile.d/java.sh
when: not java_profile_installed.stat.exists when: not java_profile_installed.stat.exists
tags: 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
# Build and install latest release of vim from official repository # Build and install latest release of vim from official repository
# Part of CentOS 8 workstation configuration automation files
- name: Installation check: vim
stat:
path: '/usr/local/bin/vim'
register: vim_installed
tags:
- vim
- block: - block:
- name: clone repository - name: Clone repository: vim
git: git:
repo: '{{ repo_name }}' repo: '{{ repo_name }}'
dest: '{{ tmp_dir }}' dest: '{{ tmp_dir }}'
update: yes update: yes
# First command was required to fix missing configure features related to rubyinterp # First command was required to fix missing configure features related to rubyinterp
- name: configure - name: Configure: vim
shell: > shell: >
eval $(rpmbuild --eval '%{configure}' | egrep '^\s*[A-Z]+=') && eval $(rpmbuild --eval '%{configure}' | egrep '^\s*[A-Z]+=') &&
./configure ./configure
...@@ -23,18 +31,18 @@ ...@@ -23,18 +31,18 @@
--enable-tclinterp --enable-tclinterp
args: args:
chdir: '{{ tmp_dir }}' chdir: '{{ tmp_dir }}'
creates: src/auto/config.log creates: 'src/auto/config.log'
- name: make - name: make: vim
make: make:
chdir: '{{ tmp_dir }}' chdir: '{{ tmp_dir }}'
- name: install - name: Installation: vim
make: make:
chdir: '{{ tmp_dir }}' chdir: '{{ tmp_dir }}'
target: install target: install
- name: cleanup - name: Cleanup: vim
file: file:
path: '{{ tmp_dir }}' path: '{{ tmp_dir }}'
state: absent state: absent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment