Ansible - Download role using the git clone command
by
Jeremy Canfield |
Updated: October 19 2020
| Ansible articles
If you are not familiar with roles, check out our article on Getting Started with Roles.
There are a few different ways to create the roles files and directories.
- Use the ansible-galaxy init command to create the roles files and directories
- Use the ansible-galaxy install command to create the roles files and directories
- Use the git clone command to create the roles files and directories (that is what will be described in this article)
- Manually create the roles files and directories
Let's say you want to download the nginx web server roles directory. Assuming you are in your roles directory, such as /etc/ansible/roles, the git clone command can be used to download the nginx web server roles repository.
git clone https://github.com/bennojoy/nginx
This should clone the nginx repository to /etc/ansbile/roles.
~]$ ls -l /etc/ansible/roles/nginx
total 8
drwxrwxr-x. 2 root root 21 Oct 19 11:51 defaults
drwxrwxr-x. 2 root root 22 Oct 19 11:51 files
drwxrwxr-x. 2 root root 21 Oct 19 11:51 handlers
drwxrwxr-x. 2 root root 21 Oct 19 11:51 meta
-rw-rw-r--. 1 root root 4491 Oct 19 11:51 README.md
drwxrwxr-x. 2 root root 21 Oct 19 11:51 tasks
drwxrwxr-x. 2 root root 79 Oct 19 11:51 templates
drwxrwxr-x. 2 root root 21 Oct 19 11:51 vars
Did you find this article helpful?
If so, consider buying me a coffee over at