www.cockpit-project.org www.rockylinux.org/
This Ansible project automates the installation of the Cockpit web interface on Rocky Linux servers. Cockpit is a web-based server management tool that simplifies server administration tasks. This repository provides step-by-step instructions and playbooks to configure Cockpit on your Rocky Linux servers.
Before using this Ansible project, ensure that you have the following prerequisites in place:
- Two Rocky Linux servers with SSH access enabled.
- Ansible installed on your local machine.
- SSH access to the servers using key-based authentication.
To get started, clone this repository to your local machine:
git clone https://github.com/your-username/ansible-rocky-linux-cockpit.git
cd ansible-rocky-linux-cockpit
sshpass is a utility tool that allows you to provide SSH password non-interactively to automate SSH connections in scripts and automation tasks.
sudo yum install sshpass
Edit the inventory.ini or create new one file to specify the IP addresses or hostnames of your Rocky Linux servers:
rocky-node1 ansible_host=IP_ADDRESS1 ansible_user=YOUR_SSH_USER
rocky-node2 ansible_host=IP_ADDRESS2 ansible_user=YOUR_SSH_USER
a. Ping Test Playbook (ping.yml): Create a playbook to test the connection to your Rocky Linux nodes.
---
- name: Ping Test
hosts: rocky_nodes
tasks:
- name: Ping the Rocky Linux nodes
ping:
Create a playbook to install Cockpit on your Rocky Linux nodes.
---
- name: Install Cockpit on Rocky Linux
hosts: rocky_nodes
become: yes
tasks:
- name: Update package cache
apt:
update_cache: yes
- name: Install Cockpit
package:
name: cockpit
state: present
- name: Start Cockpit service
service:
name: cockpit
state: started
enabled: yes
Now, you can run the Ansible playbooks you've created
Ping Test: Run the ping.yml playbook to check the connection to your Rocky Linux nodes:
ansible-playbook -i inventory.ini ping.yml
Install Cockpit: Run the install-cockpit.yml playbook to install Cockpit on your Rocky Linux nodes:
ansible-playbook -i inventory.ini install-cockpit.yml --ask-becom
After running the install-cockpit.yml playbook, you can access the Cockpit web interface on each Rocky Linux node by opening a web browser and entering the server's IP address or hostname followed by port 9090 (e.g., http://server-ip:9090). Make sure that port 9090 is accessible in your firewall settings.
That's it! You've successfully set up Ansible to manage two Rocky Linux nodes from your Debian master server and installed Cockpit on them using Ansible playbooks. You can now expand your automation by creating additional playbooks for other tasks or configurations.
Install sshpass Before running the playbooks, make sure to install sshpass on your Debian master server to enable password-based SSH authentication:
sudo yum install sshpass
Resolving Access Issues If you encounter access issues when connecting to the Rocky Linux servers via SSH, just connect via ssh from debain (server that isnatlled ansible) to rocky servers nodes
ssh admin1@server-ip
Root Access Issues ou can resolve them by editing the sudoers file using visudo on the Rocky Linux servers:
sudo visudo
Add the following line to allow your admin user to execute commands with sudo without a password prompt (replace admin1 with your admin username):
admin1 ALL=(ALL) NOPASSWD:ALL