root@localhost ~]# vi nginx.yml
- hosts: all
user: root
become: yes
# the way to use priviledge
become_method: sudo
tasks:
- name: install nginx
yum: name={{item}} state=installed
with_items:
- nginx
- nginx-all-modules
- nginx-filesystem
- nginx-mod-http-geoip
- nginx-mod-http-image-filter
- nginx-mod-http-perl
- nginx-mod-http-xslt-filter
- nginx-mod-mail
- nginx-mod-stream
[root@localhost ~]# ansible-playbook nginx.yml
PLAY [all] ****************************************************************************
TASK [Gathering Facts] ****************************************************************
ok: [192.168.45.136]
TASK [install nginx] ******************************************************************
[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: ['nginx', 'nginx-all-modules', 'nginx-filesystem',
'nginx-mod-http-geoip', 'nginx-mod-http-image-filter', 'nginx-mod-http-perl', 'nginx-
mod-http-xslt-filter', 'nginx-mod-mail', 'nginx-mod-stream']` 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'nginx', u'nginx-all-modules', u'nginx-filesystem', u'nginx-mod-http-geoip', u'nginx-mod-http-image-filter', u'nginx-mod-http-perl', u'nginx-mod-http-xslt-filter', u'nginx-mod-mail', u'nginx-mod-stream'])
PLAY RECAP ****************************************************************************
192.168.45.136 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# rpm -qa | grep nginx
nginx-mod-http-perl-1.12.2-3.el7.x86_64
nginx-mod-stream-1.12.2-3.el7.x86_64
nginx-filesystem-1.12.2-3.el7.noarch
nginx-1.12.2-3.el7.x86_64
nginx-mod-http-image-filter-1.12.2-3.el7.x86_64
nginx-mod-http-geoip-1.12.2-3.el7.x86_64
nginx-mod-http-xslt-filter-1.12.2-3.el7.x86_64
nginx-mod-mail-1.12.2-3.el7.x86_64
nginx-all-modules-1.12.2-3.el7.noarch
[root@localhost ~]#
- hosts: all
user: root
become: yes
# the way to use priviledge
become_method: sudo
tasks:
- name: install nginx
yum: name={{item}} state=installed
with_items:
- nginx
- nginx-all-modules
- nginx-filesystem
- nginx-mod-http-geoip
- nginx-mod-http-image-filter
- nginx-mod-http-perl
- nginx-mod-http-xslt-filter
- nginx-mod-mail
- nginx-mod-stream
PLAY [all] ****************************************************************************
TASK [Gathering Facts] ****************************************************************
ok: [192.168.45.136]
TASK [install nginx] ******************************************************************
[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: ['nginx', 'nginx-all-modules', 'nginx-filesystem',
'nginx-mod-http-geoip', 'nginx-mod-http-image-filter', 'nginx-mod-http-perl', 'nginx-
mod-http-xslt-filter', 'nginx-mod-mail', 'nginx-mod-stream']` 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'nginx', u'nginx-all-modules', u'nginx-filesystem', u'nginx-mod-http-geoip', u'nginx-mod-http-image-filter', u'nginx-mod-http-perl', u'nginx-mod-http-xslt-filter', u'nginx-mod-mail', u'nginx-mod-stream'])
PLAY RECAP ****************************************************************************
192.168.45.136 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost ~]# rpm -qa | grep nginx
nginx-mod-http-perl-1.12.2-3.el7.x86_64
nginx-mod-stream-1.12.2-3.el7.x86_64
nginx-filesystem-1.12.2-3.el7.noarch
nginx-1.12.2-3.el7.x86_64
nginx-mod-http-image-filter-1.12.2-3.el7.x86_64
nginx-mod-http-geoip-1.12.2-3.el7.x86_64
nginx-mod-http-xslt-filter-1.12.2-3.el7.x86_64
nginx-mod-mail-1.12.2-3.el7.x86_64
nginx-all-modules-1.12.2-3.el7.noarch
[root@localhost ~]#
Comments
Post a Comment