当前位置:   article > 正文

ansible - 安装 -【kodcloud教程】

kodcloud

目录

目录结构、主机清单

【1】安装基础环境

【2】webserver - 安装nginx

【3】安装php环境

【4】lb-server

【5】redis安装

【6】 kodcloud

【7】wordpress-proxy 


 

ansible 10.0.0.10
lb-server 10.0.0.11
web01 10.0.0.15
web02 10.0.0.16
redis 10.0.0.20

目录结构、主机清单

  1. [root@ansible ~]# mkdir -p ansible/roles/
  2. [root@ansible ~]# cd ansible/roles/
  3. [root@ansible roles]# mkdir -p {nginx,php-fpm,redis}/{tasks,templates,handlers,file
  4. [root@ansible roles]# mkdir -p basic/{tasks,templates,handlers,files}
  5. [root@ansible roles]# mkdir group_vars
  6. [root@ansible roles]# egrep "^[a-Z]" ansible.cfg
  7. inventory = ./hosts
  8. forks = 5
  9. [root@ansible roles]# grep "^[^#]" hosts
  10. [lb-server]
  11. 10.0.0.11
  12. [webserver]
  13. 10.0.0.15
  14. 10.0.0.16
  15. [redis]
  16. 10.0.0.20

【1】安装基础环境

  1. [root@ansible roles]# cat basic/tasks/main.yml
  2. - name: Install Nginx Repo
  3. yum_repository:
  4. name: ansible_nginx
  5. description: ansible_nginx_repo
  6. baseurl: http://nginx.org/packages/centos/$releasever/$basearch/
  7. gpgcheck: no
  8. gpgkey: https://nginx.org/keys/nginx_signing.key
  9. when: ( ansible_hostname is match ("web*") or ansible_hostname is match ("lb*") )
  10. - name: PHP Reop
  11. yum_repository:
  12. name: ansible_php
  13. description: ansible_php_repo
  14. baseurl: http://us-east.repo.webtatic.com/yum/el7/x86_64/
  15. gpgcheck: no
  16. when: ( ansible_hostname is match ("web*") )
  17. - name: epel
  18. yum:
  19. name: epel-release.noarch
  20. state: present
  21. - name: Install Basices
  22. yum:
  23. name: "{
  24. { item }}"
  25. state: present
  26. loop:
  27. - vim
  28. - wget
  29. - make
  30. - automake
  31. - lrzsz
  32. - tree
  33. - net-tools
  34. - nfs-utils
  35. - rsync
  36. - ntpdate
  37. - unzip
  38. - zip
  39. - name: Disabled Firewall
  40. systemd:
  41. name: firewalld
  42. state: stopped
  43. enabled: no
  44. - name: Disabled Selinux
  45. selinux:
  46. state: disabled
  47. - name: Create Group
  48. group:
  49. name: "{
  50. { group }}"
  51. gid: "{
  52. { id }}"
  53. - name: Create User
  54. user:
  55. name: "{
  56. { user }}"
  57. uid: "{
  58. { id }}"
  59. group: "{
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/59979
推荐阅读
相关标签
  

闽ICP备14008679号