main #31

Merged
juan merged 154 commits from main into lab 2024-10-16 15:22:43 +00:00
6 changed files with 34 additions and 57 deletions
Showing only changes of commit 7ec58a2f89 - Show all commits

View File

@ -19,3 +19,14 @@ awx_pub_key: >
ssh-ed25519
AAAAC3NzaC1lZDI1NTE5AAAAIKzAwWm+IsqZCgMzjdZ7Do3xWtVtoUCpWJpH7KSi2a/H
awx@verdnatura.es
base_packages:
- htop
- psmisc
- bash-completion
- screen
- aptitude
- vim
- tree
- btop
- ncdu
- debconf-utils

View File

@ -2,10 +2,6 @@
service:
name: systemd-timesyncd
state: restarted
- name: restart-exim
service:
name: exim4
state: restarted
- name: restart-ssh
service:
name: ssh
@ -18,7 +14,9 @@
service:
name: nagios-nrpe-server
state: restarted
- name: Generate locales
- name: generate locales
command: /usr/sbin/locale-gen
- name: Reconfigure tzdata
- name: reconfigure tzdata
command: dpkg-reconfigure -f noninteractive tzdata
- name: update exim configuration
command: update-exim4.conf

View File

@ -2,15 +2,4 @@
apt:
name: "{{ item }}"
state: present
with_items:
- htop
- psmisc
- bash-completion
- screen
- aptitude
- vim
- aptitude
- tree
- btop
- ncdu
- debconf-utils
loop: "{{ base_packages }}"

View File

@ -7,4 +7,4 @@
loop:
- { question: "locales/locales_to_be_generated", value: "en_US.UTF-8 UTF-8, es_ES.UTF-8 UTF-8", vtype: "multiselect" }
- { question: "locales/default_environment_locales", value: "en_US.UTF-8", vtype: "string" }
notify: Generate locales
notify: generate locales

View File

@ -3,46 +3,25 @@
name: exim4
state: present
- name: Prepare exim configuration
lineinfile:
dest: /etc/exim4/update-exim4.conf.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
blockinfile:
path: /etc/exim4/update-exim4.conf.conf
marker_begin: '--- BEGIN VN ---'
marker_end: '--- END VN ---'
marker: "# {mark}"
block: |
dc_eximconfig_configtype='satellite'
dc_other_hostnames='{{ ansible_fqdn }}'
dc_local_interfaces='127.0.0.1'
dc_readhost='{{ ansible_fqdn }}'
dc_smarthost='{{ smtp_server }}'
dc_hide_mailname='true'
state: present
mode: 0644
with_items:
- regexp: '^dc_eximconfig_configtype'
line: "dc_eximconfig_configtype='satellite'"
- regexp: '^dc_other_hostnames'
line: "dc_other_hostnames='{{ ansible_fqdn }}'"
- regexp: '^dc_local_interfaces'
line: "dc_local_interfaces='127.0.0.1'"
- regexp: '^dc_readhost'
line: "dc_readhost='{{ ansible_fqdn }}'"
- regexp: '^dc_relay_domains'
line: "dc_relay_domains=''"
- regexp: '^dc_minimaldns'
line: "dc_minimaldns='false'"
- regexp: '^dc_relay_nets'
line: "dc_relay_nets=''"
- regexp: '^dc_smarthost'
line: "dc_smarthost='{{ smtp_server }}'"
- regexp: '^CFILEMODE'
line: "CFILEMODE='644'"
- regexp: '^dc_use_split_config'
line: "dc_use_split_config='false'"
- regexp: '^dc_hide_mailname'
line: "dc_hide_mailname='true'"
- regexp: '^dc_mailname_in_oh'
line: "dc_mailname_in_oh='true'"
- regexp: '^dc_localdelivery'
line: "dc_localdelivery='mail_spool'"
notify: restart-exim
create: yes
mode: '0644'
notify: update exim configuration
register: exim_config
- name: Update exim configuration
command: update-exim4.conf
when: exim_config.changed
- name: Sending mail to verify relay host configuration works
shell: >
echo "If you see this message, relayhost on {{ ansible_fqdn }} has been configured correctly." \
| mailx -s "Relayhost test for {{ ansible_fqdn }}" "{{ sysadmin_mail }}"
when: exim_config.changed
when: exim_config.changed

View File

@ -8,4 +8,4 @@
- { question: "tzdata/Areas", value: "Europe" }
- { question: "tzdata/Zones/Europe", value: "Madrid" }
- { question: "tzdata/Zones/Etc", value: "UTC" }
notify: Reconfigure tzdata
notify: reconfigure tzdata