xoxys.network/tasks/config.yml
Robert Kaussow 5189b87321
All checks were successful
continuous-integration/drone/push Build is passing
use hostanem module instead of template
2020-11-23 21:42:14 +01:00

40 lines
1003 B
YAML

---
- block:
- name: Set hostname
hostname:
name: "{{ network_hostname }}"
when: network_hostname
notify: __host_reboot
- name: Set hosts file
template:
src: etc/hosts.j2
dest: /etc/hosts
owner: root
group: root
mode: 0644
notify: __host_reboot
- name: Add network interface configuration
template:
src: etc/sysconfig/network-scrips/ifcfg.j2
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.key }}"
owner: root
group: root
mode: 0644
loop: "{{ network_interfaces | dict2items }}"
loop_control:
label: "{{ item.key }}"
when: item.key in ansible_interfaces or item.key.split(":")[0] in ansible_interfaces
notify: __network_restart
- name: Set dns server
template:
src: etc/resolv.conf.j2
dest: /etc/resolv.conf
owner: root
group: root
mode: 0644
become: True
become_user: root