Use the Network Diagram on the class wiki as a reference.
Now login back to ansible control host.
Create a new ansible playbook named cacti.yml to install cacti
This ansilbe playbook will perform:
(venv) vmX-gY@ansible-host:~/ansible-playbook$ vi cacti.yml
- hosts: cacti_hosts
become: true
tasks:
- name: ensure package cache is up to date
apt: update_cache=yes cache_valid_time=3600
tags: install
- name: Set cacti install options
debconf:
name: "{{ item.name }}"
question: "{{ item.question }}"
value: "{{ item.value }}"
vtype: "{{ item.vtype }}"
with_items:
- { name: "cacti", question: "cacti/webserver", value: "apache2", vtype: "select" }
- { name: "cacti", question: "cacti/database-type", value: "mysql", vtype: "select" }
- { name: "cacti", question: "cacti/app-password-confirm", value: "{{ class_password }}", vtype: 'password'}
- { name: "cacti", question: "cacti/mysql/admin-pass", value: "cacti", vtype: 'password'}
- { name: "cacti", question: "cacti/mysql/app-pass", value: "{{ class_password }}", vtype: 'password'}
ignore_errors: true
tags: install
- name: install cacti and its dependency
package:
name: "{{ item }}"
state: present
with_items:
- cacti
- cacti-spine
tags: install
update inventory/hosts as following
(venv) vmX-gY@ansible-host:~/ansible-playbook$ vi inventory/hosts
[nagios_hosts]
vmX-gY.lab.workalaya.net
[snmp_hosts]
vmX-gY.lab.workalaya.net
[smokeping_hosts]
vmX-gY.lab.workalaya.net
[netdot_hosts]
vmX-gY.lab.workalaya.net
[rancid_hosts]
vmX-gY.lab.workalaya.net
[nfsen_hosts]
vmX-gY.lab.workalaya.net
srv1-gY.lab.workalaya.net
[syslog_hosts]
srv1-gY.lab.workalaya.net
[cacti_hosts]
vmX-gY.lab.workalaya.net
Now run ansible playbook to install Cacti
(venv) vmX-gY@ansible-host:~/ansible-playbook$ ansible-playbook cacti.yml
PLAY [cacti_hosts] ******************************************************************************************************************************************
TASK [Gathering Facts] **************************************************************************************************************************************
ok: [vmX-gY.lab.workalaya.net]
TASK [ensure package cache is up to date] *******************************************************************************************************************
[WARNING]: Could not find aptitude. Using apt-get instead
changed: [vmX-gY.lab.workalaya.net]
TASK [Set cacti install options] ****************************************************************************************************************************
changed: [vmX-gY.lab.workalaya.net] => (item={'name': 'cacti', 'question': 'cacti/webserver', 'value': 'apache2', 'vtype': 'select'})
changed: [vmX-gY.lab.workalaya.net] => (item={'name': 'cacti', 'question': 'cacti/database-type', 'value': 'mysql', 'vtype': 'select'})
changed: [vmX-gY.lab.workalaya.net] => (item={'name': 'cacti', 'question': 'cacti/app-password-confirm', 'value': 'cacti', 'vtype': 'password'})
changed: [vmX-gY.lab.workalaya.net] => (item={'name': 'cacti', 'question': 'cacti/mysql/admin-pass', 'value': 'cacti', 'vtype': 'password'})
changed: [vmX-gY.lab.workalaya.net] => (item={'name': 'cacti', 'question': 'cacti/mysql/app-pass', 'value': 'cacti', 'vtype': 'password'})
TASK [install cacti and its dependency] *********************************************************************************************************************
changed: [vmX-gY.lab.workalaya.net] => (item=cacti)
changed: [vmX-gY.lab.workalaya.net] => (item=cacti-spine)
PLAY RECAP **************************************************************************************************************************************************
vmX-gY.lab.workalaya.net : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Now use a web browser and open the following address:
http://vmX-gY.lab.workalaya.net/cacti
Login to Cacti using following details:
Username: admin
Password: <class_password>
CONGRATULATIONS! you have added your router/server into the cacti.
CONGRATULATIONS!!