際際滷

際際滷Share a Scribd company logo
Contributing  to ansible
Contributing to Ansible
Developing Ansible Modules
 software platform for CM systems
 Agentless
 Secure
 Scalable
....wait a min....what the heck is Ansible?
....so what can we do with ansible?
 package installation
 shell commands
 install/update package
 management systems, clone git
 stop, start, re-start service
.....also ansible comes with batteries included!!
 Ansible comes bundled with nearly all
the mostly used
applications/protocols etc in
computing world.
http://docs.ansible.com/list_of_all_modu
...need any thing out of the box??
write down our own custom
modules....and the best
part...guess??
It's free of any language
barrier
....cool...seems interesting, so what are the different
components of a module?
Though ansible modules can be written in any language, we will stick to Python in this post.
In Python, a module is generally a single file with 3 different parts:
 Documentation: A multiline string literal and a valid YAML document. It contains the
detailed description of module.
 Logic: The programatic way to perform task and uses various resources provided by
Ansible.
 Ansible framework: bunch of basic utilities to perform its tasks, imported by all modules
using the following import statement:
from ansible.module_utils.basic import *
...let's try bulding some custom
modules..
files hosted on github....
 https://github.com/hellodk
 repository : ansible-meetup-bangalore
Basic configurations
1. From the file /etc/ansible/ansible.cfg, uncomment the line
library = /usr/share/ansible
2. In the file /etc/ansible/hosts
create an entry with 127.0.0.1
...steps to follow
1. Create a new directory inside /usr/share/ansible/
sudo mkdir external
2. Make a new file, inside the external directory
sudo vi test_module
3. Now you can write your yml based play-book
vi test_playbook.yml
....executing the module via
playbook
$ ansible-playbook test_yml.yml
Contributing  to ansible
.....all yours...
give a shout for any queries/questions
Thanks!!
Deepak
hello.dk@outlook.com
in.linkedin.com/in/hellodk

More Related Content

Contributing to ansible

  • 3. software platform for CM systems Agentless Secure Scalable ....wait a min....what the heck is Ansible?
  • 4. ....so what can we do with ansible? package installation shell commands install/update package management systems, clone git stop, start, re-start service
  • 5. .....also ansible comes with batteries included!! Ansible comes bundled with nearly all the mostly used applications/protocols etc in computing world. http://docs.ansible.com/list_of_all_modu
  • 6. ...need any thing out of the box?? write down our own custom modules....and the best part...guess??
  • 7. It's free of any language barrier
  • 8. ....cool...seems interesting, so what are the different components of a module? Though ansible modules can be written in any language, we will stick to Python in this post. In Python, a module is generally a single file with 3 different parts: Documentation: A multiline string literal and a valid YAML document. It contains the detailed description of module. Logic: The programatic way to perform task and uses various resources provided by Ansible. Ansible framework: bunch of basic utilities to perform its tasks, imported by all modules using the following import statement: from ansible.module_utils.basic import *
  • 9. ...let's try bulding some custom modules..
  • 10. files hosted on github.... https://github.com/hellodk repository : ansible-meetup-bangalore
  • 11. Basic configurations 1. From the file /etc/ansible/ansible.cfg, uncomment the line library = /usr/share/ansible 2. In the file /etc/ansible/hosts create an entry with 127.0.0.1
  • 12. ...steps to follow 1. Create a new directory inside /usr/share/ansible/ sudo mkdir external 2. Make a new file, inside the external directory sudo vi test_module 3. Now you can write your yml based play-book vi test_playbook.yml
  • 13. ....executing the module via playbook $ ansible-playbook test_yml.yml
  • 15. .....all yours... give a shout for any queries/questions