{"id":3319,"date":"2020-02-12T15:32:07","date_gmt":"2020-02-12T14:32:07","guid":{"rendered":"http:\/\/miro.borodziuk.eu\/?p=3319"},"modified":"2021-05-25T16:20:14","modified_gmt":"2021-05-25T14:20:14","slug":"ansible-galaxy","status":"publish","type":"post","link":"http:\/\/miro.borodziuk.eu\/index.php\/2020\/02\/12\/ansible-galaxy\/","title":{"rendered":"Ansible Galaxy"},"content":{"rendered":"<p>Ansible Galaxy is essentially a large public repository of Ansible roles. Roles ship with readmes detailing role use and available variables. Galaxy contains a large number of roles that are constantly evolving and increasing. Galaxy can use git allowing for other role sources such as GitHub.<\/p>\n<p><!--more--><\/p>\n<p>Ansible ships with the <code>ansible-galaxy<\/code> command which may be used to install roles from Galaxy among other useful role management features.<code> 'ansible-galaxy'<\/code> can also create new empty roles in your working directory like so: <code>'ansible-galaxy init &lt;role_name&gt;'<\/code><br \/>\nUsing<code> 'ansible-galaxy install &lt;username.role&gt;'<\/code>, you can download roles from galaxy.ansible.com.<\/p>\n<p>Roles installed in the <code>roles_path<\/code> may be listed using<code> 'ansible-galaxy list'<\/code><\/p>\n<pre class=\"lang:sh decode:true\">[miro@controlnode roles]$ ansible-galaxy list\r\n- apache, (unknown version)\r\n- php-webserver, (unknown version)<\/pre>\n<p><code>Remove<\/code>, <code>search<\/code>, and <code>login<\/code> are other useful subcommands.<\/p>\n<pre class=\"lang:sh decode:true \">[miro@controlnode roles]$ ansible-galaxy search nginx\r\n\r\nFound 1338 roles matching your search. Showing first 1000.\r\n\r\nName Description\r\n---- -----------\r\n0x0i.prometheus Prometheus - a multi-dimensional time-series data monitoring and alerting toolkit\r\n0x5a17ed.ansible_role_netbox Installs and configures NetBox, a DCIM suite, in a production setting.\r\n1davidmichael.ansible-role-nginx Nginx installation for Linux, FreeBSD and OpenBSD.\r\n1it.sudo Ansible role for managing sudoers\r\n1nfinitum.php PHP installation role.\r\n2kloc.trellis-monit Install and configure Monit service in Trellis.\r\n4linuxdevops.web-balancer Instalacao e Configuracao do servidor Nginx Load Balancer\r\naadl.docker-nginx-alpine Ansible role to manage and run the alpine nginx docker container.\r\naalaesar.install_nextcloud Add a new Nextcloud instance in your infrastructure. The role manages dependencies and initial configuration.\r\naalaesar.upgrade-nextcloud Upgrade an Nextcloud instance in your infrastructure. The role manages backup and CLI upgrade.\r\nAAROC.discourse-sso This is a role to deploy the [Discourse](http:\/\/www.discourse.org) discussion forum, **with SAML authentication**.\r\naaronpederson.ansible-autodeploy Simple deployment tool with hooks\r\naaronpederson.fluentd Really simple management of data collection from logs or scripts. Installation from gem.\r\naaronpederson.newrelic Application Performance Monitoring\r\naaronpederson.nginx nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP proxy server.\r\nabaez.domain a nginx reverse proxy based on docker\r\nabtris.nginx-passenger Ansible: nginx-passenger role\r\nacandid.nginx Install Nginx and ssl and Create Vhost in Debian 10 and RHEL\/CentOS 7\r\nadamaod.Single-Instance-ELK Single Instance Elk Stack\r\n:<\/pre>\n<p>The<code> -p<\/code> flag allows specification of local role location (&#8216;ansible-galaxy&#8217; uses <code>\/etc\/ansible\/roles<\/code> by default).<\/p>\n<p>We can even write a playbook with <code>ansible-galaxy install<\/code> command:<\/p>\n<pre class=\"lang:sh decode:true\">---\r\n- hosts: localhost \r\n  become: yes \r\n  tasks: \r\n  - name: install role \r\n    command: ansible-galaxy install elastic.elasticsearch<\/pre>\n<p>Or use a standard install command:<\/p>\n<pre class=\"lang:sh decode:true \">[root@controlnode roles]# ansible-galaxy install elastic.elasticsearch -vvv\r\nansible-galaxy 2.4.2.0\r\nconfig file = \/etc\/ansible\/ansible.cfg\r\nconfigured module search path = [u'\/root\/.ansible\/plugins\/modules', u'\/usr\/share\/ansible\/plugins\/modules']\r\nansible python module location = \/usr\/lib\/python2.7\/site-packages\/ansible\r\nexecutable location = \/usr\/bin\/ansible-galaxy\r\npython version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]\r\nUsing \/etc\/ansible\/ansible.cfg as config file\r\nOpened \/root\/.ansible_galaxy\r\nProcessing role elastic.elasticsearch\r\nOpened \/root\/.ansible_galaxy\r\n- downloading role 'elasticsearch', owned by elastic\r\nhttps:\/\/galaxy.ansible.com\/api\/v1\/roles\/?owner__username=elastic&name=elasticsearch\r\nhttps:\/\/galaxy.ansible.com\/api\/v1\/roles\/14665\/versions\/?page_size=50\r\n- downloading role from https:\/\/github.com\/elastic\/ansible-elasticsearch\/archive\/7.6.0.tar.gz\r\n- extracting elastic.elasticsearch to \/etc\/ansible\/roles\/elastic.elasticsearch\r\n- elastic.elasticsearch (7.6.0) was installed successfully<\/pre>\n<p>We can read README.md file:<\/p>\n<pre class=\"lang:sh decode:true \">[root@controlnode elastic.elasticsearch]# cat \/etc\/ansible\/roles\/elastic.elasticsearch\/README.md | more\r\n# ansible-elasticsearch\r\n[![Build Status](https:\/\/img.shields.io\/jenkins\/s\/https\/devops-ci.elastic.co\/job\/elastic+ansible-elasticsearch+master.svg)](https:\/\/devops-ci.elastic.co\/job\/elastic+ansible-\r\nelasticsearch+master\/)\r\n[![Ansible Galaxy](https:\/\/img.shields.io\/badge\/ansible--galaxy-elastic.elasticsearch-blue.svg)](https:\/\/galaxy.ansible.com\/elastic\/elasticsearch\/)\r\n\r\n**THIS ROLE IS FOR 7.x &amp; 6.x**\r\n\r\nAnsible role for 7.x\/6.x Elasticsearch. Currently this works on Debian and RedHat based linux systems. Tested platforms are:\r\n\r\n* Ubuntu 14.04\r\n* Ubuntu 16.04\r\n* Ubuntu 18.04\r\n* Debian 8\r\n* Debian 9\r\n* CentOS 7<\/pre>\n<p>Finally we can remove elastic role:<\/p>\n<pre class=\"lang:sh decode:true \">[root@controlnode elastic.elasticsearch]# ansible-galaxy remove elastic.elasticsearch -vvv\r\nansible-galaxy 2.4.2.0\r\nconfig file = \/etc\/ansible\/roles\/elastic.elasticsearch\/ansible.cfg\r\nconfigured module search path = [u'\/root\/.ansible\/plugins\/modules', u'\/usr\/share\/ansible\/plugins\/modules']\r\nansible python module location = \/usr\/lib\/python2.7\/site-packages\/ansible\r\nexecutable location = \/usr\/bin\/ansible-galaxy\r\npython version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]\r\nUsing \/etc\/ansible\/roles\/elastic.elasticsearch\/ansible.cfg as config file\r\nOpened \/root\/.ansible_galaxy\r\n- successfully removed elastic.elasticsearch<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ansible Galaxy is essentially a large public repository of Ansible roles. Roles ship with readmes detailing role use and available variables. Galaxy contains a large number of roles that are constantly evolving and increasing. Galaxy can use git allowing for other role sources such as GitHub.<\/p>\n","protected":false},"author":1,"featured_media":3320,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[],"_links":{"self":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3319"}],"collection":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/comments?post=3319"}],"version-history":[{"count":7,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3319\/revisions"}],"predecessor-version":[{"id":3327,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3319\/revisions\/3327"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media\/3320"}],"wp:attachment":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media?parent=3319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/categories?post=3319"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/tags?post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}