{"id":23282186,"url":"https://github.com/alilotfi23/cactiansible","last_synced_at":"2026-05-06T18:35:31.827Z","repository":{"id":252209593,"uuid":"839753651","full_name":"alilotfi23/CactiAnsible","owner":"alilotfi23","description":"Ansible-powered solution designed to install catci on ubunut servers","archived":false,"fork":false,"pushed_at":"2024-08-08T09:10:51.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T14:15:21.282Z","etag":null,"topics":["ansible","apache","cacti","monitoring","mysql","php","snmpv3"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alilotfi23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-08T09:02:25.000Z","updated_at":"2025-03-17T09:35:13.000Z","dependencies_parsed_at":"2024-08-08T11:29:25.013Z","dependency_job_id":null,"html_url":"https://github.com/alilotfi23/CactiAnsible","commit_stats":null,"previous_names":["alilotfi23/cactiansible"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alilotfi23/CactiAnsible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FCactiAnsible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FCactiAnsible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FCactiAnsible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FCactiAnsible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alilotfi23","download_url":"https://codeload.github.com/alilotfi23/CactiAnsible/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FCactiAnsible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268415882,"owners_count":24246812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","apache","cacti","monitoring","mysql","php","snmpv3"],"created_at":"2024-12-20T00:14:55.565Z","updated_at":"2026-05-06T18:35:31.767Z","avatar_url":"https://github.com/alilotfi23.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CactiAnsible\n\nCactiAnsible is an Ansible playbook designed to automate the installation and configuration of Cacti, an open-source network monitoring and graphing tool, on Ubuntu servers. This project is modular and organized into roles for better reusability and maintainability.\n\n## File Structure\n\n```plaintext\nCactiAnsible/\n├── ansible.cfg               # Configuration file for Ansible\n├── inventory\n│   └── hosts                 # Inventory file containing the server details\n├── playbooks\n│   └── site.yml              # Main playbook that includes all roles\n└── roles\n    ├── apache\n    │   ├── tasks\n    │   │   └── main.yml      # Tasks to install and configure Apache\n    │   └── templates\n    │       └── apache.conf.j2 # Template for Apache virtual host configuration\n    ├── cacti\n    │   ├── tasks\n    │   │   └── main.yml      # Tasks to install and configure Cacti\n    │   └── templates\n    │       └── cacti.sql.j2  # Template for Cacti database configuration\n    ├── mysql\n    │   ├── tasks\n    │   │   └── main.yml      # Tasks to install and configure MySQL\n    │   └── templates\n    │       └── my.cnf.j2     # Template for MySQL configuration\n    └── php\n        ├── tasks\n        │   └── main.yml      # Tasks to install and configure PHP\n        └── templates\n            └── php.ini.j2    # Template for PHP configuration\n```\n\n## Prerequisites\n\n- Ansible installed on your control machine.\n- Access to the target Ubuntu server(s) with appropriate permissions.\n\n## Configuration\n\n### ansible.cfg\n\nDefines configuration settings for Ansible, including the inventory path and roles path.\n\n```ini\n[defaults]\ninventory = inventory/hosts\nroles_path = roles\n```\n\n### inventory/hosts\n\nLists the target Ubuntu server(s) where Cacti will be installed. Replace placeholders with actual server details.\n\n```ini\n[ubuntu_servers]\nyour_server_ip ansible_user=your_user ansible_password=your_password\n```\n\n## Playbooks\n\n### playbooks/site.yml\n\nMain playbook that includes all roles required for installing and configuring Cacti.\n\n```yaml\n---\n- hosts: ubuntu_servers\n  become: yes\n  roles:\n    - apache\n    - mysql\n    - php\n    - cacti\n```\n\n## Roles\n\n### Apache\n\nTasks for installing and configuring Apache.\n\n#### roles/apache/tasks/main.yml\n\n```yaml\n---\n- name: Install Apache\n  apt:\n    name: apache2\n    state: present\n\n- name: Start and enable Apache\n  systemd:\n    name: apache2\n    enabled: yes\n    state: started\n\n- name: Deploy Apache configuration\n  template:\n    src: apache.conf.j2\n    dest: /etc/apache2/sites-available/000-default.conf\n\n- name: Enable Apache mod_rewrite\n  command: a2enmod rewrite\n\n- name: Restart Apache\n  systemd:\n    name: apache2\n    state: restarted\n```\n\n#### roles/apache/templates/apache.conf.j2\n\nTemplate for Apache virtual host configuration.\n\n```apache\n\u003cVirtualHost *:80\u003e\n    ServerAdmin webmaster@localhost\n    DocumentRoot /var/www/html\n\n    \u003cDirectory /var/www/html\u003e\n        Options Indexes FollowSymLinks MultiViews\n        AllowOverride All\n        Require all granted\n    \u003c/Directory\u003e\n\n    ErrorLog ${APACHE_LOG_DIR}/error.log\n    CustomLog ${APACHE_LOG_DIR}/access.log combined\n\u003c/VirtualHost\u003e\n```\n\n### MySQL\n\nTasks for installing and configuring MySQL.\n\n#### roles/mysql/tasks/main.yml\n\n```yaml\n---\n- name: Install MySQL\n  apt:\n    name: \"{{ item }}\"\n    state: present\n  loop:\n    - mysql-server\n    - mysql-client\n\n- name: Start and enable MySQL\n  systemd:\n    name: mysql\n    enabled: yes\n    state: started\n\n- name: Deploy MySQL configuration\n  template:\n    src: my.cnf.j2\n    dest: /etc/mysql/my.cnf\n\n- name: Restart MySQL\n  systemd:\n    name: mysql\n    state: restarted\n\n- name: Create Cacti database and user\n  mysql_db:\n    name: cacti\n    state: present\n\n- name: Create Cacti user\n  mysql_user:\n    name: cactiuser\n    password: cactiuserpassword\n    priv: 'cacti.*:ALL'\n    state: present\n```\n\n#### roles/mysql/templates/my.cnf.j2\n\nTemplate for MySQL configuration.\n\n```ini\n[mysqld]\nsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES\n```\n\n### PHP\n\nTasks for installing and configuring PHP.\n\n#### roles/php/tasks/main.yml\n\n```yaml\n---\n- name: Install PHP and extensions\n  apt:\n    name: \"{{ item }}\"\n    state: present\n  loop:\n    - php\n    - php-mysql\n    - php-gd\n    - libapache2-mod-php\n    - php-xml\n    - php-mbstring\n    - php-snmp\n\n- name: Deploy PHP configuration\n  template:\n    src: php.ini.j2\n    dest: /etc/php/7.4/apache2/php.ini\n\n- name: Restart Apache\n  systemd:\n    name: apache2\n    state: restarted\n```\n\n#### roles/php/templates/php.ini.j2\n\nTemplate for PHP configuration.\n\n```ini\nmemory_limit = 512M\nupload_max_filesize = 16M\npost_max_size = 16M\nmax_execution_time = 300\n```\n\n### Cacti\n\nTasks for installing and configuring Cacti.\n\n#### roles/cacti/tasks/main.yml\n\n```yaml\n---\n- name: Install Cacti\n  apt:\n    name: \"{{ item }}\"\n    state: present\n  loop:\n    - cacti\n    - snmp\n    - snmpd\n    - rrdtool\n\n- name: Import Cacti database\n  mysql_db:\n    name: cacti\n    state: import\n    target: /usr/share/doc/cacti/cacti.sql\n\n- name: Configure Cacti database settings\n  template:\n    src: cacti.sql.j2\n    dest: /usr/share/cacti/include/config.php\n\n- name: Set up Cacti cron job\n  cron:\n    name: \"Cacti cron job\"\n    minute: \"*/5\"\n    user: www-data\n    job: \"/usr/bin/php /usr/share/cacti/poller.php \u003e /dev/null 2\u003e\u00261\"\n\n- name: Restart Apache\n  systemd:\n    name: apache2\n    state: restarted\n```\n\n#### roles/cacti/templates/cacti.sql.j2\n\nTemplate for Cacti database configuration.\n\n```php\n\u003c?php\n$database_type = 'mysql';\n$database_default = 'cacti';\n$database_hostname = 'localhost';\n$database_username = 'cactiuser';\n$database_password = 'cactiuserpassword';\n$database_port = '3306';\n$database_ssl = false;\n?\u003e\n```\n\n## Usage\n\nTo deploy Cacti on your Ubuntu server(s), run the following command:\n\n```bash\ngit clone https://github.com/alilotfi23/CactiAnsible.git\ncd CactiAnsible/playbooks\nansible-playbook playbooks/site.yml\n```\n\nEnsure that you have replaced the placeholders in the `inventory/hosts` file with your actual server details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fcactiansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falilotfi23%2Fcactiansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fcactiansible/lists"}