$ ansible dev -m shell -a 'systemctl status httpd' Verify whether Apache is installed and started on Dev host, run following ansibe ad-hoc commands $ ansible dev -m shell -a 'rpm -qa | grep -i httpd' To run the playbook, execute following command $ ansible-playbook demo-apache.yml Let’s create a sample playbook to install Apache server on dev node $ vi demo-apache.yml Perfect, above output confirms ansible is able to perform ping pong test to its managed hosts. Let’s first verify the managed host connectivity from ansible control node, run $ ansible all -m ping $ 4) Test and Verify Ansible Installation rw-r-r- 1 sysops sysops 42 Apr 8 17:28 inventory rw-r-r- 1 sysops sysops 194 Apr 8 17:25 ansible.cfg Now in ‘ ansible-demo’ folder we have two files, ansible.cfg and inventory $ pwd Let’s create project folder with name ‘ansible-demo’, $ mkdir ansible-demoĬreate ansible.cfg file with following content $ vi ansible.cfgĬreate the inventory file, $ vi inventory $ echo "sysops ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/sysops 3) Create ansible config file and inventory file On each managed host, configure following for sysops user so that it can run sudo commands without prompting password. Now exchange ssh keys using ssh-copy-id command, $ ssh-copy-id 192.168.1.170 To generate ssh keys, run ‘ ssh-keygen’ command 2) Generate SSH keys and share it between managed hosts Once ansible is installed, verify its version by running, $ ansible -versionĪbove output confirms that ansible version 2.10.8 is installed. So, to install ansible, run following commands $ sudo apt update Let’s deep dive into Ansible Installation steps on Debian 11 1) Install Ansible with apt commandĪnsible Debian package and its dependencies are available in the default Debian 11 package repositories.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |