Skip to content

Commit 82ec81b

Browse files
author
Jay LaCroix
committed
added simone user, bootstrap script, and separated bootstrap tasks from site.yml into bootstrap.yml
1 parent e0b0459 commit 82ec81b

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

bootstrap.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
3+
- hosts: all
4+
become: true
5+
pre_tasks:
6+
7+
- name: install updates (CentOS)
8+
tags: always
9+
dnf:
10+
update_only: yes
11+
update_cache: yes
12+
when: ansible_distribution == "CentOS"
13+
14+
- name: install updates (Ubuntu)
15+
tags: always
16+
apt:
17+
upgrade: dist
18+
update_cache: yes
19+
when: ansible_distribution == "Ubuntu"
20+
21+
22+
- hosts: all
23+
become: true
24+
tasks:
25+
26+
- name: create simone user
27+
tags: always
28+
user:
29+
name: simone
30+
groups: root
31+
32+
- name: add ssh key for simone
33+
tags: always
34+
authorized_key:
35+
user: simone
36+
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDDFKXMIafzQFacLs0RyQoeTvjFrtR4R2FIlOsvQXOfg ansible"
37+
38+
- name: add sudoers file for simone
39+
tags: always
40+
copy:
41+
src: sudoer_simone
42+
dest: /etc/sudoers.d/simone
43+
owner: root
44+
group: root
45+
mode: 0440

files/sudoer_simone

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
simone ALL=(ALL) NOPASSWD: ALL

site.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,32 @@
44
become: true
55
pre_tasks:
66

7-
- name: install updates (CentOS)
7+
- name: update repo cache (CentOS)
88
tags: always
99
dnf:
10-
update_only: yes
1110
update_cache: yes
11+
changed_when: false
1212
when: ansible_distribution == "CentOS"
1313

14-
- name: install updates (Ubuntu)
14+
- name: update repo cache (Ubuntu)
1515
tags: always
1616
apt:
17-
upgrade: dist
1817
update_cache: yes
18+
changed_when: false
1919
when: ansible_distribution == "Ubuntu"
2020

2121

22+
- hosts: all
23+
become: true
24+
tasks:
25+
26+
- name: add ssh key for simone
27+
tags: always
28+
authorized_key:
29+
user: simone
30+
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDDFKXMIafzQFacLs0RyQoeTvjFrtR4R2FIlOsvQXOfg ansible"
31+
32+
2233
- hosts: workstations
2334
become: true
2435
tasks:

0 commit comments

Comments
 (0)