ansible安装软件涉及到ansible的一个module:YUM
官方介绍文档:http://docs.ansible.com/ansible/yum_module.html
如果我们想安装apache,相关的task为
1 2 3 |
、 - name: install the latest version of Apache yum: name=httpd state=latest |
其实,latest更倾向于installed,因为latest一般作为升级upgrade使用,例如
1 2 |
- name: upgrade all packages yum: name=* state=latest |
我可不希望出现哪天一跑脚本,apache自动更新了(其实也是可以的,因为是部署脚本,维护脚本应该单独分开的)
然后我们还需要安装的有mysql 以及vsftpd
1 2 3 4 5 6 |
、 - name: Install MySQL action: yum name={{ item }} with_items: - mysql - mysql-server |
1 2 3 |
、 - name: install the latest version of Apache yum: name=vsftpd state=latest |
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021