Skip to content

Latest commit

 

History

History
92 lines (63 loc) · 1.53 KB

File metadata and controls

92 lines (63 loc) · 1.53 KB

beacon-basic

Setup

Start master container:

docker run --rm -d \
    -v $(pwd)/master.d:/etc/salt/master.d \
    -h dev-salt-master \
    --name dev-salt-master \
    simplyadrian/allsalt:debian_master_2017.7.2
docker exec -it dev-salt-master bash

Start minion container:

docker run --rm -d \
    -v $(pwd)/minion.d:/etc/salt/minion.d \
    -h dev-ubuntu-minion \
    --name dev-ubuntu-minion \
    simplyadrian/allsalt:ubuntu_minion_2017.7.2
docker exec -it dev-ubuntu-minion bash

Do things on the master

Accept the keys:

salt-key
salt-key -A -y
salt \* test.ping

Install vim:

salt dev-ubuntu-minion pkg.install vim refresh=True
salt dev-ubuntu-minion pkg.install python-pyinotify

Setup beacon watch file

From the minion, create a file named /etc/important_file and add some simple content:

echo "important_config: True" > /etc/important_file

Restart master and minion containers

docker restart dev-salt-master
docker restart dev-ubuntu-minion

Run it

View events on the master

salt-run state.event pretty=true

Trigger the beacon from the minion

Edit /etc/important_file:

vi /etc/important_file
# edit it and save

Watch the event log

You should see an event like this:

salt/beacon/dev-ubuntu-minion/inotify//etc/important_file    {
    "_stamp": "2017-11-26T18:55:06.015431",
    "change": "IN_IGNORED",
    "id": "dev-ubuntu-minion",
    "path": "/etc/important_file"
}