Compare commits

...

79 Commits
main ... dev

Author SHA1 Message Date
7c3b19022d Fixed ret-val 2024-08-29 14:57:10 +02:00
4be52afb90 add date and hour 2024-07-02 07:36:31 +02:00
b1e35f08ba add php83 2024-07-01 17:01:50 +02:00
bd56a9402c rename script file 2024-07-01 16:32:08 +02:00
9108ca7a91 fix hostname problem 2024-07-01 16:29:33 +02:00
83c3c1b9b3 add host_domain 2024-07-01 15:42:04 +02:00
dd4f3497b8 change domain gmetech to gmotech and remove issue 2024-07-01 15:39:48 +02:00
5be1a4821f fqdn first and hostname 2024-07-01 14:41:03 +02:00
e8b5dd8060 change ntp server pool 2024-07-01 06:51:58 +02:00
aa8ed2bd0c fix mail_domain 2024-06-30 14:39:32 +02:00
c8248c97cc fix chrony conf 2024-06-30 14:32:53 +02:00
206bdf2f23 fix chrony ipv6 2024-06-30 14:24:37 +02:00
a259ce14a0 fix chrony config 2024-06-30 14:15:52 +02:00
259e3e23c0 fix cron file 2024-06-29 16:21:37 +02:00
fae5f0a036 fix inst-raps.sh 2024-06-29 16:14:03 +02:00
5f62d66005 add somes gmotools 2024-06-29 16:13:22 +02:00
74746016fc fix inst-rasp.sh 2024-06-29 15:59:34 +02:00
0b2c7e3ed8 add cleanup 2024-06-29 15:52:26 +02:00
e3b2807b6a fix inst-rasp.sh 2024-06-29 15:06:06 +02:00
5d321ed187 add updates hosts clone 2024-06-29 15:02:38 +02:00
c871e1d3c8 fix create gilles user 2024-06-23 08:29:37 +02:00
075f363cd5 add gilles user 2024-06-23 08:28:12 +02:00
8ea23aec15 move handlers into main.yml file 2024-06-23 08:08:53 +02:00
c28df97cc1 add remove userdir.conf 2024-06-23 08:03:55 +02:00
e65d4e049c add handlers 2024-06-23 07:53:01 +02:00
cb86aca658 install apache not from apache role 2024-06-23 07:39:43 +02:00
82ba012b73 fix error 2024-06-22 11:21:20 +02:00
30566378d0 install apache 2024-06-22 11:17:36 +02:00
b1a33ebbec add clean up 2024-06-22 11:12:17 +02:00
e13b8c9a48 add yum-update script 2024-06-16 18:54:48 +02:00
d9eba4c710 add yum-update script 2024-06-16 18:36:17 +02:00
e746fced5e add netdata 2024-06-09 18:53:40 +02:00
b20f663f2c fix indentation 2024-06-09 18:48:30 +02:00
1b9d54ae8b fix param hostname 2024-06-09 18:46:33 +02:00
f35d64b9e1 add yum-check 2024-06-09 18:43:04 +02:00
01339f2a2b add postfix 2024-06-02 13:41:49 +02:00
35f5340ffd add postfix 2024-06-02 13:40:34 +02:00
fc49b4de6f add postfix 2024-06-02 13:39:31 +02:00
7f7f7f1541 update 2024-06-02 12:27:39 +02:00
f64840e5f1 change issue.net 2024-06-01 10:22:20 +02:00
6a9a4b9380 update info 2024-06-01 10:18:59 +02:00
db9ddb634c change info to display 2024-06-01 10:17:52 +02:00
a373e5cd83 add README 2024-06-01 10:15:47 +02:00
9ba0ab95d7 conf chrony 2024-06-01 10:04:43 +02:00
e6b2e7872a install chrony 2024-06-01 09:37:46 +02:00
b1eaf8d809 remove motd 2024-06-01 09:21:14 +02:00
b20224c084 change gmo-cfg.sh 2024-06-01 09:21:00 +02:00
c0c2e4200a change gmo-cfg.sh 2024-05-26 19:08:14 +02:00
b2bdfa589f change gmo-cfg.sh 2024-05-26 19:06:05 +02:00
e5fe3b504b add misc 2024-05-22 18:15:20 +02:00
c0f5e78b3a run #7 2024-05-22 18:11:51 +02:00
5d0e7a9586 run #6 2024-05-22 18:04:50 +02:00
947ae0e444 run #5 2024-05-22 18:04:00 +02:00
04981febe6 run #4 2024-05-22 17:47:20 +02:00
e1642737f1 rune #3 2024-05-22 17:45:48 +02:00
06fa9a3403 install package 2024-05-22 17:44:45 +02:00
2cdfcb5ae7 add disable ipv2 2024-05-22 17:39:05 +02:00
c83850bb09 run #2 2024-05-22 17:29:38 +02:00
07a48f4f1b update hosts 2024-05-22 17:28:03 +02:00
93d8990762 add group vars 2024-05-22 17:23:45 +02:00
de0f91c83f change all by localhost 2024-05-22 17:22:00 +02:00
32d60e44ba add hosts file 2024-05-22 17:20:04 +02:00
38c1728c04 run #1 2024-05-22 17:13:10 +02:00
540758fd38 add defauts + asseet-vars 2024-05-22 17:11:26 +02:00
de020d3264 add defauts + asseet-vars 2024-05-22 17:02:34 +02:00
7060f6537a add ansible.cfg 2024-05-22 00:36:26 +02:00
b9c8aa87ea remove invemtory 2024-05-22 00:29:08 +02:00
b3e782b6eb add ansible inventory 2024-05-22 00:26:40 +02:00
8689365896 add check vault_pass file 2024-05-22 00:16:33 +02:00
e48ef91265 add check vault_pass file 2024-05-22 00:15:45 +02:00
9849f32eb5 add check vault_pass file 2024-05-22 00:11:53 +02:00
e32c7683ea add main.yml 2024-05-22 00:01:03 +02:00
3cc4824735 run playbook 2024-05-21 23:59:12 +02:00
e4c2b4f26b update date and time 2024-05-21 23:57:46 +02:00
006305ab4f add ansible 2024-05-21 23:46:12 +02:00
c74809d3b3 add expand root fs 2024-05-21 23:43:05 +02:00
c6860c03e8 add install rootfs expand 2024-05-21 23:21:53 +02:00
9d6c3336d6 add install rootfs expand 2024-05-21 23:12:28 +02:00
66a0293b3a add install rootfs expand 2024-05-21 23:08:27 +02:00
22 changed files with 688 additions and 0 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
ansible-galaxy install -f -r roles/requirements.yml
cd install-rapsberry
cd ;rm -rf install-rapsberry/;git clone https://gitweb.dyndns.org/raspberry/install-rapsberry.git;cd install-rapsberry;git checkout dev;./inst-rasp.sh

4
ansible.cfg Normal file
View File

@ -0,0 +1,4 @@
[defaults]
system_warnings = False
deprecation_warnings = False
command_warnings = False

4
assert-vars.yml Normal file
View File

@ -0,0 +1,4 @@
- name: verify if vars are defined and not empty
assert:
that:
- mail_domain

21
create-gilles-user.yml Normal file
View File

@ -0,0 +1,21 @@
- name: install mandatory python for encrypt password
dnf:
name: [python3, python3-bcrypt]
state: present
- name: create password for user kadmin
shell: python -c 'import crypt;hashed = crypt.crypt("{{ gilles_passwd }}"); print(hashed);'
register: passwd
- name: create user kadmin
user:
name: gilles
comment: Gilles Mouchet
password: "{{ passwd.stdout }}"
- name: copy sudo file
lineinfile:
path: /etc/sudoers.d/gilles
create: true
insertbefore: EOF
line: 'gilles ALL=(ALL) NOPASSWD: ALL'

31
disable-ipv6.yml Normal file
View File

@ -0,0 +1,31 @@
---
- name: disable IPv6 with sysctl
sysctl: name={{ item }} value=1 state=present reload=yes
with_items:
- net.ipv6.conf.all.disable_ipv6
- net.ipv6.conf.default.disable_ipv6
- net.ipv6.conf.lo.disable_ipv6
#- name: placeholder true for ipv6 in modprobe
# lineinfile:
# dest: /etc/modprobe.conf
# line: 'install ipv6 /bin/true'
# mode: '0644'
- name: disable ipv6 in sysconfig/network
lineinfile:
dest: /etc/sysconfig/network
regexp: "^{{ item.regexp }}"
line: "{{ item.line }}"
mode: '0644'
backup: yes
create: yes
with_items:
- { regexp: 'NETWORKING_IPV6=.*', line: 'NETWORKING_IPV6=NO' }
- { regexp: 'IPV6INIT=.*', line: 'IPV6INIT=no' }
- name: unactive ipv6 sshd
lineinfile:
dest: /etc/ssh/sshd_config
insertafter: '^#ListenAddress 0.0.0.0'
line: 'ListenAddress 0.0.0.0'

42
files/chrony/chrony.conf Normal file
View File

@ -0,0 +1,42 @@
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.pool.ntp.org iburst
# https://www.metas.ch/metas/fr/home/fabe/zeit-und-frequenz/time-dissemination.html
server ntp11.metas.ch iburst
server ntp12.metas.ch iburst
server ntp13.metas.ch iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
#makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *
# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2
# Allow NTP client access from local network.
#allow 192.168.0.0/16
# Serve time even if not synchronized to a time source.
#local stratum 10
# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys
# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
log measurements statistics tracking rtc

2
files/chrony/chronyd Normal file
View File

@ -0,0 +1,2 @@
# Command-line options for chronyd
OPTIONS="-4 -F 2"

61
files/os/gmo-cfg.sh Normal file
View File

@ -0,0 +1,61 @@
# source IA
# check if is a scp connexion
is_scp() {
# If SSH_ORIGINAL_COMMAND is defined and contains "scp"
if [[ -n "$SSH_ORIGINAL_COMMAND" && "$SSH_ORIGINAL_COMMAND" == scp* ]]; then
return 0
fi
# if script name ($0) contains "scp"
if [[ "$0" == *scp* ]]; then
return 0
fi
return 1
}
# source prompt color: https://robotmoon.com/bash-prompt-generator/^
if [ $(whoami) == "gilles" ]; then
#export PS1="\[\033[0;32m\][\[\033[1;94m\]\u\[\033[0;33m\]@\h \[\033[0;32m\]\W]# \[\033[0;37m\]"
export PS1="\[\e[38;5;216m\]\u\[\e[38;5;160m\]@\[\e[38;5;202m\]\h \[\e[38;5;131m\]\w \[\033[0m\]$ "
elif [ $(whoami) == "blutch" ]; then
export PS1="\[\033[0;32m\][\[\033[1;94m\]\u\[\033[0;33m\]@\h \[\033[0;32m\]\W]# \[\033[0;37m\]"
elif [ $(whoami) == "root" ]; then
export PS1="\[\033[0;32m\][\[\033[0;31m\]\u\[\033[0;31m\]@\h \[\033[0;32m\]\W]# \[\033[0;37m\]"
else
export PS1="[\u@\h \W]\$ "
fi
# Aliases
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ls='ls --color=auto'
alias sudo='sudo --preserve-env=PATH env' # https://www.petefreitag.com/blog/environment-variables-sudo/
if ! is_scp; then
if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then
host_domain=$(cat /etc/hostname| rev | cut -d. -f1-2 | rev)
host_fqdn=$(hostname)
host_short=$(hostname -s)
ip=$(hostname -I)
dist=$(cat /etc/redhat-release)
kern=$(uname -r)
cat << EOF
---------------------------------------------------------
Date - Hour: $(date +"%d.%m.%Y - %H:%M:%S")
---------------------------------------------------------
Host domain: $host_domain
Host name (fqdn): $host_fqdn
Host name (short): $host_short
Distribution: $dist
Kernel: $kern
---------------------------------------------------------
EOF
fi
fi
# execute only if user is gilles or root
#if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then
# # display proxy status
# if [ -f "/usr/local/bin/proxyOnOff.sh" ]; then
# sudo /usr/local/bin/proxyOnOff.sh status
# fi
#fi

0
files/os/profile Normal file
View File

4
files/os/vimrc Normal file
View File

@ -0,0 +1,4 @@
syntax on
set tabstop=4
set bg=dark
set paste

View File

@ -0,0 +1 @@
*/5 * * * * root /usr/local/bin/gmotools/update-hosts.sh > /dev/null 2>&1

14
group_vars/all.yml Normal file
View File

@ -0,0 +1,14 @@
---
#postfix
mail_domain: gmotech.dyndns.org
#mail_relay_host: smtpauths.bluewin.ch
#mail_relay_host: smtp.gmail.com
# DNS
#dns_domain_search: gmotech.net
gilles_passwd: !vault |
$ANSIBLE_VAULT;1.1;AES256
30333961653331613064333063326538393232633833663932386632653765613933396239316230
3061626535666636333866633538623365333139666163340a336531643364626630653331306264
35326238636466643938366535666462666534613137633631316638363763313164343563353734
6366393333326564340a623738653735363932313635616530613863313639306130363562656332
3738

9
hosts.yml Normal file
View File

@ -0,0 +1,9 @@
---
- name: build hosts file
lineinfile:
dest: /etc/hosts
insertafter: EOF
line: '{{ item }}'
state: present
with_items:
- '{{ ansible_default_ipv4.address }} {{ ansible_hostname }} {{ ansible_hostname }}.gmotech.net'

47
inst-apache.yml Normal file
View File

@ -0,0 +1,47 @@
---
- name: install apache
yum:
state: installed
name:
- httpd
- mod_ssl
- name: start and enable the httpd service
service:
state: started
name: httpd
enabled: true
- name: open http port
firewalld:
service: http
permanent: true
immediate: true
state: enabled
- name: open https port
firewalld:
service: https
permanent: true
immediate: true
state: enabled
- name: create cert path
file:
path: /etc/httpd/certs
state: directory
- name: delete welcome.conf
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/httpd/conf.d/welcome.conf
- /etc/httpd/conf.d/userdir.conf
- name: modify config to not navigate on os from browser (You don't have permission to access / on this server.)
lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: 'Options Indexes FollowSymLinks'
line: '#Options Indexes FollowSymLinks'
notify: restart httpd

35
inst-packages.yml Normal file
View File

@ -0,0 +1,35 @@
- name: install epel-release
yum:
state: installed
name:
- epel-release
#- name: active repo PowerTools
# replace:
# path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
# regexp: 'enabled=0'
# replace: 'enabled=1'
- name: install package
yum:
state: installed
name:
# - epel-release
- vim
- rsync
- lsof
- man
- mlocate
- mutt
- s-nail
- wget
- bind-utils
- yum-utils
- dnf-utils
- bash-completion
# - postfix-perl-scripts
- cifs-utils
- htop
- git
- tar
- unzip

232
inst-rasp.sh Executable file
View File

@ -0,0 +1,232 @@
#!/bin/bash
############################################################
# Description: install an config raspberry
# Usage: ./inst_raspberry.sh
# Author: Gilles Mouchet (gilles.mouchet@gmail.com)
# Creation Date: 26-Mar-2021
# Version: 1.0
#
# History:
# 1.0 - 26-Mar-2021: Creation of script from scratch
#
############################################################
# server vars
#hostName=actarus01p
#hostIp=192.168.1.12
# check if is not on mac
os=$(uname)
os_mac="Darwin"
t=1
#if [ "$t" -eq "1" ]; then
if [ "$(uname)" = "Darwin" ]; then
echo "do not execute on mac"
exit 1
fi
# scripts vars (do not edit)
scriptName=`echo $0 | sed -e 's|.*/||g' | cut -f1 -d.`
dayOfWeek=`/bin/date +%a`
daySuffix="_$dayOfWeek"
logPath=`pwd` # log path is from execute script path
logFile=$logPath/$scriptName$daySuffix.log
tempOutputFile=$logPath/$progName.$$ # temp output console file
backupFolder=/root/backup # destination folder backup
hostName=actarus01p
# constants
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[36m"
ENDCOLOR="\e[0m"
#-----------------------------------------------------------------------------
# Function
#-----------------------------------------------------------------------------
function saveFile(){
if [ -f $1 ]; then
cp $1 $backupFolder >/dev/null 2>&1
if [ $? -ne 0 ]; then printError "Problem to save $1 to $backupFolder";exit; fi
fi
}
function printSuccess() {
echo -e "[${GREEN}SUCCESS${ENDCOLOR}] - $1"
}
function printWarning() {
echo -e "[${YELLOW}WARNING${ENDCOLOR}] - $1"
}
function printError() {
echo -e "[${RED}ERROR${ENDCOLOR}] - $1"
}
function printInfo() {
echo -e "\n[${BLUE}INFO${ENDCOLOR}] - $1"
}
function printSubInfo() {
echo -e " - $1"
}
function delete_folder() {
local folder_path=$1
if [ -z "$folder_path" ]; then
printError "Error: Folder path not provided."
exit 1
fi
if [ -d "$folder_path" ]; then
rm -rf "$folder_path"
if [ $? -eq 0 ]; then
printSuccess "Folder '$folder_path' deleted successfully."
else
printError "Error: Failed to delete folder '$folder_path'."
exit 1
fi
fi
}
#-----------------------------------------------------------------------------
# cleanup /tmp folder (if during the last execution the script ended with
# an error)
#-----------------------------------------------------------------------------
printInfo "Cleanup"
delete_folder "/tmp/yumupd"
delete_folder "/tmp/hostsupd"
printSuccess "Cleanup completed"
#-----------------------------------------------------------------------------
# install rootfs-expand
#-----------------------------------------------------------------------------
printInfo "Install rootfs-expand package"
dnf -q install rocky-release-rpi-9.0-5.el9.noarch -y > /dev/null
if [ "$?" -ne "0" ]; then printError "Problem to install rootfs-extand package";exit; fi
printSuccess "rootfs-expand package installed successfully"
#-----------------------------------------------------------------------------
# extend root part
#-----------------------------------------------------------------------------
printInfo "Extend root partition"
#rootfs-expand
partSize=`df --output=size -B 1 "$PWD" |tail -n 1`
# For prod
if [ $partSize -gt 61780000000 ]; then
# For dev
#if [ $partSize -gt 21407727600 ]; then
printSuccess "Root partion already extended"
else
rootfs-expand
retVal=$?
if [ $retVal -ne 0 ]; then printError "Problem to extend root partition";exit; fi
printSuccess "Root partition extended"
# parted /dev/mmcblk0 resizepart 3 100% >/dev/null 2>&1
# rror=$?
# resize2fs /dev/mmcblk0p3 >/dev/null 2>&1
# let retVal=retVal+$error
# if [ $retVal -ne 0 ]; then printError "Problem to extend root partition";exit; fi
# printSuccess "Root partition extended"
fi
#-----------------------------------------------------------------------------
# install package python
#-----------------------------------------------------------------------------
printInfo "Install package"
printSubInfo "install python"
yum install -y python3 python3-pip >/dev/null 2>&1
if [ $? -ne 0 ]; then printError "Problem to install packages";exit; fi
printSuccess "Packages installed successfully"
#-----------------------------------------------------------------------------
# update pip
#-----------------------------------------------------------------------------
printInfo "Upgrade pip3"
pip3 install --upgrade pip >/dev/null 2>&1
if [ $? -ne 0 ]; then printError "Problem to upgrade pip3";exit; fi
printSuccess "Pip3 upgraded successfully"
#-----------------------------------------------------------------------------
# install ansible
#-----------------------------------------------------------------------------
printInfo "Install ansible. Please wait ..."
pip3 install --user ansible >/dev/null 2>&1
if [ $? -ne 0 ]; then printError "Problem to install ansible";exit; fi
printSuccess "Ansible installed successfully"
#-----------------------------------------------------------------------------
# add path .local/bin
#-----------------------------------------------------------------------------
printInfo "Add ./.local/bin in path"
echo "export PATH=~/.local/bin:\$PATH" >> ~/.bashrc
if [ $? -ne 0 ]; then printError "Problem to install ansible";exit; fi
printSuccess "./.local/bin added in path successfully "
#-----------------------------------------------------------------------------
# check /root/ansible/.vault_pass.txt exits
#-----------------------------------------------------------------------------
printInfo "Check /root/ansible/.vault_pass.txt"
if [ ! -f "/root/ansible/.vault_pass.txt" ]; then
printError "You must create /root/ansible/.vault_pass.txt"
exit
fi
printSuccess "/root/ansible/.vault_pass.txt exist"
#-----------------------------------------------------------------------------
# update date and time
#-----------------------------------------------------------------------------
printInfo "Update date and time"
~/.local/bin/ansible-playbook playbook-chrony.yml
if [ $? -ne 0 ]; then printError "Problem to update date and time";exit; fi
printSuccess "Date and Time updated successfully"
#-----------------------------------------------------------------------------
# get yum-check-update script
#-----------------------------------------------------------------------------
printInfo "Get yum-check-update script"
git clone https://gitweb.dyndns.org/scripts/yum-check.git /tmp/yumupd
if [ $? -ne 0 ]; then printError "Problem to clone yum-check-update script";exit; fi
printSuccess "yum-check-update script cloned successfully"
#-----------------------------------------------------------------------------
# get update-hosts script
#-----------------------------------------------------------------------------
printInfo "Get update-hosts script"
git clone https://gitweb.dyndns.org/scripts/gest-hosts-file.git /tmp/hostsupd
if [ $? -ne 0 ]; then printError "Problem to clone update-hosts script";exit; fi
printSuccess "update-hosts script cloned successfully"
#-----------------------------------------------------------------------------
# update role
#-----------------------------------------------------------------------------
printInfo "Update roles"
~/.local/bin/ansible-galaxy install -f -r roles/requirements.yml
if [ $? -ne 0 ]; then printError "Problem to update roles";exit; fi
printSuccess "Role updated successfully"
#-----------------------------------------------------------------------------
# execute playbook
#-----------------------------------------------------------------------------
printInfo "Execute playbook"
~/.local/bin/ansible-playbook main.yml --vault-password-file ~/ansible/.vault_pass.txt
if [ $? -ne 0 ]; then printError "Problem to execute playbook"; fi
printSuccess "Ansible playbook finished"
#-----------------------------------------------------------------------------
# Cleanup /tmp folder
#-----------------------------------------------------------------------------
printInfo "Cleanup"
delete_folder "/tmp/yumupd"
delete_folder "/tmp/hostsupd"
printSuccess "Cleanup completed"
#-----------------------------------------------------------------------------
# set timezone
#-----------------------------------------------------------------------------
#printInfo "Set timzone"
#timedatectl set-timezone Europe/Zurich
#if [ $? -ne 0 ]; then printError "Problem to set timezone";exit; fi
#printSuccess "Timezone setted successfully"
#-----------------------------------------------------------------------------
# set locale
#-----------------------------------------------------------------------------
#printInfo "Set timzone"
#timedatectl set-timezone Europe/Zurich
#if [ $? -ne 0 ]; then printError "Problem to set timezone";exit; fi
#printSuccess "Timezone setted successfully"

43
main.yml Normal file
View File

@ -0,0 +1,43 @@
---
- hosts: localhost
handlers:
- name: restart httpd
service:
name: httpd
state: restarted
- name: restart php-fpm
service:
name: php-fpm
state: restarted
vars:
mail_relay_host: smtp.gmail.com
mail_domain: gmotech.dyndns.org
tasks:
- include_tasks: assert-vars.yml
- include_tasks: disable-ipv6.yml
- include_tasks: hosts.yml
- include_tasks: inst-packages.yml
- include_tasks: misc.yml
- include_tasks: create-gilles-user.yml
- name: import postfix role
import_role:
name: role-postfix
- include_tasks: yum-check-update.yml
- include_tasks: update-hosts-file.yml
- name: import netdata role
import_role:
name: role-netdata
- include_tasks: inst-apache.yml
- name: import php83 role
import_role:
name: role-php83

63
misc.yml Normal file
View File

@ -0,0 +1,63 @@
---
- name: set correct time zone
timezone:
name: Europe/Zurich
- name: correct AM/PM rocky 9 bug
lineinfile:
path: /etc/locale.conf
insertafter: EOF
line: LC_TIME=C
- name: secure stack ip part 1
sysctl:
name: net.ipv4.tcp_timestamps
value: "0"
sysctl_set: yes
state: present
reload: yes
- name: secure stack ip part 2
firewalld:
service: dhcpv6-client
permanent: true
state: disabled
- name: forward X11
lineinfile:
dest: /etc/ssh/sshd_config
insertafter: '^#X11UseLocalhost yes'
line: 'X11UseLocalhost no'
- name: unactivate CRTL-DEL
file:
src: /dev/null
dest: /usr/lib/systemd/system/ctrl-alt-del.target
changed_when: false
- name: bash gmo-cfg.sh
copy:
src: os/gmo-cfg.sh
dest: /etc/profile.d/gmo-cfg.sh
- name: add ~/.local/bin in path
lineinfile:
path: /root/.bashrc
line: export PATH=~/.local/bin:$PATH
- name: vimrc
copy:
src: os/vimrc
dest: /root/.vimrc
- name: put SELinux in permissive mode
selinux:
policy: targeted
state: permissive
#- name: create message in motd
# copy:
# content: "\n**************************************************\n* !! This
#server is managed by ANSIBLE !! *\n* The config files must be changed in repos
#itory *\n**************************************************\n\n"
# dest: /etc/motd

24
playbook-chrony.yml Normal file
View File

@ -0,0 +1,24 @@
---
- hosts: localhost
tasks:
- name: install chrony
yum:
name: chrony
state: present
- name: config time server
copy:
src: chrony/chrony.conf
dest: /etc/chrony.conf
- name: disable chrony ipv6
copy:
src: chrony/chronyd
dest: /etc/sysconfig/chronyd
- name: start and active service chronyd
systemd:
name: chronyd
enabled: true
state: started

12
roles/requirements.yml Normal file
View File

@ -0,0 +1,12 @@
---
- name: role-postfix
src: git+https://gitweb.dyndns.org/awx/role-postfix.git
- name: role-yum-check
src: git+https://gitweb.dyndns.org/scripts/yum-check.git
- name: role-netdata
src: git+https://gitweb.dyndns.org/awx/role_netdata.git
- name: role-php83
src: git+https://gitweb.dyndns.org/awx/role-php83.git

17
update-hosts-file.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: create destination folder
file:
path: /usr/local/bin/gmotools
state: directory
- name: copy script to folder
copy:
src: /tmp/hostsupd/update-hosts.sh
dest: /usr/local/bin/gmotools/update-hosts.sh
mode: 0750
remote_src: yes
- name: copy cron file
copy:
src: updhosts/update-hosts.cron
dest: /etc/cron.d/update-hosts.cron

17
yum-check-update.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: create destination folder
file:
path: /usr/local/bin/gmotools
state: directory
- name: get check-yum-update
copy:
src: /tmp/yumupd/check-yum-updates.sh
dest: /usr/local/bin/gmotools/check-yum-updates.sh
mode: 0755
- name: create link crontab daily
file:
src: /usr/local/bin/gmotools/check-yum-updates.sh
dest: /etc/cron.daily/check-yum-updates
state: link