vn-ansible/linux/base-config-debian/roles/base-config-debian-os/tasks/main.yaml

95 lines
2.3 KiB
YAML
Raw Normal View History

2023-10-13 11:24:56 +00:00
---
# change hostname
- name: change hostname
hostname:
name: "{{ hostname_name }}"
when: hostname_name is defined
2023-10-13 11:24:56 +00:00
# Reconfigure locales - enable en_US-UTF8 and es_ES-UTF8
- name: reconfigure locales enable en_US-UTF8 and es_ES-UTF8
debconf:
name: locales
question: locales/default_environment_locale
value: en_US-UTF8, es_ES-UTF8
vtype: multiselect
# Reconfigure timezone - Europe/Madrid
- name: reconfigure timezone Europe/Madrid
2023-10-13 11:45:50 +00:00
debconf:
name: tzdata
question: tzdata/Zones/Europe
value: Madrid
vtype: select
2023-10-13 11:24:56 +00:00
# update packages
- name: update packages
apt:
name: "*"
state: latest
2023-10-16 05:40:25 +00:00
update_cache: true
force_apt_get: true
2023-10-13 11:24:56 +00:00
# upgrade packages
- name: upgrade packages
apt:
upgrade: dist
state: latest
2023-10-16 05:40:25 +00:00
force_apt_get: true
2023-10-13 11:24:56 +00:00
2023-10-13 12:49:11 +00:00
# install packages
- name: install some packages (vim htop psmisc aptitude)
2023-10-13 11:24:56 +00:00
apt:
2023-10-13 12:49:11 +00:00
name: "{{ item }}"
2023-10-13 11:24:56 +00:00
state: present
2023-10-13 12:49:11 +00:00
with_items:
- vim
- htop
- psmisc
- aptitude
- nslcd
- exim4
2023-10-13 11:24:56 +00:00
# Reconfigure relayhost smtp to smtp.verdnatura.es
- name: reconfigure relayhost to smtp.verdnatura.es
debconf:
name: exim4-config
2023-10-13 12:49:11 +00:00
question: "{{ item.name }}"
value: "{{ item.value }}"
vtype: string
loop:
- name: exim4/dc_smarthost
value: smtp.verdnatura.es
- name: exim4/dc_local_interfaces
value: ""
- name: exim4/dc_minimaldns
value: 'false'
- name: exim4/dc_readhost
2023-10-16 06:55:21 +00:00
value: "{{ ansible_nodename }}" # var to define survey(encuesta)
2023-10-13 12:49:11 +00:00
- name: exim4/dc_other_hostnames
value: ""
- name: exim4/dc_eximconfig_configtype
value: "mail sent by smarthost; no local mail"
- name: exim4/mailname
2023-10-16 06:55:21 +00:00
value: "{{ ansible_nodename }}" # var to define survey(encuesta)
2023-10-13 12:49:11 +00:00
- name: exim4/use_split_config
value: 'false'
notify: Restart exim4 service
2023-10-16 06:08:52 +00:00
# Send mail to verify relay-host
2023-10-16 06:33:12 +00:00
#- name: sending mail to verify exim4 config works
# mail:
# host: smtp.verdnatura.es
# port: 465
# subject: Verify Ansible playbook deployment exim4
# body: Hello , this is an e-mail to verify exim4 config works on {{ ansible_facts['ansible_nodename'] }}
# to:
# - informatica@verdnatura.es
# - rubenb@verdnatura.es
# delegate_to: localhost
2023-10-16 06:08:52 +00:00
##
2023-10-13 12:49:11 +00:00
# configure centralized authentication
2023-10-16 06:08:52 +00:00
# Copy
# lineinfile password