diff --git a/README.md b/README.md index 174ba57..da1149c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,78 @@ -# examples-os2 +# Linux Operating System +Instances of Ubuntu with Linux-based tools + +## LabInstance os2 + + +![alt text](images/swarmlab-network.png "") + + + + +[inspired by NLKNguyen](https://github.com/NLKNguyen/alpine-mpich) + + +## Quickstart + +This is a quickstart guide of howto use this *Lab* + + + +### Default Configuration + +- Working Directory + +> /home/ubuntu + +- Default user + +> ubuntu + + +- Publish yoy work + +--- +**INFO** + + +Usage: + +> +> mkdir /home/ubuntu/directory +> put you files in that directory +> swarmlab-publish /home/ubuntu/directory +> open URL in Browser +> + +--- + + +- The host file that contains addresses of connected workers can be created with: + +> +> swarmlab-getworkers > /home/ubuntu/invhosts +> + +- connect to workers + +> +> ssh ubuntu@[IP] +> user has sudo rights +> + + +- connect to workers with ansible + +```bash +cd /home/ubuntu/project/examples-os2/ansible + make ps +``` +--- + + +--- +**MORE INFO** + +See http://docs.swarmlab.io/SwarmLab-HowTos/labs/os2/index.adoc.html +--- diff --git a/ansible/Makefile b/ansible/Makefile new file mode 100644 index 0000000..d8bef6c --- /dev/null +++ b/ansible/Makefile @@ -0,0 +1,15 @@ +all: ps + +# current full path + DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))) + mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) + current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path)))) + +ps: + @echo "ps aux" ; \ + cat inv-template.yml > inv.yml ; \ + swarmlab-getworkers >> inv.yml ; \ + ansible-playbook -u ubuntu -inv.yml examples/ps.yml -f 5 --private-key=/home/ubuntu/.ssh/id_rsa ; \ + + + diff --git a/ansible/examples/ps.yml b/ansible/examples/ps.yml new file mode 100644 index 0000000..ffa6a8a --- /dev/null +++ b/ansible/examples/ps.yml @@ -0,0 +1,20 @@ +--- +- hosts: service + remote_user: ubuntu + vars: + user: "ubuntu" + + tasks: + + + - name: ps + become: yes + become_user: "{{ user }}" + command: ps aux + ignore_errors: yes + register: o + + + - name: ls o + debug: var=o.stdout_lines + diff --git a/ansible/inv-template.yml b/ansible/inv-template.yml new file mode 100644 index 0000000..893bdf2 --- /dev/null +++ b/ansible/inv-template.yml @@ -0,0 +1 @@ +[service] diff --git a/images/swarmlab-network.png b/images/swarmlab-network.png new file mode 100644 index 0000000..8a34610 Binary files /dev/null and b/images/swarmlab-network.png differ