- About the Project
- Requirements
- Installing Ansible On Node Machine
- Installing OpenSSH On Both Machines
- How To Run The Playbook
- Running Issues
The aim of this project is to automate the post installation tasks for Linux machines:
- Saves time and energy.
- Ansible being idempotent means change commands are not run unless needed.
- Just start the playbook and grab a cup of coffee!! :D
- Ansible [core 2.12.2] installed on node machine.
- OpenSSH server and client installed on both machines.
- Python3.8 or newer installed on both machines.
Ansible can be installed and set to run at startups using the following commands:
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansibleCheck whether ansible has been successfully installed in the machine with:
ishraque@ansimac:~$ ansible --version
ansible [core 2.12.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ishraque/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/ishraque/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 3.0.3
libyaml = TrueOpenSSH client and server can be installed with:
sudo apt install openssh-client openssh-serverThe following needs to be made sure before the playbook is run:
- OpenSSH server is installed in the target machine.
- The node machine can successfully ping and ssh into the target machine.
Changes are need to be done to the inventory.yml file before the playbook can be run successfully:
- Add new hosts to the
inventory.ymlfile as required.
---
all:
children:
user_hosts:
hosts:
192.168.X.X:
ansible_user: user1
username: user1
192.168.X.Y:
ansible_user: user2
username: user2Finally the playbook can be run with the following command:
$ ansible-playbook -v playbook.yml --extra-vars "@password_secret.yml"- Currently no running issues. :)