xoxys.network/tasks/config.yml

45 lines
876 B
YAML
Raw Normal View History

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