ansible roles webserver

 

[root@m01 /etc/ansible/roles/webserver/tasks]#cat main.yml
- name: install nginx
yum:
name: nginx
state: present

- name: mkdir /code/php71
file:
path: /code/php71
state: directory
- name: copy php71tar to hosts
unarchive:
src: php71.tar.gz
dest: /code/php71/
- name: yum local install php rpm
yum:
name:
- /code/php71/autoconf-2.69-11.el7.noarch.rpm
- /code/php71/automake-1.13.4-3.el7.noarch.rpm
- /code/php71/libevent-2.0.21-4.el7.x86_64.rpm
- /code/php71/libjpeg-turbo-1.2.90-8.el7.x86_64.rpm
- /code/php71/libmcrypt-2.5.8-13.el7.x86_64.rpm
- /code/php71/libmemcached-1.0.16-5.el7.x86_64.rpm
- /code/php71/libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
- /code/php71/libX11-1.6.7-3.el7_9.x86_64.rpm
- /code/php71/libX11-common-1.6.7-3.el7_9.noarch.rpm
- /code/php71/libXau-1.0.8-2.1.el7.x86_64.rpm
- /code/php71/libxcb-1.13-1.el7.x86_64.rpm
- /code/php71/libXpm-3.5.12-1.el7.x86_64.rpm
- /code/php71/libxslt-1.1.28-6.el7.x86_64.rpm
- /code/php71/mod_php71w-7.1.33-1.w7.x86_64.rpm
- /code/php71/pcre-devel-8.32-17.el7.x86_64.rpm
- /code/php71/perl-Data-Dumper-2.145-3.el7.x86_64.rpm
- /code/php71/perl-Test-Harness-3.28-3.el7.noarch.rpm
- /code/php71/perl-Thread-Queue-3.02-2.el7.noarch.rpm
- /code/php71/php71w-cli-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-common-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-devel-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-embedded-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-fpm-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-gd-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-mbstring-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-mcrypt-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-mysqlnd-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-opcache-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-pdo-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-pear-1.10.4-1.w7.noarch.rpm
- /code/php71/php71w-pecl-igbinary-2.0.5-1.w7.x86_64.rpm
- /code/php71/php71w-pecl-memcached-3.0.4-1.w7.x86_64.rpm
- /code/php71/php71w-pecl-mongodb-1.5.3-1.w7.x86_64.rpm
- /code/php71/php71w-pecl-redis-3.1.6-1.w7.x86_64.rpm
- /code/php71/php71w-process-7.1.33-1.w7.x86_64.rpm
- /code/php71/php71w-xml-7.1.33-1.w7.x86_64.rpm

- name: start php service
systemd:
name: php-fpm
state: started
enabled: yes
- name: start nginx service
systemd:
name: nginx
state: started
enabled: yes

- name: remove nginx default.conf
file:
path: /etc/nginx/conf.d/default.conf
state: absent
- name: copy wordpress configure to conf.d
copy:
src: a_wordpress.conf
dest: /etc/nginx/conf.d/a_wordpress.conf
- name: copy zh confifure to conf.d
copy:
src: zh.conf
dest: /etc/nginx/conf.d/zh.conf
- name: copy phpshe configure to conf.d
copy:
src: phpshe.conf
dest: /etc/nginx/conf.d/phpshe.conf
- name: copy admin configure to conf.d
copy:
src: admin.conf
dest: /etc/nginx/conf.d/admin.conf

- name: makdir /code
file:
path: /code
state: directory
- name: unarchive wordpress_code.tar
unarchive:
src: wordpress_1.tar.gz
dest: /code/
creates: /code/wordpress/

- name: unarchive zh.tar
unarchive:
src: zh.tar.gz
dest: /code/
creates: /code/zh/
- name: unarchive phpshe.tar.gz
unarchive:
src: phpshe.tar.gz
dest: /code/
creates: /code/phpshe/
- name: unarchieve admin.tar.gz
unarchive:
src: admin.tar.gz
dest: /code/
creates: /code/admin/
- name: yum install nfs- utils
yum:
name: nfs-utils
state: present
- name: mount nfs
mount:
src: 172.16.1.31:/code/blog/
path: /code/wordpress/wp-cotent/uploads/
fstype: nfs
state: mounted

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章