Jump to: navigation, search

Difference between revisions of "OpenStack Upstream Training/Setup DevStack"

(Deploy OpenStack DevStack on a VM with a cloud-init script)
Line 1: Line 1:
* Save the file below in $HOME/devstack_cloudinit.yaml
+
* Download and save the [https://github.com/cloudwatt/openstack-cloudinit-templates/blob/master/OpenStack/devstack/deploy_devstack_all-in-one.yaml clud-init script] in $HOME/devstack_cloudinit.yaml
 
* nova boot --flavor 4GB-ram-10GB-disk --image "Ubuntu 14.04" --nic net-id=$NET_ID --key-name mykey --user-data $HOME/devstack_cloudinit.yaml test_devstack
 
* nova boot --flavor 4GB-ram-10GB-disk --image "Ubuntu 14.04" --nic net-id=$NET_ID --key-name mykey --user-data $HOME/devstack_cloudinit.yaml test_devstack
 
* When the VM started and the cloud-init script ran, the devstack script was running into a [http://tmux.sourceforge.net/ tmux] session with user 'stack' rights. Log onto that VM with SSH client and the user 'stack' (password 'stack') ''ssh -i mykey stack@<VM_PUBLIC_IP>'' and attach your session to the tmux with the command 'tmux attach'. You could also reach the Horizon web UI though a web browser on the public VM IP on HTTP port 80.
 
* When the VM started and the cloud-init script ran, the devstack script was running into a [http://tmux.sourceforge.net/ tmux] session with user 'stack' rights. Log onto that VM with SSH client and the user 'stack' (password 'stack') ''ssh -i mykey stack@<VM_PUBLIC_IP>'' and attach your session to the tmux with the command 'tmux attach'. You could also reach the Horizon web UI though a web browser on the public VM IP on HTTP port 80.
<pre>
 
#cloud-config
 
 
package_update: true
 
package_upgrade: true
 
package_reboot_if_required: true
 
 
packages:
 
  - git
 
  - mc
 
  - vim
 
  - traceroute
 
  - htop
 
  - tmux
 
  - nmap
 
 
ssh_pwauth: True
 
 
groups:
 
  - stack
 
 
users:
 
  - default
 
  - name: stack
 
    gecos: Foo User
 
    primary-group: stack
 
    groups: admin
 
    plain_text_passwd: 'stack'
 
    sudo: ALL=(ALL) NOPASSWD:ALL
 
    lock-passwd: false
 
    shell: /bin/bash
 
 
write_files:
 
-  content: |
 
        [[local|localrc]]
 
        disable_service n-net
 
        disable_service n-obj
 
        disable_service tempest
 
        disable_service cinder
 
        disable_service c-api
 
        disable_service c-vol
 
        disable_service c-sch
 
        #disable_service n-novnc
 
        enable_service horizon
 
        disable_service n-xvnc
 
        enable_service q-svc
 
        enable_service q-agt
 
        enable_service q-dhcp
 
        enable_service q-l3
 
        enable_service q-meta
 
        enable_service neutron
 
        #enable_service n-spice
 
        enable_service n-vnc
 
 
        ADMIN_PASSWORD=password
 
        MYSQL_PASSWORD=password
 
        RABBIT_PASSWORD=password
 
        SERVICE_PASSWORD=password
 
        SERVICE_TOKEN=tokentoken
 
 
        ROOTSLEEP=0
 
        RECLONE=True
 
        #OFFLINE=True
 
        DATA_DIR=$TOP_DIR/data
 
        SCREEN_LOGDIR=$TOP_DIR/log
 
        VERBOSE=False
 
 
        MULTI_HOST=True
 
        FIXED_RANGE=192.168.85.0/24
 
 
        ### NEUTRON ###
 
        ### ML2 plugin ###
 
        ENABLE_TENANT_TUNNELS=True
 
        Q_ML2_PLUGIN_MECHANISM_DRIVERS=linuxbridge
 
        Q_AGENT=linuxbridge
 
 
        Q_ML2_PLUGIN_TYPE_DRIVERS=flat,vlan,gre,vxlan
 
 
        # Prevent L3 agent from using br-ex
 
        PUBLIC_BRIDGE=
 
 
        # L2 population
 
        Q_ML2_PLUGIN_MECHANISM_DRIVERS=$Q_ML2_PLUGIN_MECHANISM_DRIVERS,l2population
 
 
        [[post-config|$NOVA_CONF]]
 
        [DEFAULT]
 
        vnc_enabled=True
 
        vnc_keymap=fr
 
        vncserver_listen=0.0.0.0
 
        vncserver_proxyclient_address=$HOST_IP
 
        libvirt_inject_key = False
 
        libvirt_inject_partition = -2
 
 
        [[post-config|/$Q_PLUGIN_CONF_FILE]]
 
        [ml2]
 
        tenant_network_types=vxlan
 
 
        [vxlan]
 
        enable_vxlan=true
 
        l2_population=True
 
        local_ip=$HOST_IP
 
 
        [linux_bridge]
 
        physical_interface_mappings = public:eth0
 
 
        [ml2_type_flat]
 
        flat_networks = public
 
 
        [ml2_type_vxlan]
 
        vni_ranges = 1001:2000
 
 
        [[post-config|/$Q_DHCP_CONF_FILE]]
 
        [DEFAULT]
 
        enable_isolated_metadata = True
 
        dnsmasq_dns_server = 8.8.8.8
 
        dnsmasq_config_file = /etc/dnsmasq.conf
 
 
        [[post-config|/$Q_L3_CONF_FILE]]
 
        [DEFAULT]
 
        external_network_bridge = ""
 
    path: /opt/local.conf
 
    permissions: 0664
 
-  content: |
 
        #!/usr/bin/env bash
 
 
        tmux new-session -s devstack -n shell -d
 
        tmux new-window -t devstack:1 -n devstack
 
        tmux send-keys -t devstack:1 'cd ~/devstack; ./stack.sh' C-m
 
        tmux select-window -t devstack:1
 
    path: /opt/run_devstack_into_tmux.sh
 
    permissions: 0775
 
 
runcmd:
 
  - [ sh, -xc, "echo '127.0.0.1 $(wget -q -O- http://169.254.169.254/latest/meta-data/hostname | cut -d .  -f 1)'' >> /etc/hosts" ]
 
  - [ sh, -xc, "su stack -c 'cd ~; git clone https://github.com/openstack-dev/devstack.git'" ]
 
  - [ sh, -xc, "su stack -c 'cp /opt/local.conf ~/devstack/'" ]
 
  - [ sh, -xc, "su stack -c 'bash /opt/run_devstack_into_tmux.sh'" ]
 
 
final_message: "!!! Your devstack is up and running. You can reach the OpenStack dashboard !!! (cloudinit runs in $UPTIME seconds)"
 
</pre>
 

Revision as of 08:40, 20 October 2014

  • Download and save the clud-init script in $HOME/devstack_cloudinit.yaml
  • nova boot --flavor 4GB-ram-10GB-disk --image "Ubuntu 14.04" --nic net-id=$NET_ID --key-name mykey --user-data $HOME/devstack_cloudinit.yaml test_devstack
  • When the VM started and the cloud-init script ran, the devstack script was running into a tmux session with user 'stack' rights. Log onto that VM with SSH client and the user 'stack' (password 'stack') ssh -i mykey stack@<VM_PUBLIC_IP> and attach your session to the tmux with the command 'tmux attach'. You could also reach the Horizon web UI though a web browser on the public VM IP on HTTP port 80.