solar/bootstrap/playbooks/pxe.yaml
Bogdan Dobrelya 467d84c620 Add centos7 docker support
* Separate OSTYPE specific tasks/files.
* Keep only common tasks and files in the
playbooks dir.

TODO pxe case to be working for centos as well
note, the cmtools.sh installs ansible 2.0.1.0
  in centos7, while we have 2.0.0.2 for ubuntu trusty
note, the base.yaml installs python-keystoneclient
  1:1.3.0-1.el7 from kilo-2 (no juno for centos7),
  while for ubuntu we have one from juno
note, there is no pygraphviz for centos7, see also
  https://bugs.launchpad.net/fuel/+bug/1510884

Closes-bug: #1548851

Change-Id: Icec5637f9242104322d1104725f9f132d1ca16f0
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
2016-03-02 11:16:23 +01:00

84 lines
3.7 KiB
YAML

---
# TODO(bogdando) centos/ubuntu split
- name: Setup dhcp server with bootstrap image
hosts: all
become: yes
vars:
tftp_root: /var/lib/tftp
dhcp_range_start: 10.0.0.42
dhcp_range_end: 10.0.0.53
dhcp_interface: eth1
pxe_netboot_image: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/pxelinux.0
pxe_netboot_menu: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/boot-screens/vesamenu.c32
insecure_pub_key: https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
insecure_pub_key_path: /tmp/ssh_insecure.pub
image_builder_path: /tmp/image_builder
http_ip: 10.0.0.2
http_port: 8000
supervisor_dir: /etc/supervisor/conf.d/
tasks:
# Istall and configure dnsmasq
- apt: update_cache=yes
- apt: name=dnsmasq state=present
- file: path={{tftp_root}} state=directory
- template: src=files/dnsmasq_pxe.conf dest=/etc/dnsmasq.d/pxe.conf
- service: name=dnsmasq state=restarted
- file: path="{{tftp_root}}/pxelinux.cfg" state=directory
- template: src=files/pxelinux.cfg dest="{{tftp_root}}/pxelinux.cfg/default"
# Prepare pxe configs and download pxe image
- get_url: url={{pxe_netboot_image}} dest="{{tftp_root}}/pxelinux.0"
- get_url: url={{pxe_netboot_menu}} dest="{{tftp_root}}/vesamenu.c32"
# Build image
- get_url: url={{insecure_pub_key}} dest={{insecure_pub_key_path}}
- apt: name=debootstrap state=present
- file: path={{tftp_root}}/ubuntu state=directory
- git: repo=https://github.com/Mirantis/fuel-bootstrap-image-builder dest={{image_builder_path}}
- shell: "{{image_builder_path}}/bin/fuel-bootstrap-image 2>&1 | tee /tmp/image_build.log"
environment:
BOOTSTRAP_SSH_KEYS: "{{insecure_pub_key_path}}"
DESTDIR: "{{tftp_root}}/ubuntu"
- file: path="{{tftp_root}}/ubuntu/{{item}}" mode=0644 state=file
with_items:
- initramfs.img
- linux
- root.squashfs
# Configure http server to load root
- apt: name=nginx state=present
- template: src=files/nginx.cfg dest=/etc/nginx/conf.d/pxe_image.conf
# Configure http server in order serve file in '/vagrant' directory
- template: src=files/nginx_vagrant_dir.cfg dest=/etc/nginx/conf.d/vagrant_dir.conf
- service: name=nginx state=restarted
# Install discovery service
- shell: pip install git+https://github.com/Mirantis/discovery.git
# Install bareon-api
# Workaround is required because pbr does not handle git-eggs correctly and fails to install fuel-agent
- shell: 'pip install git+git://github.com/gitfred/fuel-agent.git@iso-build#egg=fuel_agent'
- shell: pip install git+https://github.com/Mirantis/bareon-api.git
# Install and configure supervisor
- apt: name=supervisor state=present
- set_fact: {'name': 'discovery', 'cmd': 'discovery'}
- template: src=files/supervisor.conf dest={{supervisor_dir}}/discovery.conf
- set_fact: {'name': 'discovery-scan', 'cmd': 'discovery-scan --ssh_key /vagrant/tmp/keys/ssh_private'}
- template: src=files/supervisor.conf dest={{supervisor_dir}}/discovery-scan.conf
- set_fact: {'name': 'bareon-api', 'cmd': 'bareon-api'}
- template: src=files/supervisor.conf dest={{supervisor_dir}}/bareon-api.conf
- service: name=supervisor state=restarted
# Add nat rules so slaves have internet access via solar-dev
- shell: iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
# build IBP images
- shell: fa_build_image --image_build_dir /tmp/ibp --log-file /tmp/ibp-image-build.log -d --data_driver nailgun_build_image --input_data_file files/prov.json