user: root
tasks:
- name: install httpd
yum:
name: httpd
- name: install php
yum: name={{item}} state=installed
with_items:
- php
- php-mysql
- php-pdo
- php-gd
- php-mbstring
- name: copy file
shell: echo "<?php phpinfo (); ?>" > /var/www/html/info.php
- name: install mariadb
yum: name={{item}} state=installed
with_items:
- mariadb-server
- mariadb
- name: restart httpd
service:
name: httpd
state: restarted
root@localhost ~]# ansible-playbook playbook.yml
PLAY [all] ****************************************************************************
TASK [Gathering Facts] ****************************************************************
ok: [192.168.45.136]
TASK [install httpd] ******************************************************************
ok: [192.168.45.136]
TASK [install php] ********************************************************************
[DEPRECATION WARNING]: Invoking "yum" only once while using a loop via squash_actions
is deprecated. Instead of using a loop to supply multiple items and specifying `name:
"{{item}}"`, please use `name: ['php', 'php-mysql', 'php-pdo', 'php-gd', 'php-
mbstring']` and remove the loop. This feature will be removed in version 2.11.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
changed: [192.168.45.136] => (item=[u'php', u'php-mysql', u'php-pdo', u'php-gd', u'php-mbstring'])
TASK [copy file] **********************************************************************
changed: [192.168.45.136]
TASK [install mariadb] ****************************************************************
[DEPRECATION WARNING]: Invoking "yum" only once while using a loop via squash_actions
is deprecated. Instead of using a loop to supply multiple items and specifying `name:
"{{item}}"`, please use `name: ['mariadb-server', 'mariadb']` and remove the loop.
This feature will be removed in version 2.11. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
changed: [192.168.45.136] => (item=[u'mariadb-server', u'mariadb'])
TASK [restart httpd] ******************************************************************
changed: [192.168.45.136]
PLAY RECAP ****************************************************************************
192.168.45.136 : ok=6 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# rpm -qa mariadb
mariadb-5.5.60-1.el7_5.x86_64
[root@localhost ~]# rpm -qa mariadb*
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
[root@localhost ~]# rpm -qa mariadb* php*
php-pdo-5.4.16-46.el7.x86_64
php-gd-5.4.16-46.el7.x86_64
php-mbstring-5.4.16-46.el7.x86_64
php-cli-5.4.16-46.el7.x86_64
php-5.4.16-46.el7.x86_64
php-common-5.4.16-46.el7.x86_64
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64
php-mysql-5.4.16-46.el7.x86_64
mariadb-5.5.60-1.el7_5.x86_64
https://docs.google.com/document/d/e/2PACX-1vSwnKtPGGKzkWQ8rnAqzu9CX7xGSjmgwTWY7MktR9BvFu9aoXzVD8UuJpiqUP2Shcx081Jhs5O1S_QC/pub
Comments
Post a Comment