php.yml
- hosts: all
user: root
become: yes
# the way to use priviledge
become_method: sudo
tasks:
- 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
root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
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: [default] => (item=[u'php', u'php-mysql', u'php-pdo', u'php-gd', u'php-mbstring'])
TASK [copy file] ***************************************************************
changed: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 05:08:53 2019 from 192.168.121.1
[vagrant@localhost ~]$ rpm -qa php*
php-common-5.4.16-46.el7.x86_64
php-cli-5.4.16-46.el7.x86_64
php-gd-5.4.16-46.el7.x86_64
php-mysql-5.4.16-46.el7.x86_64
php-pdo-5.4.16-46.el7.x86_64
php-mbstring-5.4.16-46.el7.x86_64
php-5.4.16-46.el7.x86_64
[vagrant@localhost ~]$
- hosts: all
user: root
become: yes
# the way to use priviledge
become_method: sudo
tasks:
- 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
root@localhost ~]# vagrant provision
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.8.4).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
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: [default] => (item=[u'php', u'php-mysql', u'php-pdo', u'php-gd', u'php-mbstring'])
TASK [copy file] ***************************************************************
changed: [default]
PLAY RECAP *********************************************************************
default : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# vagrant ssh
Last login: Tue Sep 3 05:08:53 2019 from 192.168.121.1
[vagrant@localhost ~]$ rpm -qa php*
php-common-5.4.16-46.el7.x86_64
php-cli-5.4.16-46.el7.x86_64
php-gd-5.4.16-46.el7.x86_64
php-mysql-5.4.16-46.el7.x86_64
php-pdo-5.4.16-46.el7.x86_64
php-mbstring-5.4.16-46.el7.x86_64
php-5.4.16-46.el7.x86_64
[vagrant@localhost ~]$
Comments
Post a Comment