ansible-galaxy 命令行工具
-
ansible-galaxy命令与Ansible捆绑在一起,您可以使用它从Galaxy或直接从基于git的SCM安装角色。 您还可以使用它在Galaxy网站上创建新角色,删除角色或执行任务。对于roles的部署非常有帮助。
-
默认情况下,命令行工具使用服务器地址
https://galaxy.ansible.com
与Galaxy网站API通信。 -
ansible-galaxy在 Ansible 1.4.2 就已经被包含了
应用galaxy工具下载安装角色
(1)让虚拟机上网
(2)使用ansible-galaxy命令下载角色
[devops@server1 ansible]$ ansible-galaxy install nginxinc.nginx ##这里下载nginx
ansible-galaxy list ##列出所有的角色
出于安全原因,下载的代码需要仔细研读每一行代码
[devops@server1 roles]$ cd nginxinc.nginx/
[devops@server1 nginxinc.nginx]$ tree . ##使用tree将nginx角色目录结构列出
.
├── defaults
│ └── main.yml
├── files
│ ├── conf
│ │ ├── http
│ │ └── stream
│ ├── license
│ ├── ssl
│ └── www
├── handlers
│ └── main.yml
├── LICENSE
├── meta
│ └── main.yml
├── README.md
├── tasks
│ ├── amplify
│ │ ├── install-amplify.yml
│ │ ├── setup-debian.yml
│ │ └── setup-redhat.yml
│ ├── conf
│ │ ├── cleanup-config.yml
│ │ ├── debug-output.yml
│ │ ├── setup-status.yml
│ │ ├── template-config.yml
│ │ └── upload-config.yml
│ ├── controller
│ │ ├── install-controller.yml
│ │ ├── setup-debian.yml
│ │ └── setup-redhat.yml
│ ├── keys
│ │ ├── apk-key.yml
│ │ ├── apt-key.yml
│ │ └── rpm-key.yml
│ ├── main.yml
│ ├── modules
│ │ ├── install-geoip.yml
│ │ ├── install-image-filter.yml
│ │ ├── install-modules.yml
│ │ ├── install-njs.yml
│ │ ├── install-perl.yml
│ │ ├── install-rtmp.yml
│ │ ├── install-waf.yml
│ │ └── install-xslt.yml
│ ├── opensource
│ │ ├── install-oss.yml
│ │ ├── setup-alpine.yml
│ │ ├── setup-debian.yml
│ │ ├── setup-freebsd.yml
│ │ ├── setup-redhat.yml
│ │ └── setup-suse.yml
│ ├── plus
│ │ ├── delete-license.yml
│ │ ├── install-plus.yml
│ │ ├── setup-alpine.yml
│ │ ├── setup-debian.yml
│ │ ├── setup-freebsd.yml
│ │ ├── setup-license.yml
│ │ ├── setup-redhat.yml
│ │ └── setup-suse.yml
│ ├── prerequisites
│ │ ├── install-prerequisites.yml
│ │ └── setup-debian.yml
│ └── unit
│ ├── install-modules.yml
│ ├── install-unit.yml
│ ├── setup-debian.yml
│ ├── setup-freebsd.yml
│ └── setup-redhat.yml
├── templates
│ ├── http
│ │ ├── api.conf.j2
│ │ └── default.conf.j2
│ ├── nginx.conf.j2
│ ├── stream
│ │ └── default.conf.j2
│ └── www
│ └── index.html.j2
├── tests
│ ├── dockerfiles
│ │ ├── Dockerfile.centos-6
│ │ ├── Dockerfile.centos-7
│ │ ├── Dockerfile.debian-jessie
│ │ ├── Dockerfile.debian-stretch
│ │ ├── Dockerfile.ubuntu-bionic
│ │ ├── Dockerfile.ubuntu-trusty
│ │ └── Dockerfile.ubuntu-xenial
│ ├── files
│ │ ├── http
│ │ │ └── default.conf
│ │ └── nginx.conf
│ └── playbooks
│ ├── nginx-basic.yml
│ ├── nginx-http-template.yml
│ ├── nginx-modules.yml
│ ├── nginx-push.yml
│ ├── nginx-stable.yml
│ ├── nginx-stream-template.yml
│ └── nginx-unit.yml
└── vars
└── main.yml
30 directories, 71 files