Markus Katharina Brechtel 6 роки тому
джерело
коміт
0b971377de
10 змінених файлів з 254 додано та 0 видалено
  1. +75
    -0
      defaults/main.yml
  2. +10
    -0
      files/root/etc/motd
  3. +18
    -0
      tasks/build.yml
  4. +16
    -0
      tasks/customizable.yml
  5. +6
    -0
      tasks/main.yml
  6. +56
    -0
      tasks/prepare.yml
  7. +21
    -0
      tasks/setup.yml
  8. +45
    -0
      templates/debirf.conf.j2
  9. +3
    -0
      templates/packages.j2
  10. +4
    -0
      vars/main.yml

+ 75
- 0
defaults/main.yml Переглянути файл

@@ -0,0 +1,75 @@
debirf_profile: custom
debirf_label: "debirf-{{debirf_profile}}"

debirf_suite: stretch
debirf_distro: debian
debirf_mirror: http://deb.debian.org/debian

debirf_default_modules:
#- a0_add_extra_repos
#- a0_add_security_repos
#- a0_motd
- a0_prep-root
- install-kernel
- install-manpages
#- lock-root-passwd
#- mdadm
#- network
#- network-dhcp
#- root-bashrc
- z0_remove-locales
- z1_clean-root

# debirf_packages:
# - blktool
# - bonnie++
# - chntpw
# - cryptsetup
# - diskscan
# - dmidecode
# - dosfstools
# - e2tools
# - eject
# - ethtool
# - fancontrol
# - fatresize
# - flashrom
# - foremost
# - gddrescue
# - grub2
# - hdparm
# - hfsplus
# - hfsprogs
# - hfsutils
# - initramfs-tools-core
# - inteltool
# - lm-sensors
# - lsof
# - lsscsi
# - lvm2
# - memtester
# - msrtool
# - mtd-utils
# - ntfs-3g
# - nvramtool
# - parted
# - partimage
# - pciutils
# - rsync
# - screen
# - scrub
# - sdparm
# - sg3-utils
# - smartmontools
# - smp-utils
# - socat
# - squashfs-tools
# - superiotool
# - testdisk
# - testdisk
# - tofrodos
# - u-boot-tools
# - usbutils
# - wget
# - wipe
# - wodim

+ 10
- 0
files/root/etc/motd Переглянути файл

@@ -0,0 +1,10 @@
==================================================
Welcome to debirf: DEBian on InitRamFs

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
==================================================

+ 18
- 0
tasks/build.yml Переглянути файл

@@ -0,0 +1,18 @@
---

- name: debirf make
command: debirf make --new {{debirf_profile_directory}}
become: true
become_user: debirf
become_method: su
args:
chdir: "{{ debirf_home_directory }}"
register: _debirf_make_command

- name: copy kernel
copy:
src: "{{ _debirf_make_command.stderr_lines | map('regex_findall','^debirf> kernel: (.*)$') | list | json_query('[]') | first }}"
dest: "{{ debirf_kernel }}"
remote_src: yes
owner: debirf
group: debirf

+ 16
- 0
tasks/customizable.yml Переглянути файл

@@ -0,0 +1,16 @@
---

- name: customize nest/init
lineinfile:
path: "{{ debirf_profile_directory }}/nest/init"
regexp: '^unxz.*\/custom'
insertafter: '^unxz.*\/rootfs.*cpio'
line: cp -R /rootfs_include/* /newroot/

- name: create customizable initrd
shell: sh -c "cd {{ debirf_profile_directory }}/nest && find * | cpio --create -H newc" > {{debirf_initrd}}
become: true
become_user: debirf
become_method: su
args:
chdir: "{{ debirf_home_directory }}"

+ 6
- 0
tasks/main.yml Переглянути файл

@@ -0,0 +1,6 @@
---

- import_tasks: setup.yml
- import_tasks: prepare.yml
- import_tasks: build.yml
- import_tasks: customizable.yml

+ 56
- 0
tasks/prepare.yml Переглянути файл

@@ -0,0 +1,56 @@
---

- name: profile directory
file:
state: directory
path: "{{ debirf_profile_directory }}"
owner: debirf
group: debirf

- name: debirf configuration
template:
src: debirf.conf.j2
dest: "{{ debirf_profile_directory }}/debirf.conf"
owner: debirf
group: debirf

- name: packages
template:
src: packages.j2
dest: "{{ debirf_profile_directory }}/packages"
owner: debirf
group: debirf
when: debirf_packages is defined

- name: modules directory
file:
state: directory
path: "{{ debirf_profile_directory }}/modules"
owner: debirf
group: debirf

- name: default modules
file:
state: link
src: /usr/share/debirf/modules/{{item}}
dest: "{{ debirf_profile_directory }}/modules/{{item}}"
owner: debirf
group: debirf
with_items: "{{ debirf_default_modules }}"

# - name: profile
# copy:
# src: profile/
# dest: "{{ debirf_profile_directory }}"
# owner: debirf
# group: debirf
# when: debirf_example_profile is defined

# - name: set permissions
# file:
# owner: debirf
# group: debirf
# recurse: yes
# follow: no
# path: "{{ debirf_working_directory }}"
# state: directory

+ 21
- 0
tasks/setup.yml Переглянути файл

@@ -0,0 +1,21 @@
---

- name: apt debirf package present
apt:
pkg: debirf

- name: debirf user
user:
name: debirf
shell: /bin/bash
system: yes
create_home: yes
home: "{{ debirf_home_directory }}"

- name: ansible temp dir
file:
owner: debirf
group: debirf
path: "{{ debirf_home_directory }}/.ansible/tmp"
state: directory
mode: 0700

+ 45
- 0
templates/debirf.conf.j2 Переглянути файл

@@ -0,0 +1,45 @@
# DEBIRF configuration file: this will be sourced by bash

# Label for debirf system (for hostname and initrd). "debirf" will be
# used if unspecified.
#
DEBIRF_LABEL="{{ debirf_label }}"

# Where shoud debirf build the image? By default, debirf will build
# in the profile directory.
#
#DEBIRF_BUILDD=""

# What suite should be used? The default is determined by
# lsb_release, and falls back to "sid".
#
DEBIRF_SUITE="{{ debirf_suite }}"

# The default distro (eg. "debian" or "ubuntu") is based on the distro
# of the suite specified. If you want to use a suite from a
# non-Debian/Ubuntu distro, specify the distro explicitly here (all
# lowercase).
#
DEBIRF_DISTRO="{{ debirf_distro }}"

# What mirror should debirf pull the suite from? By default, this is
# based on the DEBIRF_DISTRO
# (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}").
#
DEBIRF_MIRROR="{{ debirf_mirror }}"

# What keyring should be used to verify the debootstrap for the
# specified suite? This is also based on the DEBIRF_DISTRO by
# default. If you are trying to build a non-Debian/Ubuntu version of
# debirf, then you will need to specify the keyring explicitly here if
# you want to verify the debootstrap. Otherwise, uncomment the
# variable but leave the definition blank to have debirf skip the
# debootstrap verification.
#
#DEBIRF_KEYRING=

# Use a web proxy for downloading the packages (the "export" in front
# of the variable is necessary to have it recognized by all internal
# functions).
#
#export http_proxy=

+ 3
- 0
templates/packages.j2 Переглянути файл

@@ -0,0 +1,3 @@
{% for pkg in debirf_packages %}
+{{pkg}}
{% endfor %}

+ 4
- 0
vars/main.yml Переглянути файл

@@ -0,0 +1,4 @@
debirf_home_directory: /var/lib/debirf
debirf_profile_directory: "{{ debirf_home_directory }}/{{debirf_profile}}"
debirf_kernel: "{{ debirf_profile_directory }}/kernel"
debirf_initrd: "{{ debirf_profile_directory }}/initrd"