Role reuse is an important part of building an efficient, standardized system of playbooks for administrators and engineers to apply. We have given many examples throughout this book—for example, in Chapter 10, Managing Users on Linux—we proposed a simple role that would add users to a Linux system. To save you referring back, the code is as follows:
---- name: Add required users to Linux servers user: name: "{{ item.name }}" comment: "{{ item.comment }}" shell: /bin/bash groups: "{{ item.groups }}" append: yes state: present loop: - { name: 'johndoe', comment: 'John Doe', groups: 'sudo'} - { name: 'janedoe', comment: 'Jane Doe', groups: 'docker'}
Given our discussion about role reuse, I'm sure that you ...