refs #8025 Little modifications - Using module systemd insted service. Other approach to hosts file. More strict disable apparmor.

This commit is contained in:
Xavi Lleó 2024-10-04 13:15:55 +02:00
parent 9dfbe294bc
commit 757d3dfe29
7 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View File

@ -2,5 +2,6 @@
.vault-pass .vault-pass
.vault.yml .vault.yml
.passbolt.yml .passbolt.yml
inventories/local
venv venv
context/_build context/_build

View File

@ -11,7 +11,6 @@ main_dns_server: ns1.verdnatura.es
ldap_uri: ldap://ldap.verdnatura.es ldap_uri: ldap://ldap.verdnatura.es
ldap_base: dc=verdnatura,dc=es ldap_base: dc=verdnatura,dc=es
dc_net: "10.0.0.0/16" dc_net: "10.0.0.0/16"
resolv_domain: verdnatura.es
resolvers: resolvers:
- '10.0.0.4' - '10.0.0.4'
- '10.0.0.5' - '10.0.0.5'

View File

@ -1,4 +1,4 @@
- name: restart-sysctl - name: restart-sysctl
service: systemd:
name: systemd-sysctl name: systemd-sysctl
state: restarted state: restarted

View File

@ -1,5 +1,12 @@
- name: Disable AppArmor - name: Stop AppArmor
service: systemd:
name: apparmor name: apparmor
state: stopped state: stopped
- name: Disable AppArmor service
systemd:
name: apparmor
enabled: no enabled: no
- name: Mask AppArmor service
systemd:
name: apparmor
masked: yes

View File

@ -2,11 +2,8 @@
hostname: hostname:
name: "{{ inventory_hostname_short }}" name: "{{ inventory_hostname_short }}"
use: debian use: debian
- name: Configure hosts file - name: Populating hosts file with hostname
blockinfile: lineinfile:
path: /etc/hosts path: /etc/hosts
marker_begin: '--- BEGIN VN ---' regexp: '^127.0.1.1'
marker_end: '--- END VN ---' line: '127.0.1.1 {{ ansible_host }} {{ inventory_hostname_short }}'
marker: "# {mark}"
block: |
{{ ansible_default_ipv4.address }} {{ ansible_host }} {{ inventory_hostname_short }}

View File

@ -1,4 +1,4 @@
- name: Set systctl configuration - name: Set systctl custom vn configuration
copy: copy:
src: sysctl/ src: sysctl/
dest: /etc/sysctl.d/ dest: /etc/sysctl.d/

View File

@ -1,5 +1,5 @@
domain {{ resolv_domain }} domain {{ host_domain }}
search {{ resolv_domain }} search {{ host_domain }}
{% if resolvers is defined %} {% if resolvers is defined %}
{% for resolver in resolvers %} {% for resolver in resolvers %}
nameserver {{resolver}} nameserver {{resolver}}