Installing common packages

Now that we have updated the installed packages, let's install the packages we want to install on all of the Linux servers we will be launching:

- name: install the common packages  yum:    name: "{{ item }}"    state: "installed"  with_items: "{{ common_packages }}"

As you can see, we are again using the yum module and we have added a descriptive name for the task. Rather than providing a list of packages in the task, we are using a variable called common_packages, which is defined in the roles/common/defaults/main.yml file as the following:

common_packages:  - "ntp"  - "ntpdate"  - "vim-enhanced"  - "git"  - "unzip"  - "policycoreutils-python"  - "epel-release"  - "https://centos7.iuscommunity.org/ius-release.rpm"

As you can ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.