Compare commits

...

4 Commits

5 changed files with 67 additions and 49 deletions

View 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
View File

@@ -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"
} }

View 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"
}

View File

@@ -1,5 +1,4 @@
--- ---
# --- # ---
# Apache2 Server # Apache2 Server
# --- # ---
@@ -7,31 +6,29 @@
- name: Populate service facts - name: Populate service facts
ansible.builtin.service_facts: ansible.builtin.service_facts:
#- name: Print service facts # - name: Print service facts
# ansible.builtin.debug: # ansible.builtin.debug:
# var: ansible_facts.services # var: ansible_facts.services
# 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'

View File

@@ -1,8 +1,7 @@
--- ---
- import_tasks: show.yml - import_tasks: show.yml
tags: tags:
- show - show
# tags supported inside basic.yml # tags supported inside basic.yml
# #
@@ -13,7 +12,6 @@
tags: tags:
- basic - basic
# tags supported inside apt.yml # tags supported inside apt.yml
# #
# apt-update # apt-update
@@ -34,7 +32,6 @@
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
tags: apt tags: apt
# tags supported inside apt-gateway.yml: # tags supported inside apt-gateway.yml:
# #
# #
@@ -44,7 +41,6 @@
- apt - apt
- apt-gateway-server - apt-gateway-server
# #
# yum-update # yum-update
# yum-base-install # yum-base-install
@@ -55,7 +51,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 +60,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,17 +71,15 @@
- 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']
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
tags: tags:
- tor-service - tor-service
- import_tasks: cron.yml - import_tasks: cron.yml
tags: tags:
- cron - cron
# tags supported inside shell.yml # tags supported inside shell.yml
@@ -99,10 +91,9 @@
when: when:
- ansible_facts['distribution'] == "Debian" - ansible_facts['distribution'] == "Debian"
tags: tags:
- shell-config - shell-config
- vim-config - vim-config
- zsh-config - zsh-config
# tags supported inside users.yml: # tags supported inside users.yml:
# #
@@ -115,21 +106,19 @@
# root-defaut-ssh-keypair # root-defaut-ssh-keypair
# insert_root_ssh_public_key # insert_root_ssh_public_key
- import_tasks: users.yml - import_tasks: users.yml
tags: tags:
- users - users
# tags supported inside users-systemfiles.yml: # tags supported inside users-systemfiles.yml:
# #
# bash # bash
# profile # profile
# vim # vim
- import_tasks: users-systemfiles.yml - import_tasks: users-systemfiles.yml
tags: tags:
- users - users
- users-systemfiles - users-systemfiles
# tags supported inside webadmin-user.yml: # tags supported inside webadmin-user.yml:
# #
# users-exists # users-exists
@@ -140,19 +129,17 @@
# insert_webadmin_ssh_public_key # insert_webadmin_ssh_public_key
- import_tasks: webadmin-user.yml - import_tasks: webadmin-user.yml
when: groups['webadmin']|string is search(inventory_hostname) when: groups['webadmin']|string is search(inventory_hostname)
tags: tags:
- users - users
- 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 +148,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 +160,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 +182,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 +190,6 @@
tags: tags:
- nfs - nfs
# tags supported inside x2go-server.yml: # tags supported inside x2go-server.yml:
# #
# x2go-server # x2go-server
@@ -216,7 +198,6 @@
tags: tags:
- x2go - x2go
# tags supported inside copy_files.yml: # tags supported inside copy_files.yml:
# #
# copy-files # copy-files
@@ -233,7 +214,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
@@ -276,9 +256,9 @@
- remove-samba-user - remove-samba-user
- import_tasks: redis-server.yml - import_tasks: redis-server.yml
when: inventory_hostname in groups['nextcloud_server'] or when: inventory_hostname in groups['nextcloud_server'] or
inventory_hostname in groups['apache2_webserver'] or inventory_hostname in groups['apache2_webserver'] or
inventory_hostname in groups['nginx_webserver'] inventory_hostname in groups['nginx_webserver']
tags: tags:
- redis-server - redis-server
@@ -299,10 +279,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