Ansible自动化运维之galaxy命令行工具

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值