libvirt_cloud/roles/ansible-gentoo_install/tasks/network.yml
2023-12-29 19:40:31 +00:00

57 lines
1.3 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: ansible-gentoo_install network"
debug:
verbosity: 1
msg: "DEBUG: ansible-gentoo_install network"
- name: test we are in the chroot
shell: |
df | grep /mnt/gentoo && exit 1
- name: configure hostname
lineinfile:
dest: /etc/conf.d/hostname
line: 'hostname="{{ AGI_install_hostname }}"'
regexp: '^hostname='
- name: install netifrc
portage:
package: net-misc/netifrc
state: installed
- name: install DHCP client
portage:
package: net-misc/dhcpcd
state: installed
- name: configure network interfaces
lineinfile:
dest: /etc/conf.d/net
create: yes
owner: root
mode: '0644'
line: 'config_{{ item.key }}="{{ item.value.config }}"'
regexp: '^config_{{ item.key }}='
with_dict: "{{ AGI_install_network_interfaces }}"
loop_control:
label: "{{ item.key }}"
- name: create network interface init symlink
file:
path: /etc/init.d/net.{{ item.key }}
src: net.lo
force: yes
state: link
with_dict: "{{ AGI_install_network_interfaces }}"
loop_control:
label: "{{ item.key }}"
- name: start network interface at boot
service:
name: net.{{ item.key }}
enabled: true
with_dict: "{{ AGI_install_network_interfaces }}"
loop_control:
label: "{{ item.key }}"