Parcourir la source

current

master
révision
e940167696
8 fichiers modifiés avec 179 ajouts et 0 suppressions
  1. +3
    -0
      defaults/main.yml
  2. +49
    -0
      files/1160-openssh-server
  3. +102
    -0
      tasks/main.yml
  4. +3
    -0
      templates/common.list.chroot.j2
  5. +3
    -0
      templates/custom.list.chroot.j2
  6. +5
    -0
      templates/isolinux.cfg.j2
  7. +11
    -0
      templates/lb-config-args.j2
  8. +3
    -0
      vars/main.yml

+ 3
- 0
defaults/main.yml Voir le fichier

@@ -0,0 +1,3 @@
live_build_serial: no
live_build_bootappend_live: boot=live components quiet {{ live_build_serial | ternary('console=ttyS0','') }} hostname={{ live_build_hostname }}
live_build_hostname: "{{ inventory_hostname }}"

+ 49
- 0
files/1160-openssh-server Voir le fichier

@@ -0,0 +1,49 @@
#!/bin/sh

## live-config(7) - System Configuration Components
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.


#set -e

Init ()
{
# Checking if package is installed or already configured
if [ ! -e /var/lib/dpkg/info/openssh-server.list ] || \
[ -e /var/lib/live/config/openssh-server ]
then
exit 0
fi

echo -n " openssh-server"
}

Config ()
{
for _PROTOCOL in dsa rsa ecdsa ed25519
do
if [ ! -e /etc/ssh/ssh_host_${_PROTOCOL}_key ] &&
grep -qs ssh_host_${_PROTOCOL}_key /etc/ssh/sshd_config
then
ssh-keygen -q -f /etc/ssh/ssh_host_${_PROTOCOL}_key -N "" -t ${_PROTOCOL}

_SSH="true"
fi
done

sed -i -e 's|#\(PasswordAuthentication\) yes|\1 no|' /etc/ssh/sshd_config

case "${_SSH}" in
true)
# Creating state file
touch /var/lib/live/config/openssh-server
;;
esac
}

Init
Config

+ 102
- 0
tasks/main.yml Voir le fichier

@@ -0,0 +1,102 @@
---

- setup:
gather_subset: '!all'

- name: install apt packages
apt:
pkg: "{{ item }}"
state: installed
with_items:
- live-build
- memtest86
- memtest86+

- name: live build directory
file:
path: "{{ live_build_directory }}"
state: directory

- name: remove config directory
file:
path: "{{ live_build_directory }}/config"
state: absent

- name: lb clean
command:
lb clean
args:
chdir: "{{ live_build_directory }}"

- name: lb config
command:
lb config
{{ lookup('template','lb-config-args.j2') }}
args:
chdir: "{{ live_build_directory }}"

- name: ssh root access
include_role:
name: ssh_root_access
vars:
root_target_directory: "{{ live_build_directory }}/config/includes.chroot/"

- name: keyboard configuration
include_role:
name: keyboard_configuration
vars:
root_target_directory: "{{ live_build_directory }}/config/includes.chroot/"
when: live_build_serial == false

- name: include common packages
template:
src: common.list.chroot.j2
dest: "{{ live_build_directory }}/config/package-lists/common.list.chroot"

- name: include console-setup package
copy:
content: console-setup
dest: "{{ live_build_directory }}/config/package-lists/console-setup.list.chroot"
when: live_build_serial == false

- name: include custom packages
template:
src: custom.list.chroot.j2
dest: "{{ live_build_directory }}/config/package-lists/custom.list.chroot"
when: live_build_custom_packages is defined

- name: isolinx directory
file:
path: "{{ live_build_directory }}/config/includes.binary/isolinux"
state: directory

- name: isolinux.cfg
template:
src: isolinux.cfg.j2
dest: "{{ live_build_directory }}/config/includes.binary/isolinux/isolinux.cfg"

- name: fix debian jessie generate ssh host ed25519 keys directory
file:
path: "{{ live_build_directory }}/config/includes.chroot/lib/live/config"
state: directory
when: ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie'

- name: fix debian jessie generate ssh host ed25519 keys
copy:
src: 1160-openssh-server
dest: "{{ live_build_directory }}/config/includes.chroot/lib/live/config/1160-openssh-server"
mode: 755
when: ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie'
- name: lb build
command:
lb build
args:
chdir: "{{ live_build_directory }}"
register: _lb_build

- name: save build log
copy:
content: "{{ _lb_build.stdout }}"
dest: "{{ live_build_directory }}/build.log"


+ 3
- 0
templates/common.list.chroot.j2 Voir le fichier

@@ -0,0 +1,3 @@
{% for package in live_build_common_packages %}
{{package}}
{% endfor %}

+ 3
- 0
templates/custom.list.chroot.j2 Voir le fichier

@@ -0,0 +1,3 @@
{% for package in live_build_custom_packages %}
{{package}}
{% endfor %}

+ 5
- 0
templates/isolinux.cfg.j2 Voir le fichier

@@ -0,0 +1,5 @@
include live.cfg
default live-amd64
{% if live_build_serial == true %}
serial 0
{% endif %}

+ 11
- 0
templates/lb-config-args.j2 Voir le fichier

@@ -0,0 +1,11 @@
{% if live_build_distribution is defined %}
--distribution "{{ live_build_distribution }}"
{% endif %}
{% if live_build_archive_areas is defined %}
--archive-areas "{{ live_build_archive_areas | join(' ') }}"
{% endif %}
--mirror-bootstrap {{ debian_mirror }}
--mirror-binary {{ debian_mirror }}
{% if live_build_bootappend_live is defined %}
--bootappend-live "{{ live_build_bootappend_live }}"
{% endif %}

+ 3
- 0
vars/main.yml Voir le fichier

@@ -0,0 +1,3 @@
live_build_common_packages:
- task-ssh-server
- python

Chargement…
Annuler
Enregistrer