Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pkazi committed Sep 17, 2018
1 parent 535ea87 commit dd34183
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 39 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# DCOS Toolkit

## Everything related to mesos are listed here.

1. [Mesos](mesos/README.md)
1. [Scripts](scripts/README.md)
2. [Mesos](mesos/README.md)
39 changes: 3 additions & 36 deletions mesos/01-NodeAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,6 @@
or Check DCOS UI
Nodes => Select any Node => Details Tab

Automation Script :

```bash
#!/bin/bash

tmpScript=$(mktemp "/tmp/mesosNodeAttributes-XXXXXXXX")

ATTRIBUTES="$1"
NODES_FILE=$2

if [ "$#" -ne 2 ]; then
echo "[Error] Wrong usage. Missing required input parameters."
echo "[Error] Usage : $0 <; separated key:value pairs as node attributes> <File path where each node IP per line to add attributes>"
echo "[Error] Example : $0 <key1>:<value1>;<key2>:<value2> /path/to/nodes/ip/file"
exit 1
fi

if [ ! -f $NODES_FILE ]; then
echo "[Error] Input nodes IP file is not valid. Please check. Exiting."
ls -la $NODES_FILE
exit 1
fi

cat <<EOF > ${tmpScript}
echo "MESOS_ATTRIBUTES=${ATTRIBUTES}" | sudo tee /var/lib/dcos/mesos-slave-common
sudo systemctl stop dcos-mesos-slave
sudo rm -f /var/lib/mesos/slave/meta/slaves/latest
sudo systemctl start dcos-mesos-slave
EOF

for i in `cat $NODES_FILE`; do
echo $i
dcos node ssh --master-proxy --option StrictHostKeyChecking=no --private-ip $i <$tmpScript
sleep 10
done
```
## Automation Script

[addNodeAttributes.sh](../scripts/addNodeAttributes.sh)
16 changes: 16 additions & 0 deletions utils/README.md → scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,20 @@ Please input any one operation from : [ help addAWSKey agentsDetails publicIP sa
- runOnAllMasters
- Run user command on all dcos master nodes
- Usage : `bash dcosUtil.sh runOnAllMasters "<command to run, ex systemctl status filebeat.service>"`
```

[addNodeAttributes.sh](addNodeAttributes.sh)

```bash
# Usage :
$ addNodeAttributes.sh <; separated key:value pairs as node attributes> <File path where each node IP per line to add attributes>
# Example :
$ addNodeAttributes.sh <key1>:<value1>;<key2>:<value2> /path/to/nodes/ip/file

$ addNodeAttributes.sh "SERVER_TYPE:DB;DB_TYPE:POSTGRES" "/tmp/POSTGRES_NDOES.txt"

$ cat /tmp/POSTGRES_NDOES.txt
10.0.0.1
10.0.0.2
10.0.0.3
```
32 changes: 32 additions & 0 deletions scripts/addNodeAttributes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

tmpScript=$(mktemp "/tmp/mesosNodeAttributes-XXXXXXXX")

ATTRIBUTES="$1"
NODES_FILE=$2

if [ "$#" -ne 2 ]; then
echo "[Error] Wrong usage. Missing required input parameters."
echo "[Error] Usage : $0 <; separated key:value pairs as node attributes> <File path where each node IP per line to add attributes>"
echo "[Error] Example : $0 <key1>:<value1>;<key2>:<value2> /path/to/nodes/ip/file"
exit 1
fi

if [ ! -f $NODES_FILE ]; then
echo "[Error] Input nodes IP file is not valid. Please check. Exiting."
ls -la $NODES_FILE
exit 1
fi

cat <<EOF > ${tmpScript}
echo "MESOS_ATTRIBUTES=${ATTRIBUTES}" | sudo tee /var/lib/dcos/mesos-slave-common
sudo systemctl stop dcos-mesos-slave
sudo rm -f /var/lib/mesos/slave/meta/slaves/latest
sudo systemctl start dcos-mesos-slave
EOF

for i in `cat $NODES_FILE`; do
echo $i
dcos node ssh --master-proxy --option StrictHostKeyChecking=no --private-ip $i <$tmpScript
sleep 10
done
File renamed without changes.

0 comments on commit dd34183

Please sign in to comment.