Environment is expected to be launched via vagrant up command. Vagrant would
bring up 2 Ubuntu 16.04 virtual machines:
-
n0 - this is the main VM:
- Docker
- Ansible (VM manages itself trough Ansible)
- Containerized
getweatherapplication scannerapplication
-
n1 - this VM is used for testing purposes only
.
├── ansible/
├── getweather/
├── scanner/
├── bootstrap.sh*
├── LICENSE
├── README.md
└── Vagrantfile
Please, see README for details on getweather application.
Ansible is installed on n0 virtual machine via bootstrap.sh shell script,
which is called by Vagrant during provisioning process. After Ansible is
installed, Vagrant runs Ansible playbook setup.yml:
cd /vagrant/ansible/ && ansible-playbook -i inventory.txt setup.ymlPlease, see README for details on Ansible setup and run.
Ansible playbook builds getweather:1.0 container with Go application packaged
into it.
Please, see README for details on scanner application.
Syslog is configured with the following parameters:
- default logging to
/var/log/* - custom log files - per-host logging
Ansible role rsyslog has been created.
Using Jinja2 templates of rsyslog.conf and 50-default.conf files it allows to
parametrize the following:
- logging only default log files
- logging custom files
- selecting external log server to send logs to
Default values of parameters are listed in role defaults:
rsyslog_udp_serverboolean andrsyslog_udp_server_portnumber forrsyslog.conffilersyslog_tcp_serverboolean andrsyslog_tcp_server_portnumber forrsyslog.conffilersyslog_custom_ruleslist of strings with rules for50-default.conf.j2filerelay_logslist offacility(e.g.mail,user, etc.), with logs sent to defineddestination_servervia both UDP and TCP (not RELP).
Verification that logs from other servers are being properly delivered to n0 VM
is done by running the following command on test n1 VM under standard user
account (assuming 192.168.56.10 is an IP address of n0):
logger --server 192.168.56.10 "Test message from n1 VM"And checking results on n0 VM:
vagrant@n0:/vagrant/scanner$ sudo grep Test /var/log/n1/system.log
Nov 22 20:48:26 n1 vagrant Test message from n1 VM
vagrant@n0:/vagrant/scanner$NOTE: Path to log file includes hostname n1 as requested.
- Project uses GitHub Super-Linter action in CI
- Ansible roles and playbooks should be linted by
ansible-lintand/oransible-reviewtools - Shell scripts should be linted by
shellchecktool - AWK scripts should be linted by
awk --lint ... - Go code should be linted by
go fmt ... - Documentation should be in Markdown format and linted by
markdownlint