Commit 08f2c96f authored by Pietsch, Martin's avatar Pietsch, Martin

move commit

parents
Description
===========
This role installs and manages a PXE bootloader based on syslinux.
Requirement
===========
Variables
---------
- pxelinux_root_path:
- description:
- path to TFTP root directory
- pxelinux_image_distribution:
- description:
- contains the image distribution to be (un)registered or (re)set
- pxelinux_image_architecture:
- description:
- contains the image architecture to be (un)registered or (re)set
- pxelinux_image_release:
- description:
- contains the image release to be (un)registered or (re)set
- pxelinux_image_buildpath:
- description:
- contains the build path of the image on host to be (un)registered or (re)set
- pxelinux_image_boothost:
- description:
- inventory name of the host which should boot the given image
Process
=======
main
----
1. create pxelinux's root directory
2. create subdirectories for boot images and configuration files
3. install pxelinux files to root directory
4. run configuration tasks
configure
---------
1. install configuration file for default boot
registerimage
-------------
1. copy image from `pxelinux_image_buildpath` to image directory
2. create configuration file for image
unregisterimage
---------------
1. delete image from image directory
2. delete configuration file for image
setimage
--------
1. copy configuration file of image to file named by the MAC-address of host
resetimage
----------
1. delete file named by the MAC-address of host
---
# defaults file for package.pxeboot.syslinux/
\ No newline at end of file
File added
DEFAULT BOOTOS
LABEL BOOTOS
COM32 chain.c32
APPEND hd0 0
File added
---
# handlers file for package.pxeboot.syslinux/
\ No newline at end of file
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
\ No newline at end of file
- name: create default file for pxelinux
copy:
src: "default"
dest: "{{ '%s/pxelinux.cfg/default' | format(pxelinux_root_path) }}"
mode: 0755
---
- name: create directory for pxelinux
file:
path: "{{ pxelinux_root_path }}"
state: directory
recurse: yes
mode: 0755
- name: create configuration file directory for pxelinux
file:
path: "{{ '%s/pxelinux.cfg' | format(pxelinux_root_path) }}"
state: directory
mode: 0755
- name: create directory for image files of pxelinux
file:
path: "{{ '%s/images' | format(pxelinux_root_path) }}"
state: directory
mode: 0755
- name: install pxelinux
copy:
src: "{{ item }}"
dest: "{{ '%s/%s' | format(pxelinux_root_path, item) }}"
mode: 0644
with_items:
- "chain.c32"
- "ldlinux.c32"
- "libcom32.c32"
- "libutil.c32"
- "memdisk"
- "pxelinux.0"
- include_tasks: configure.yml
---
- name: register image file
copy:
src: "{{ pxelinux_image_buildpath }}"
dest: "{{ '%s/images/%s-%s-%s.img' | format(pxelinux_root_path, pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}"
mode: 0644
remote_src: yes
- template:
src: "pxelinux.cfg.j2"
dest: "{{ '%s/pxelinux.cfg/%s-%s-%s' | format(pxelinux_root_path, pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}"
mode: 0644
---
- name: reset image file for host {{ pxelinux_image_boothost }}
file:
path: "{{ '%s/pxelinux.cfg/01-%s' | format(pxelinux_root_path, hostvars[pxelinux_image_boothost].network.devices[host.network.control_device].mac | replace(':','-')) }}"
state: absent
---
- name: set image file for host {{ pxelinux_image_boothost }}
copy:
src: "{{ '%s/pxelinux.cfg/%s-%s-%s' | format(pxelinux_root_path, pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}"
dest: "{{ '%s/pxelinux.cfg/01-%s' | format(pxelinux_root_path, hostvars[pxelinux_image_boothost].network.devices[host.network.control_device].mac | replace(':','-')) }}"
mode: 0644
remote_src: yes
---
- name: unregister image file
file:
path: "{{ '%s/images/%s-%s-%s.img' | format(pxelinux_root_path, pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}"
state: absent
- file:
path: "{{ '%s/pxelinux.cfg/%s-%s-%s' | format(pxelinux_root_path, pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}"
state: absent
{{ 'DEFAULT %s' | format(pxelinux_image_distribution) }}
{{ 'LABEL %s' | format(pxelinux_image_distribution) }}
kernel memdisk
{{ 'append initrd=images/%s-%s-%s.img harddisk raw' | format(pxelinux_image_distribution, pxelinux_image_release, pxelinux_image_architecture) }}
---
- hosts: localhost
remote_user: root
roles:
- package.pxeboot.syslinux/
\ No newline at end of file
---
# vars file for package.pxeboot.syslinux/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment