Initial start at first step
A first stab of sort of the items and work required for a first step.
This commit is contained in:
parent
7785e9b115
commit
591e21ce78
@ -3,3 +3,10 @@ Repo for collaborating on a minimal ironic-based installer.
|
||||
Deets on the etherpad for now:
|
||||
https://etherpad.openstack.org/p/OJYjW3fU9Q
|
||||
|
||||
Step 1:
|
||||
|
||||
cd step1
|
||||
bash ./env-setup.sh
|
||||
source /opt/stack/ansible/hacking/env-setup
|
||||
ansible-playbook -vvvv -i localhost ./install.yaml
|
||||
|
||||
|
13
step1/env-setup.sh
Normal file
13
step1/env-setup.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
sudo apt-get -y install git
|
||||
mkdir /opt/stack
|
||||
cd /opt/stack
|
||||
if [ ! -d ansible ]; then
|
||||
git clone git://github.com/ansible/ansible.git --recursive
|
||||
else
|
||||
cd ansible
|
||||
git pull --rebase
|
||||
git submodule update --init --recursive
|
||||
fi
|
||||
echo
|
||||
echo "source /opt/stack/ansible/hacking/env-setup to proceed"
|
64
step1/install.yml
Normal file
64
step1/install.yml
Normal file
@ -0,0 +1,64 @@
|
||||
# Written expecting APT based packaging, however would be trivial to
|
||||
# extend another packaging system
|
||||
---
|
||||
- hosts: localhost
|
||||
name: "Install services required for ironic"
|
||||
sudo: yes
|
||||
gather_facts: no
|
||||
# Todo: Rip vars out, refactor.
|
||||
vars:
|
||||
- driver: "abcd"
|
||||
- dhcp_interface: "egfh"
|
||||
- ironic_db_password: aSecretPassword473z
|
||||
- mysql_password: password
|
||||
tasks:
|
||||
- name: "Update Package Cache"
|
||||
local_action: apt update_cache=yes
|
||||
- name: "Install packages"
|
||||
local_action: apt name={{ item }}
|
||||
with_items:
|
||||
- mysql-server
|
||||
- dhcpd
|
||||
- tftp-hpa
|
||||
- rabbitmq-server
|
||||
- python-pip
|
||||
- python-mysqldb
|
||||
- python-configparser
|
||||
- name: "Ensuring /opt/stack is present"
|
||||
local_action: file name=/opt/stack state=directory owner=root group=root
|
||||
- name: "Downloading ironic"
|
||||
local_action: command git clone https://git.openstack.org/openstack/ironic chdir=/opt/stack creates=/opt/stack/ironic
|
||||
- name: "Install ironic client"
|
||||
local_action: pip name=python-ironicclient state=present
|
||||
- name: "Starting MySQL"
|
||||
local_action: service name=mysql state=started
|
||||
- name: "Starting rabbitmq-server"
|
||||
local_action: service name=rabbitmq-server state=started
|
||||
- name: "MySQL - Creating DB"
|
||||
local_action: mysql_db login_user=root login_password={{ mysql_password }} name=ironic state=present encoding=utf8
|
||||
register: test_created_db
|
||||
no_log: True
|
||||
- name: "MySQL - Creating user for Ironic"
|
||||
local_action: mysql_user login_user=root login_password={{ mysql_password }} name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present
|
||||
no_log: True
|
||||
- name: "Install Ironic"
|
||||
local_action: pip name=/opt/stack/ironic state=present
|
||||
- name: "Ensure /etc/ironic exists"
|
||||
local_action: file name=/etc/ironic state=directory
|
||||
- name: "Place Ironic Config file"
|
||||
local_action: template src=templates/ironic.conf.j2 dest=/etc/ironic/ironic.conf
|
||||
- name: "Creating Ironic DB Schema"
|
||||
local_action: command ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
|
||||
when: test_created_db.changed == true
|
||||
- name: "Upgrading Ironic DB Schema"
|
||||
local_action: command ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade
|
||||
when: test_created_db.changed == false
|
||||
- name: "Creating an ironic service group"
|
||||
local_action: group name=ironic
|
||||
- name: "Creating an ironic service user"
|
||||
local_action: user name=ironic group=ironic
|
||||
- name: "Placing services"
|
||||
local_action: template src=templates/init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root
|
||||
with_items:
|
||||
- { service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
||||
- { service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
1
step1/localhost
Normal file
1
step1/localhost
Normal file
@ -0,0 +1 @@
|
||||
localhost
|
10
step1/templates/init_template.j2
Normal file
10
step1/templates/init_template.j2
Normal file
@ -0,0 +1,10 @@
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
pre-start script
|
||||
mkdir -p /var/run/{{ item.username }}
|
||||
chown -R {{ item.username }}:{{ item.username }} /var/run/{{ item.username }}
|
||||
end script
|
||||
respawn
|
||||
respawn limit 2 10
|
||||
|
||||
exec start-stop-daemon --start -c {{ item.username }} --exec /usr/local/bin/{{ item.service_name }} -- {{ item.args }}
|
1346
step1/templates/ironic.conf.j2
Normal file
1346
step1/templates/ironic.conf.j2
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user