Ansible step3 (Play books)
--- - hosts: myinventory tasks: - name: Install HTTPD Pkg yum: name=httpd state=latest - name: Start HTTPD service service: name=httpd status=retarted That's it......above play book is ready to install httpd service and start the service , saved as 'install.yml' How to validate the playbook syntax is correct? ansible-playbook install.yml --syntax-check if there is any error then it will display the error msg on the screen How to run the playbook? ansible-playbook install.yml if you don't mention the 'inventory' then it will take default inventory file from /etc/ansible/hosts otherwise you have to mention the inventory like below ansible-playbook -i myinventory install.yml Wowww...you have successfully executed the playbook and it installs httpd service and service is started....playbook output will gives you number of successfully execution, failures etc. Let's write a play book for uninstalling the htt...
Comments
Post a Comment