xoxys.network/tasks/config.yml

45 lines
876 B
YAML
Raw Normal View History

2017-05-18 23:10:07 +02:00
---
2017-12-10 17:11:05 +01:00
- name: Set hostname
2017-07-03 20:18:24 +02:00
template:
2018-06-24 14:43:53 +02:00
src: etc/hostname.j2
dest: /etc/hostname
2017-05-18 23:10:07 +02:00
owner: root
group: root
mode: 0644
register: hostname_result
2017-07-03 20:18:24 +02:00
notify:
2017-05-18 23:10:07 +02:00
- host_reboot
2017-12-10 17:11:05 +01:00
- name: Set hosts file
2017-07-03 20:18:24 +02:00
template:
2018-06-24 14:43:53 +02:00
src: etc/hosts.j2
dest: /etc/hosts
2017-05-18 23:10:07 +02:00
owner: root
group: root
2017-07-03 20:18:24 +02:00
mode: 0644
2017-05-18 23:10:07 +02:00
register: hosts_result
2017-07-03 20:18:24 +02:00
notify:
2017-05-18 23:10:07 +02:00
- host_reboot
2017-12-10 17:11:05 +01:00
- name: Add network interface configuration
2017-07-03 20:18:24 +02:00
template:
2018-06-24 14:43:53 +02:00
src: etc/sysconfig/network-scrips/ifcfg.j2
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.key }}"
2017-05-18 23:10:07 +02:00
owner: root
group: root
mode: 0644
2018-06-24 14:43:53 +02:00
with_dict: "{{ network_interfaces }}"
2017-12-09 13:41:26 +01:00
loop_control:
label: "{{ item.key }}"
2017-05-18 23:10:07 +02:00
when: item.key in ansible_interfaces
notify:
- network_restart
2017-07-14 13:24:33 +02:00
2017-12-10 17:11:05 +01:00
- name: Set dns server
2017-07-14 13:24:33 +02:00
template:
2018-06-24 14:43:53 +02:00
src: etc/resolv.conf.j2
dest: /etc/resolv.conf
2017-07-14 13:24:33 +02:00
owner: root
group: root
mode: 0644