0%

RHCE (EX294) - 使用 Ansible Galaxy 安装角色

使用 Ansible Galaxy 安装角色

使用 Ansible Galaxy 和要求文件 /home/greg/ansible/roles/requirements.yml。从以下 URL 下载角色并安装到 /home/greg/ansible/roles

http://materials/haproxy.tar 此角色的名称应当为 balancer

http://materials/phpinfo.tar 此角色的名称应当为 phpinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[greg@control ansible]$ mkdir /home/greg/ansible/roles
[greg@control ansible]$ vim /home/greg/ansible/roles/requirements.yml
---
- name: balancer
src: http://materials/haproxy.tar
- name: phpinfo
src: http://materials/phpinfo.tar
[greg@control ansible]$ ansible-galaxy role install -p /home/greg/ansible/roles -r /home/greg/ansible/roles/requirements.yml
- downloading role from http://materials/haproxy.tar
- extracting balancer to /home/greg/ansible/roles/balancer
- balancer was installed successfully
- downloading role from http://materials/phpinfo.tar
- extracting phpinfo to /home/greg/ansible/roles/phpinfo
- phpinfo was installed successfully
[greg@control ansible]$ ansible-galaxy role list
# /etc/ansible/roles
# /home/greg/ansible/roles
- balancer, (unknown version)
- phpinfo, (unknown version)
...