mirror of
https://github.com/DO1JLR/ansible_playbook_servers.git
synced 2024-09-14 19:53:56 +02:00
29 lines
635 B
YAML
29 lines
635 B
YAML
---
|
|
|
|
- name: "set {{ inventory_hostname }} as hostname"
|
|
become: true
|
|
hostname:
|
|
name: "{{ inventory_hostname }}"
|
|
|
|
- name: Add hostname to /etc/hosts
|
|
become: true
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
regexp: "^127.0.1.1"
|
|
line: "127.0.1.1 {{ inventory_hostname }} {{ ansible_hostname }} {{ additional_dns_maildomains }}"
|
|
state: present
|
|
|
|
- name: Set /etc/mailname
|
|
become: true
|
|
copy:
|
|
dest: "/etc/mailname"
|
|
content: "{{ inventory_hostname }}"
|
|
|
|
- name: set own dns resolver
|
|
become: true
|
|
template:
|
|
src: templates/resolve.conf.j2
|
|
dest: /etc/resolv.conf
|
|
mode: 0644
|
|
owner: root
|
|
group: root
|