Download presentation
Presentation is loading. Please wait.
Published byMilo Gibson Modified over 9 years ago
1
Sponsored by the National Science Foundation Configuration Management For Experimenters: Ansible Hands-On Sarah Edwards, GPO
2
Sponsored by the National Science Foundation 2 What do experimenters need? Ensure experiment is in a known configuration Easily repeat existing experiment setups (for multiple runs, changing parameters, etc) Reproduce configuration across space and time Easy to build many nodes that look the same Useful for scaling up the size of topologies (space) Useful for rebuilding a topology repeatedly (time)
3
Sponsored by the National Science Foundation 3 CM Systems are Idempotent CM systems are usually idempotent Repeated runs generates the same state Contrast to a shell script which encodes how to transition between two known states The state is usually easy to describe. iperf should be (or not be) installed File foo.html should exist (or not) Describing all possible transitions from every possible previous state is hard. If iperf is not already installed, then install it, else do nothing Known State A Known State B Shell script A -> B Unknown State A Known State B ? CM Idempotent
4
Sponsored by the National Science Foundation 4 Ansible Setup Experimenter ssh Public key is stored on each remote machine Private key is stored on local machine Ansible client installed GENI Slice Inventory file describes substrate
5
Sponsored by the National Science Foundation 5 Using Ansible Ad Hoc mode Execute individual commands on one or more nodes Playbooks Enforce configurations written in YAML
6
Sponsored by the National Science Foundation 6 #!/bin/bash # Usual directory for downloading software in ProtoGENI hosts is `/local` cd /local #Get the hostname to see if we are at the server or the client hn=`echo $HOSTNAME | cut -d'.' -f 1` ##### Check if file is there ##### if [ ! -f "./installed.txt" ] then #### Create the file #### sh -i -c `sudo touch "./installed.txt"` #### Run one-time commands #### #Install necessary packages sudo apt-get update sudo apt-get -y install apache2 iperf & EPID=$! wait $EPID fi
7
Sponsored by the National Science Foundation 7 #!/bin/bash # Usual directory for downloading software in ProtoGENI hosts is `/local` cd /local #Get the hostname to see if we are at the server or the client hn=`echo $HOSTNAME | cut -d'.' -f 1` ##### Run Boot-time commands # Start services # If this is the server then start the iperf and configure and start the http server if [ $hn == "server" ] then # Enable web server stats sudo /usr/sbin/a2enmod status sudo rm /etc/apache2/mods-enabled/status.conf echo " " | sudo tee -a /etc/apache2/sites-available/default > /dev/null echo " SetHandler server-status" |sudo tee -a /etc/apache2/sites-available/default > /dev/null echo " Allow from all" | sudo tee -a /etc/apache2/sites-available/default > /dev/null echo " " | sudo tee -a /etc/apache2/sites-available/default > /dev/null echo "ExtendedStatus On" | sudo tee -a /etc/apache2/conf.d/extendedstatus > /dev/null # Copy the website under /var/www/ sudo cp -R./website/* /var/www/ sudo rm -rf /var/www/html sudo ln -s /var/www/ /var/www/html # Start the webserver sudo /usr/sbin/apache2ctl restart sudo service apache2 restart # Start the iperf server sudo mkdir -p /var/www/iperflogs iperf_server_log="/var/www/iperflogs/iperf-server.log" sudo bash -c "iperf -s -i 10 &> $iperf_server_log" else # If this is the client start the script for transfers # Wait 60 seconds just to give some time to the server to come up sleep 60./scripts/client-wget.sh&./scripts/client-iperf.sh& fi # Start my service -- assume it was installed at /usr/local/bin
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.