Compare commits
5 Commits
a7ae583c20
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8064f4a2fe | |||
| 9ef1c94855 | |||
| 28d6cfe5da | |||
| c94baae7ff | |||
| b201a21105 |
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "Ansible Development",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/python:3.12",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/ansible:1": {}
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"redhat.ansible",
|
||||||
|
"ms-python.python"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postCreateCommand": "pip install ansible-lint"
|
||||||
|
}
|
||||||
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
@@ -5,5 +5,14 @@
|
|||||||
"envManager": "ms-python.python:venv",
|
"envManager": "ms-python.python:venv",
|
||||||
"packageManager": "ms-python.python:pip"
|
"packageManager": "ms-python.python:pip"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
|
||||||
|
"python.pythonPath": "${workspaceFolder}/.venv/bin/python", // legacy fallback for older Python extension versions
|
||||||
|
// Keep these Ansible executable paths absolute: parts of the extension use them verbatim.
|
||||||
|
"ansible.ansiblePath": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible", // legacy fallback for older Ansible extension versions
|
||||||
|
"ansible.ansibleLintPath": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-lint", // legacy fallback for older Ansible extension versions
|
||||||
|
"ansible.ansible.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible",
|
||||||
|
"ansible.python.interpreterPath": "${workspaceFolder}/.venv/bin/python3",
|
||||||
|
"ansible.validation.lint.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-lint",
|
||||||
|
"ansible.ansibleNavigator.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-navigator"
|
||||||
}
|
}
|
||||||
|
|||||||
18
.vscode/settings.json.bak.20260327-152321
vendored
Normal file
18
.vscode/settings.json.bak.20260327-152321
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"python-envs.pythonProjects": [
|
||||||
|
{
|
||||||
|
"path": ".",
|
||||||
|
"envManager": "ms-python.python:venv",
|
||||||
|
"packageManager": "ms-python.python:pip"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
|
||||||
|
"python.pythonPath": "${workspaceFolder}/.venv/bin/python", // legacy fallback for older Python extension versions
|
||||||
|
// Keep these Ansible executable paths absolute: parts of the extension use them verbatim.
|
||||||
|
"ansible.ansiblePath": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible", // legacy fallback for older Ansible extension versions
|
||||||
|
"ansible.ansibleLintPath": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-lint", // legacy fallback for older Ansible extension versions
|
||||||
|
"ansible.ansible.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible",
|
||||||
|
"ansible.python.interpreterPath": "${workspaceFolder}/.venv/bin/python3",
|
||||||
|
"ansible.validation.lint.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-lint",
|
||||||
|
"ansible.ansibleNavigator.path": "/home/chris/devel/git/git.oopen.de/ansible/oopen-server/.venv/bin/ansible-navigator"
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Apache2 Server
|
# Apache2 Server
|
||||||
# ---
|
# ---
|
||||||
@@ -13,25 +12,23 @@
|
|||||||
# when:
|
# when:
|
||||||
# - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
# - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
||||||
|
|
||||||
|
|
||||||
- name: (apache2.yml) Ensure directory '/etc/systemd/system/apache2.service.d' is present
|
- name: (apache2.yml) Ensure directory '/etc/systemd/system/apache2.service.d' is present
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/systemd/system/apache2.service.d
|
path: /etc/systemd/system/apache2.service.d
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0755'
|
mode: "0755"
|
||||||
when:
|
when:
|
||||||
- ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
- ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
||||||
|
|
||||||
|
|
||||||
- name: (apache2.yml) Ensure file '/etc/systemd/system/apache2.service.d/limits.conf' exists
|
- name: (apache2.yml) Ensure file '/etc/systemd/system/apache2.service.d/limits.conf' exists
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: 'etc/systemd/system/apache2.service.d/limits.conf'
|
src: "etc/systemd/system/apache2.service.d/limits.conf"
|
||||||
dest: '/etc/systemd/system/apache2.service.d/limits.conf'
|
dest: "/etc/systemd/system/apache2.service.d/limits.conf"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: "0644"
|
||||||
notify: "Restart apache2"
|
notify: "Restart apache2"
|
||||||
when:
|
when:
|
||||||
- ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
- ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'
|
||||||
|
|||||||
@@ -1,5 +1,82 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
- name: (cron.yml) Define candidate paths for root crontab PATH
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
cron_root_path_candidates:
|
||||||
|
- /root/bin/admin-stuff
|
||||||
|
- /root/bin
|
||||||
|
- /usr/local/apache2/bin
|
||||||
|
- /usr/local/php/bin
|
||||||
|
- /usr/local/sbin
|
||||||
|
- /usr/local/bin
|
||||||
|
- /usr/sbin
|
||||||
|
- /usr/bin
|
||||||
|
- /sbin
|
||||||
|
- /bin
|
||||||
|
tags:
|
||||||
|
- user_crontab
|
||||||
|
|
||||||
|
- name: (cron.yml) Check candidate paths for root crontab PATH
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ item }}"
|
||||||
|
loop: "{{ cron_root_path_candidates }}"
|
||||||
|
register: cron_root_path_stats
|
||||||
|
tags:
|
||||||
|
- user_crontab
|
||||||
|
|
||||||
|
- name: (cron.yml) Build validated root crontab PATH
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
cron_root_path: >-
|
||||||
|
{{
|
||||||
|
cron_root_path_stats.results
|
||||||
|
| selectattr('stat.exists')
|
||||||
|
| map(attribute='stat.path')
|
||||||
|
| join(':')
|
||||||
|
}}
|
||||||
|
tags:
|
||||||
|
- user_crontab
|
||||||
|
|
||||||
|
- name: (cron.yml) Check if root crontab already exists
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: /var/spool/cron/crontabs/root
|
||||||
|
register: root_crontab_file
|
||||||
|
tags:
|
||||||
|
- user_crontab
|
||||||
|
|
||||||
|
- name: (cron.yml) Initialize root crontab with default header and env vars
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /var/spool/cron/crontabs/root
|
||||||
|
owner: root
|
||||||
|
group: crontab
|
||||||
|
mode: '0600'
|
||||||
|
content: |
|
||||||
|
# Edit this file to introduce tasks to be run by cron.
|
||||||
|
#
|
||||||
|
# Each task to run has to be defined through a single line
|
||||||
|
# indicating with different fields when the task will be run
|
||||||
|
# and what command to run for the task
|
||||||
|
#
|
||||||
|
# To define the time you can provide concrete values for
|
||||||
|
# minute (m), hour (h), day of month (dom), month (mon),
|
||||||
|
# and day of week (dow) or use '*' in these fields (for 'any').
|
||||||
|
#
|
||||||
|
# Notice that tasks will be started based on the cron's system
|
||||||
|
# daemon's notion of time and timezones.
|
||||||
|
#
|
||||||
|
# Output of the crontab jobs (including errors) is sent through
|
||||||
|
# email to the user the crontab file belongs to (unless redirected).
|
||||||
|
#
|
||||||
|
# For example, you can run a backup of all your user accounts
|
||||||
|
# at 5 a.m every week with:
|
||||||
|
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
|
||||||
|
#
|
||||||
|
PATH={{ cron_root_path }}
|
||||||
|
SHELL=/bin/bash
|
||||||
|
when:
|
||||||
|
- not root_crontab_file.stat.exists
|
||||||
|
tags:
|
||||||
|
- user_crontab
|
||||||
|
|
||||||
- name: (cron.yml) Set env entries in user crontabs
|
- name: (cron.yml) Set env entries in user crontabs
|
||||||
cron:
|
cron:
|
||||||
name: '{{ item.name }}'
|
name: '{{ item.name }}'
|
||||||
|
|||||||
26
roles/common/tasks/extrepo.yml
Normal file
26
roles/common/tasks/extrepo.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: (extrepo.yml) Install extrepo package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: extrepo
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- extrepo
|
||||||
|
|
||||||
|
- name: (extrepo.yml) Enable contrib policy in /etc/extrepo/config.yaml
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/extrepo/config.yaml
|
||||||
|
regexp: '^(#\s*)?-\s*contrib$'
|
||||||
|
insertafter: '^- main$'
|
||||||
|
line: '- contrib'
|
||||||
|
tags:
|
||||||
|
- extrepo
|
||||||
|
|
||||||
|
- name: (extrepo.yml) Enable non-free policy in /etc/extrepo/config.yaml
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/extrepo/config.yaml
|
||||||
|
regexp: '^(#\s*)?-\s*non-free$'
|
||||||
|
insertafter: '^- contrib$'
|
||||||
|
line: '- non-free'
|
||||||
|
tags:
|
||||||
|
- extrepo
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- import_tasks: show.yml
|
- import_tasks: show.yml
|
||||||
tags:
|
tags:
|
||||||
- show
|
- show
|
||||||
@@ -13,7 +12,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- basic
|
- basic
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside apt.yml
|
# tags supported inside apt.yml
|
||||||
#
|
#
|
||||||
# apt-update
|
# apt-update
|
||||||
@@ -34,6 +32,15 @@
|
|||||||
- ansible_facts['distribution'] == "Debian"
|
- ansible_facts['distribution'] == "Debian"
|
||||||
tags: apt
|
tags: apt
|
||||||
|
|
||||||
|
# tags supported inside extrepo.yml
|
||||||
|
#
|
||||||
|
# extrepo
|
||||||
|
- import_tasks: extrepo.yml
|
||||||
|
when:
|
||||||
|
- ansible_facts['distribution'] == "Debian"
|
||||||
|
- (ansible_facts['distribution_major_version'] | int) >= 12
|
||||||
|
tags:
|
||||||
|
- extrepo
|
||||||
|
|
||||||
# tags supported inside apt-gateway.yml:
|
# tags supported inside apt-gateway.yml:
|
||||||
#
|
#
|
||||||
@@ -44,7 +51,6 @@
|
|||||||
- apt
|
- apt
|
||||||
- apt-gateway-server
|
- apt-gateway-server
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# yum-update
|
# yum-update
|
||||||
# yum-base-install
|
# yum-base-install
|
||||||
@@ -55,7 +61,6 @@
|
|||||||
- ansible_facts.distribution == "CentOS" or ansible_facts.distribution == "Fedora"
|
- ansible_facts.distribution == "CentOS" or ansible_facts.distribution == "Fedora"
|
||||||
tags: yum
|
tags: yum
|
||||||
|
|
||||||
|
|
||||||
# tags supportetd inside caching-nameserver.yml
|
# tags supportetd inside caching-nameserver.yml
|
||||||
#
|
#
|
||||||
# apt-caching-nameserver
|
# apt-caching-nameserver
|
||||||
@@ -65,7 +70,6 @@
|
|||||||
when: groups['caching_nameserver']|string is search(inventory_hostname)
|
when: groups['caching_nameserver']|string is search(inventory_hostname)
|
||||||
tags: caching-nameserver
|
tags: caching-nameserver
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside systemd-resolved.yml
|
# tags supported inside systemd-resolved.yml
|
||||||
#
|
#
|
||||||
# systemd-resolved
|
# systemd-resolved
|
||||||
@@ -77,8 +81,6 @@
|
|||||||
- ansible_facts['distribution_major_version'] > "11"
|
- ansible_facts['distribution_major_version'] > "11"
|
||||||
- systemd_resolved is defined and systemd_resolved|bool
|
- systemd_resolved is defined and systemd_resolved|bool
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- import_tasks: tor.yml
|
- import_tasks: tor.yml
|
||||||
when:
|
when:
|
||||||
- inventory_hostname in groups['mail_server']
|
- inventory_hostname in groups['mail_server']
|
||||||
@@ -103,7 +105,6 @@
|
|||||||
- vim-config
|
- vim-config
|
||||||
- zsh-config
|
- zsh-config
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside users.yml:
|
# tags supported inside users.yml:
|
||||||
#
|
#
|
||||||
# users-exists
|
# users-exists
|
||||||
@@ -118,7 +119,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- users
|
- users
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside users-systemfiles.yml:
|
# tags supported inside users-systemfiles.yml:
|
||||||
#
|
#
|
||||||
# bash
|
# bash
|
||||||
@@ -129,7 +129,6 @@
|
|||||||
- users
|
- users
|
||||||
- users-systemfiles
|
- users-systemfiles
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside webadmin-user.yml:
|
# tags supported inside webadmin-user.yml:
|
||||||
#
|
#
|
||||||
# users-exists
|
# users-exists
|
||||||
@@ -145,14 +144,12 @@
|
|||||||
- users-systemfiles
|
- users-systemfiles
|
||||||
- webadmin
|
- webadmin
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside sshd.yml
|
# tags supported inside sshd.yml
|
||||||
#
|
#
|
||||||
# sshd-config
|
# sshd-config
|
||||||
- import_tasks: sshd.yml
|
- import_tasks: sshd.yml
|
||||||
tags: sshd
|
tags: sshd
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside sudoers.yml:
|
# tags supported inside sudoers.yml:
|
||||||
#
|
#
|
||||||
# sudoers-remove
|
# sudoers-remove
|
||||||
@@ -161,11 +158,9 @@
|
|||||||
- import_tasks: sudoers.yml
|
- import_tasks: sudoers.yml
|
||||||
tags: sudoers
|
tags: sudoers
|
||||||
|
|
||||||
|
|
||||||
- import_tasks: motd.yml
|
- import_tasks: motd.yml
|
||||||
tags: motd
|
tags: motd
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside ntp.yml:
|
# tags supported inside ntp.yml:
|
||||||
#
|
#
|
||||||
# ntp-server
|
# ntp-server
|
||||||
@@ -175,7 +170,6 @@
|
|||||||
when:
|
when:
|
||||||
- "'lxc_guest' not in group_names"
|
- "'lxc_guest' not in group_names"
|
||||||
|
|
||||||
|
|
||||||
# tags supportetd inside git.yml
|
# tags supportetd inside git.yml
|
||||||
#
|
#
|
||||||
# git-firewall-repository
|
# git-firewall-repository
|
||||||
@@ -198,7 +192,6 @@
|
|||||||
- import_tasks: git.yml
|
- import_tasks: git.yml
|
||||||
tags: git
|
tags: git
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside nfs.yml:
|
# tags supported inside nfs.yml:
|
||||||
#
|
#
|
||||||
# nfs-server
|
# nfs-server
|
||||||
@@ -207,7 +200,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- nfs
|
- nfs
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside x2go-server.yml:
|
# tags supported inside x2go-server.yml:
|
||||||
#
|
#
|
||||||
# x2go-server
|
# x2go-server
|
||||||
@@ -216,7 +208,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- x2go
|
- x2go
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside copy_files.yml:
|
# tags supported inside copy_files.yml:
|
||||||
#
|
#
|
||||||
# copy-files
|
# copy-files
|
||||||
@@ -233,7 +224,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- symlink-files
|
- symlink-files
|
||||||
|
|
||||||
|
|
||||||
# tags supported inside config_files_mailsystem_scripts.yml:
|
# tags supported inside config_files_mailsystem_scripts.yml:
|
||||||
#
|
#
|
||||||
- import_tasks: config_files_mailsystem_scripts.yml
|
- import_tasks: config_files_mailsystem_scripts.yml
|
||||||
@@ -299,10 +289,8 @@
|
|||||||
tags:
|
tags:
|
||||||
- services
|
- services
|
||||||
|
|
||||||
|
|
||||||
- import_tasks: systemd-services_redhat_based_OS.yml
|
- import_tasks: systemd-services_redhat_based_OS.yml
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == "RedHat"
|
- ansible_facts.os_family == "RedHat"
|
||||||
tags:
|
tags:
|
||||||
- services
|
- services
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user