Configuring Apache

You may have wondered why we created a user called lamp in the previous section; we are going to be hosting our website for this user. The first aspect in getting the user ready to host our website is to add the user to the apache_group. To do this, we need to run the following task:

- name: Add user to apache group  user:    name: "{{ item.name }}"    groups: "{{ apache_group }}"    append: yes  with_items: "{{ users }}"

There are two things to point out here. The first is that we are using the users variable from the previous role, which is still available to use within the playbook run, and the second thing is that we have added a variable called apache_group to roles/apache/defaults/main.yml:

apache_group: "apache"

Now that our ...

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.