Browse Source

ansible

master
test2 1 year ago
parent
commit
146017f4ba
5 changed files with 113 additions and 1 deletions
  1. +77
    -1
      README.md
  2. +15
    -0
      ansible/Makefile
  3. +20
    -0
      ansible/examples/ps.yml
  4. +1
    -0
      ansible/inv-template.yml
  5. BIN
      images/swarmlab-network.png

+ 77
- 1
README.md View File

@@ -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
- 0
ansible/Makefile View File

@@ -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
- 0
ansible/examples/ps.yml View File

@@ -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
- 0
ansible/inv-template.yml View File

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

BIN
images/swarmlab-network.png View File

Before After
Width: 1700  |  Height: 1180  |  Size: 80KB

Loading…
Cancel
Save