-
Notifications
You must be signed in to change notification settings - Fork 0
/
initial-setup.yml
49 lines (47 loc) · 1.27 KB
/
initial-setup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
- name: Initial Setup
####################################
#
# ansible-playbook -v -u USER -l <IP ADDRESS> -k -K initial-setup.yml
#
####################################
#vars_prompt:
# - name: "ansible_ssh_pass"
# prompt: "root password for remote connection?"
# private: yes
#remote_user: pete
become: "True"
become_method: sudo
hosts: all
tasks:
- name: Create DevOps User
user:
name: devops
shell: /bin/bash
state: present
- name: Add devops to sudoers
lineinfile:
path: /etc/sudoers.d/devops
line: "devops ALL=(ALL) NOPASSWD: ALL"
state: present
create: true
- name: Set authorized key
authorized_key:
user: devops
state: present
key: "{{ lookup('file', '~/ansible/devops_id_rsa.pub') }}"
- name: Create pete User
user:
name: pete
shell: /bin/bash
state: present
- name: Add pete to sudoers
lineinfile:
path: /etc/sudoers.d/devops
line: "pete ALL=(ALL) NOPASSWD: ALL"
state: present
create: true
- name: Set authorized key
authorized_key:
user: pete
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"