Skip to content

Instantly share code, notes, and snippets.

@novohool
Created June 14, 2018 01:06
Show Gist options
  • Save novohool/b2e5f5934ee5e363df3f11dc42b8fe43 to your computer and use it in GitHub Desktop.
Save novohool/b2e5f5934ee5e363df3f11dc42b8fe43 to your computer and use it in GitHub Desktop.
这里演示使用ansible-galaxy自动化安装php7 redis
可以通过网页查看ansible-playbook包
```
https://galaxy.ansible.com/explore#/
```
**php7**
```
ansible-galaxy search php7|grep -i centos6
ansible-galaxy install melnikoved.php7
cd /root/.ansible
[root@localhost .ansible]# cat php7.yml
   - hosts: node152
    roles:
        - { role: melnikoved.php7}
[root@localhost .ansible]# cat hosts
[node152]
192.168.1.152
ansible-playbook -i hosts php7.yml
```
安装成功
启动
```
service php-fpm start
```
**redis:**
```
ansible-galaxy install DavidWittman.redis
cd /root/.ansible
[root@localhost .ansible]# cat redis.yml    
- name: install redis on ansible 2.x and verify checksums
hosts: all
roles:
   - role: DavidWittman.redis
    redis_version: 3.0.7
    redis_verify_checksum: true
    redis_checksum: "sha256:b2a791c4ea3bb7268795c45c6321ea5abcc24457178373e6a6e3be6372737f23"
ansible-playbook redis.yml -i hosts
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment