Created
August 12, 2020 07:16
-
-
Save sandikata/de81a1f84e560f07ae293891c7ed7a5d 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: 192.168.56.237 | |
vars: | |
users: | |
- ralexandrov | |
- rmarinchev | |
- venzi | |
- joro | |
- iyovchev | |
tasks: | |
- name: Create devops group | |
group: | |
name: devops | |
state: present | |
- name: Create user accounts | |
user: | |
name: "{{ item }}" | |
groups: devops | |
with_items: "{{ users }}" | |
- name: Add authorized key for ralexandrov | |
authorized_key: | |
user: ralexandrov | |
state: present | |
key: "{{ lookup('file', 'perspecta-devops.pub') }}" | |
- name: Add authorized key for rmarinchev | |
authorized_key: | |
user: rmarinchev | |
state: present | |
key: "{{ lookup('file', '') }}" | |
- name: Add authorized key for venzi | |
authorized_key: | |
user: venzi | |
state: present | |
key: "{{ lookup('file', '') }}" | |
- name: Add authorized key for joro | |
authorized_key: | |
user: joro | |
state: present | |
key: "{{ lookup('file', '') }}" | |
- name: Add authorized key for iyovchev | |
authorized_key: | |
user: iyovchev | |
state: present | |
key: "{{ lookup('file', '') }}" | |
- name: Allow devops users to sudo without a password | |
lineinfile: | |
dest: /etc/sudoers | |
state: present | |
regexp: "^%devops" | |
line: "%devops ALL=(ALL) NOPASSWD: ALL, !/bin/su" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment