feat(network): Create separate networking playbook
This commit is contained in:
parent
f77a5c4e33
commit
457fb3517a
3 changed files with 42 additions and 16 deletions
29
host.yaml
29
host.yaml
|
|
@ -12,7 +12,20 @@
|
||||||
# community.general.btrfs_subvolume:
|
# community.general.btrfs_subvolume:
|
||||||
# state: present
|
# state: present
|
||||||
# name: "/@"
|
# name: "/@"
|
||||||
# filesystem_uuid: "{{ btrfs_target }}"
|
# filesystem_uuid: "{{ btrfs_root_uuid }}"
|
||||||
|
# # - name: Mount /boot part into voidroot mount
|
||||||
|
# - name: Mount btrfs subvol into mountdir
|
||||||
|
# vars:
|
||||||
|
# boot_dev_uuid:
|
||||||
|
# ansible.posix.mount:
|
||||||
|
# src: "{{ item.src }}"
|
||||||
|
# path: "{{ item.path }}"
|
||||||
|
# fstype: "{{ item.fstype }}"
|
||||||
|
# state: mounted
|
||||||
|
# with_items:
|
||||||
|
# - { fstype: 'ext4', src: '/dev/mapper/{{ vgname }}-root', path: '{{ mount_dir }}/' }
|
||||||
|
# # TODO: should take opts from fstab. Definitely needs 'boot' type option
|
||||||
|
# - { fstype: 'vfat', src: '/dev/disk/by-uuid/{{ boot_dev_uuid }}', path: '{{ mount_dir }}/boot' }
|
||||||
|
|
||||||
- name: Create voidlinux guest
|
- name: Create voidlinux guest
|
||||||
hosts: host
|
hosts: host
|
||||||
|
|
@ -28,17 +41,3 @@
|
||||||
dest: "{{ mount_dir }}"
|
dest: "{{ mount_dir }}"
|
||||||
# ONLY run if this file does not exist (could use any rootfs file to check)
|
# ONLY run if this file does not exist (could use any rootfs file to check)
|
||||||
creates: "{{ mount_dir }}/etc/os-release"
|
creates: "{{ mount_dir }}/etc/os-release"
|
||||||
|
|
||||||
# - name: Mount /boot part into voidroot mount
|
|
||||||
|
|
||||||
# TODO: Should be removed again at the end?
|
|
||||||
# However only after the whole PLAYBOOK has run not after this play
|
|
||||||
# not sure how to accomplish, see
|
|
||||||
# https://newbe.dev/run-an-ansible-handler-only-once-for-the-entire-playbook
|
|
||||||
# for possible solutions (especially lowest, hosts_to_restart example)
|
|
||||||
- name: Use archlinux resolvd for network access
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ mount_dir }}/etc/resolv.conf"
|
|
||||||
state: touch
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
- name: Import chroot void base tasks
|
- name: Import chroot void base tasks
|
||||||
ansible.builtin.import_playbook: void_base.yaml
|
ansible.builtin.import_playbook: void_base.yaml
|
||||||
|
|
||||||
|
- name: Import chroot void network tasks
|
||||||
|
ansible.builtin.import_playbook: void_network.yaml
|
||||||
|
|
||||||
- name: Import chroot user management tasks
|
- name: Import chroot user management tasks
|
||||||
ansible.builtin.import_playbook: void_user.yaml
|
ansible.builtin.import_playbook: void_user.yaml
|
||||||
|
|
||||||
|
|
|
||||||
24
void_network.yaml
Normal file
24
void_network.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
- name: Set up voidlinux networking
|
||||||
|
hosts: guest
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
ansible_chroot_exe: arch-chroot
|
||||||
|
nameserver1: 9.9.9.9
|
||||||
|
nameserver2: 9.9.9.10
|
||||||
|
tasks:
|
||||||
|
- name: Configure resolv DNS
|
||||||
|
ansible.builtin.copy:
|
||||||
|
mode: 0644
|
||||||
|
dest: "/etc/resolv.conf"
|
||||||
|
content: |
|
||||||
|
nameserver {{ nameserver1 }}
|
||||||
|
nameserver {{ nameserver2 }}
|
||||||
|
failed_when: false # can't ever fail
|
||||||
|
|
||||||
|
- name: Activate dhcp service
|
||||||
|
ansible.builtin.file:
|
||||||
|
force: 'yes'
|
||||||
|
src: "/etc/sv/{{ item }}"
|
||||||
|
dest: "/etc/runit/runsvdir/default/{{ item }}"
|
||||||
|
state: link
|
||||||
|
with_items: [ dhcpcd ]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue