使用ansible playbook编写lnmp架构
- name: nginx playgather_facts: falsehosts: lnmpremote_user: roottasks: - name: stop firewalldservice: name=firewalld state=stopped- name: syslinuxcommand: '/usr/sbin/setenforce 0'ignore_errors: true- name: nginx.repocopy: src=/etc/yum.repos.d/nginx.repo dest=/etc/yum.repos.d/- name: haha nginxyum: name=nginx state=latest- name: start nginxcommand: systemctl start nginxtags:- nginx- name: mysql playgather_facts: falsehosts: lnmpremote_user: roottasks: - name: copy install mysql copy: src=/opt/mysql-community.repo dest=/etc/yum.repos.d/- name: copycopy: src=/opt/mysql-community-source.repo dest=/etc/yum.repos.d/- name: install mysqlyum: name=mysql-server- name: start mysqld.serviceservice: name=mysqld.service state=started - name: chushihua script: /etc/ansible/playbook/mysql.sh- name: php playgather_facts: falsehosts: lnmpremote_user: roottasks:- name: install phpshell: rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmignore_errors: True- name: yumwith_items: - php72w- php72w-cli- php72w-common- php72w-devel- php72w-embedded- php72w-gd- php72w-mbstring- php72w-pdo- php72w-xml- php72w-fpm- php72w-mysqlnd- php72w-opcacheyum: name={{item}}- name: start phpservice: name=php-fpm state=started- name: scp nginxcopy: src=/etc/nginx/conf.d/default.conf dest=/etc/nginx/conf.d/default.conf- name: restart nginxservice: name=nginx state=restarted - name: index.phpcopy: src=/usr/share/nginx/html/index.php dest=/usr/share/nginx/html/