Created
April 26, 2019 20:05
-
-
Save abdennour/f963588944b28b26358fe28dd5545d1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: localhost | |
| tasks: | |
| - name: download user_list.yml | |
| get_url: | |
| url: http://files.example.com/user_list.yml | |
| dest: /home/ansible/files/user_list.yml | |
| - hosts: node1 | |
| become: yes | |
| vars_files: | |
| - /home/ansible/files/user_list.yml | |
| tasks: | |
| - name: create groups from file | |
| group: | |
| name: "{{ item }}" | |
| with_items: | |
| - "{{ user_groups }}" | |
| - name: create users for each group in staff | |
| user: | |
| name: "{{ item }}" | |
| group: staff | |
| with_items: | |
| - "{{ staff }}" | |
| - name: create users for each group in students | |
| user: | |
| name: "{{ item }}" | |
| group: students | |
| with_items: | |
| - "{{ students }}" | |
| - name: create users for each group in faculty | |
| user: | |
| name: "{{ item }}" | |
| group: faculty | |
| with_items: | |
| - "{{ faculty }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment