refs #8025 relayhost fixes, self vars moved to global

This commit is contained in:
Juan Ferrer 2024-09-24 10:25:40 +02:00
parent fffa279650
commit 29bfaf6b33
7 changed files with 35 additions and 18 deletions

View File

@ -1,10 +1,21 @@
awx_pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDjeIZVyppFK/dqOUa1PxgSeRVWk7MFmANYvSs+VHHnD4/BE//K8AxlxnyLl4e6jAcBFoIu1JLxbRKdOhx+Zgkq5OmEzp/XKzfEvnEU5CP+W2+5MwfkUQ3TetJsOoHiP/qYWPqqqfDFqNM1xs9am5Frv9BVu5pFiSO9oS14xVAlUOwnONQnRtAbuBOmMldpzxmuFY+Rs3G2MmokcOYrs5Z3TdCOG9bDGg8erzWklLW+aRYdXqMEZpwIZPcOFy6JXEyZ/9IpCLBN58IMr0RypFbgWb2Vo05iTI5j99Pzn//FgAhe6BXRyHSGOJ29hmKugt9sIY1N/H6aYqtTVR5EEIngY1XHtFywU1+qtYHMs8PB9Hl87zUkla0+S5Zn8q92y7DQFsOZ9ND6syEzWhiCP1ic3Wo76TVbuNoTW/XvgZnemx1epuOqDj9S7iGTSHMvvSop8z5hU2EQiVkgRPl4cM2fi0vF513ivq5IbCgg2VfXUOLM5E5y0TI7lzBriTtCuIk= awx@awx.verdnatura.es sysadmin_mail: sysadmin@verdnatura.es
smtp_server: smtp.verdnatura.es
dc_net: "10.0.0.0/16"
resolv: resolv:
domain: verdnatura.es domain: verdnatura.es
search: verdnatura.es search: verdnatura.es
resolvers: resolvers:
- '10.0.0.4' - '10.0.0.4'
- '10.0.0.5' - '10.0.0.5'
awx_pub_key: >
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDjeIZVyppFK/dqOUa1PxgSeRVWk7MFmANYvSs+VHHn
D4/BE//K8AxlxnyLl4e6jAcBFoIu1JLxbRKdOhx+Zgkq5OmEzp/XKzfEvnEU5CP+W2+5MwfkUQ3TetJs
OoHiP/qYWPqqqfDFqNM1xs9am5Frv9BVu5pFiSO9oS14xVAlUOwnONQnRtAbuBOmMldpzxmuFY+Rs3G2
MmokcOYrs5Z3TdCOG9bDGg8erzWklLW+aRYdXqMEZpwIZPcOFy6JXEyZ/9IpCLBN58IMr0RypFbgWb2V
o05iTI5j99Pzn//FgAhe6BXRyHSGOJ29hmKugt9sIY1N/H6aYqtTVR5EEIngY1XHtFywU1+qtYHMs8PB
9Hl87zUkla0+S5Zn8q92y7DQFsOZ9ND6syEzWhiCP1ic3Wo76TVbuNoTW/XvgZnemx1epuOqDj9S7iGT
SHMvvSop8z5hU2EQiVkgRPl4cM2fi0vF513ivq5IbCgg2VfXUOLM5E5y0TI7lzBriTtCuIk=
awx@awx.verdnatura.es
nslcd_password: !vault | nslcd_password: !vault |
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
30343461633538323832316231383362626636653864353535346461353937313131336135396162 30343461633538323832316231383362626636653864353535346461353937313131336135396162

View File

@ -8,4 +8,4 @@
var: ansible_facts var: ansible_facts
- name: Print variable value - name: Print variable value
debug: debug:
msg: "Variable: {{ ansible_virtualization_type }}" msg: "Variable: {{ awx_pub_key }}"

View File

@ -1,11 +1,11 @@
exim_dc_eximconfig_configtype: satellite exim_dc_eximconfig_configtype: satellite
dc_other_hostnames: "{{ ansible_nodename }}" dc_other_hostnames: "{{ ansible_fqdn }}"
dc_local_interfaces: 127.0.0.1 dc_local_interfaces: 127.0.0.1
dc_readhost: "{{ ansible_nodename }}" dc_readhost: "{{ ansible_fqdn }}"
dc_relay_domains: "" dc_relay_domains: ""
dc_minimaldns: false dc_minimaldns: false
dc_relay_nets: "" dc_relay_nets: ""
dc_smarthost: smtp.verdnatura.es dc_smarthost: "{{ smtp_server }}"
CFILEMODE: 644 CFILEMODE: 644
dc_use_split_config: false dc_use_split_config: false
dc_hide_mailname: true dc_hide_mailname: true

View File

@ -1,8 +1,9 @@
- import_tasks: install.yml - import_tasks: install.yml
- import_tasks: sudoers.yml - import_tasks: locale.yml
- import_tasks: tzdata.yml
- import_tasks: motd.yml - import_tasks: motd.yml
- import_tasks: profile.yml - import_tasks: profile.yml
- import_tasks: vim.yml - import_tasks: vim.yml
- import_tasks: locale.yml - import_tasks: sudoers.yml
- import_tasks: tzdata.yml
- import_tasks: nrpe.yml - import_tasks: nrpe.yml
- import_tasks: relayhost.yml

View File

@ -2,7 +2,7 @@
apt: apt:
name: exim4 name: exim4
state: present state: present
- name: Reconfigure relayhost - name: Prepare exim configuration
lineinfile: lineinfile:
dest: /etc/exim4/update-exim4.conf.conf dest: /etc/exim4/update-exim4.conf.conf
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
@ -13,11 +13,11 @@
- regexp: '^dc_eximconfig_configtype' - regexp: '^dc_eximconfig_configtype'
line: "dc_eximconfig_configtype='{{ exim_dc_eximconfig_configtype }}'" line: "dc_eximconfig_configtype='{{ exim_dc_eximconfig_configtype }}'"
- regexp: '^dc_other_hostnames' - regexp: '^dc_other_hostnames'
line: "dc_other_hostnames='{{ dc_other_hostnames }}'.verdnatura.es" line: "dc_other_hostnames='{{ dc_other_hostnames }}'"
- regexp: '^dc_local_interfaces' - regexp: '^dc_local_interfaces'
line: "dc_local_interfaces='{{ dc_local_interfaces }}'" line: "dc_local_interfaces='{{ dc_local_interfaces }}'"
- regexp: '^dc_readhost' - regexp: '^dc_readhost'
line: "dc_readhost='{{ dc_readhost }}'.verdnatura.es" line: "dc_readhost='{{ dc_readhost }}'"
- regexp: '^dc_relay_domains' - regexp: '^dc_relay_domains'
line: "dc_relay_domains='{{ dc_relay_domains }}'" line: "dc_relay_domains='{{ dc_relay_domains }}'"
- regexp: '^dc_minimaldns' - regexp: '^dc_minimaldns'
@ -37,7 +37,12 @@
- regexp: '^dc_localdelivery' - regexp: '^dc_localdelivery'
line: "dc_localdelivery='{{ dc_localdelivery }}'" line: "dc_localdelivery='{{ dc_localdelivery }}'"
notify: restart-exim notify: restart-exim
register: exim4_config register: exim_config
- name: Sending mail to verify exim4 config works - name: Update exim configuration
shell: echo "Verify send email from host {{ ansible_nodename }}.verdnatura.es with mailx , bye." | mailx -s "test mail verify exim4 for the host {{ ansible_nodename }}.verdnatura.es" -c rubenb@verdnatura.es,nada@verdnatura.es,juan@verdnatura.es,davidl@verdnatura.es sysadmin@verdnatura.es command: update-exim4.conf
when: exim4_config.changed 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

View File

@ -1,8 +1,8 @@
fail2ban: fail2ban:
email: sysamdmin@verdnatura.es email: "{{ sysadmin_mail }}"
bantime: 600 bantime: 600
maxretry: 4 maxretry: 4
ignore: 127.0.0.0/8 10.0.0.0/16 ignore: "127.0.0.0/8 {{ dc_net }}"
vn_host: vn_host:
url: http://apt.verdnatura.es/pool/main/v/vn-host url: http://apt.verdnatura.es/pool/main/v/vn-host
package: vn-host_2.0.2_all.deb package: vn-host_2.0.2_all.deb

View File

@ -4,7 +4,7 @@
port: 465 port: 465
username: awx@verdnatura.es username: awx@verdnatura.es
password: "{{ awx_smtp_password }}" password: "{{ awx_smtp_password }}"
to: sysadmin@verdnatura.es to: "{{ sysadmin_mail }}"
subject: Ansible-test subject: Ansible-test
body: System {{ ansible_hostname }} has been send successfully mail. body: System {{ ansible_hostname }} has been send successfully mail.
delegate_to: localhost delegate_to: localhost