Browse Source

ansible

master
test2 5 years ago
parent
commit
146017f4ba
  1. 78
      README.md
  2. 15
      ansible/Makefile
  3. 20
      ansible/examples/ps.yml
  4. 1
      ansible/inv-template.yml
  5. BIN
      images/swarmlab-network.png

78
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
---

15
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 ; \

20
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

1
ansible/inv-template.yml

@ -0,0 +1 @@
[service]

BIN
images/swarmlab-network.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Loading…
Cancel
Save