libvirt_cloud/roles/ansible-gentoo_install/tasks/misc.yml

132 lines
3.3 KiB
YAML
Raw Normal View History

2023-12-29 19:40:31 +00:00
# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: ansible-gentoo_install/tasks/ misc.yml"
debug:
verbosity: 1
msg: "DEBUG: ansible-gentoo_install/tasks/ misc.yml"
- name: test we are in the chroot
shell: |
df | grep /mnt/gentoo && exit 1
- name: "make /mnt mountpoints"
shell: |
[ -d /mnt ] || mkdir /mnt || exit 1
for elt in {{ AGI_bootstrap_mountpoints|join(' ') }} ; do
[ -d $elt ] || mkdir $elt
done
2024-01-05 11:12:55 +00:00
# 700 files from ansible umask
find /usr/local/*bin/ /usr/local/etc/ -name '*sh' -exec chmod 755 {} \;
2024-01-08 12:51:06 +00:00
find /usr/local/{src,bin,share,etc} -type f \
-exec chown ${BOX_USER_NAME}:${BOX_USER_GROUP} {} \;
2024-01-05 11:12:55 +00:00
2023-12-29 19:40:31 +00:00
exit 0
when: AGI_bootstrap_mountpoints|default([])|length > 0
- name: configure timezone
lineinfile:
dest: /etc/timezone
line: "{{ AGI_install_timezone }}"
regexp: '^'
create: yes
owner: root
mode: '0644'
- name: timezone symlink
file:
dest: /etc/localtime
src: /usr/share/zoneinfo/{{ AGI_install_timezone }}
state: link
2024-01-05 11:12:55 +00:00
force: no
2023-12-29 19:40:31 +00:00
- name: configure locales
lineinfile:
dest: /etc/locale.gen
line: "{{ item }}"
with_items: "{{ AGI_install_locales }}"
- name: generate locales
command: locale-gen
- name: set default locale
command: eselect locale set {{ AGI_install_locale_default }}
- name: configure root mount
mount:
name: /
src: "{{ AGI_install_disk }}p3"
fstype: ext4
state: present
opts: noatime
passno: 1
- name: configure boot mountpoint
mount:
name: /boot
src: "{{ AGI_install_disk }}p1"
fstype: ext2
state: present
opts: noatime,ro
dump: 1
passno: 2
- name: scramble root password
shell: |
echo "{{ AGI_install_root_password|default('root') }}" | \
openssl password -1 -stdin
register: root_password_out
- name: set root password
user:
name: root
password: "{{ root_password_out.stdout }}"
- name: scramble gentoo password
shell: |
echo "{{ AGI_install_gentoo_password|default('gentoo') }}" | \
openssl password -1 -stdin
register: gentoo_password_out
- name: set gentoo password
user:
name: gentoo
password: "{{ gentoo_password_out.stdout }}"
2024-01-02 02:13:28 +00:00
group: "{{ BOX_USER_GROUP }}"
append: true
groups: ['{{ BOX_ALSO_GROUP }}', 'wheel']
create_home: yes
shell: /bin/bash
#? usermod: user vagrant is currently used by process 2190
ignore_errors: true
2023-12-29 19:40:31 +00:00
- name: configure sudoers
lineinfile:
dest: /etc/sudoers
line: "%wheel ALL=(ALL:ALL) ALL"
regexp: '^# %wheel ALL=(ALL:ALL) ALL'
create: yes
owner: root
mode: '0640'
2024-01-02 02:13:28 +00:00
- name: make symlinks
shell: |
[ -e /var/db/repos/gentoo ] || \
ln -s /usr/portage /var/db/repos/gentoo
grep -q ^tmpfs /etc/fstab || \
echo >> /etc/fstab 'tmpfs /dev/shm tmpfs defaults,noexec,size=5% 0 0'
2023-12-29 19:40:31 +00:00
- block:
2023-12-30 22:09:49 +00:00
2023-12-29 19:40:31 +00:00
- name: make symlinks
shell: |
{% for elt in AGI_bootstrap_pkgs %}
[ -h {{ elt.to }} ] && continue
[ -d {{ elt.to }} ] && echo "WARN: {{ elt.to }} exists as a directory" && continue
parent=`dirname {{ elt.to }}`
[ -d $parent ] || mkdir -p $parent
#? -h-e
[ -h {{ elt.to }} ] || \
ln -s {{ elt.from }} {{ elt.to }}
{% endfor %}
when: AGI_bootstrap_pkgs|default([])|length > 0