Skip to content

Commit d96e57f

Browse files
committed
update intro ansible code
1 parent d085844 commit d96e57f

File tree

8 files changed

+46
-12
lines changed

8 files changed

+46
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ansible-playbook -i ./hosts --private-key=./first_playbook playbook.yml

intro-ansible/05-storing-securing-data/deploy.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
deploy_group: deployers
2+
deploy_user: deployer
3+
ssh_dir: "/home/matt/"
4+
ssh_key_name: "first_playbook"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[common]
2+
142.93.119.85 ansible_python_interpreter=/usr/bin/python3
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# High level instructions for which tasks apply to which hosts
2+
- name: apply local configuration to servers listed in hosts
3+
hosts: all
4+
user: root
5+
roles:
6+
- common
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# include other YAML files with tasks here
2+
- include: ping.yml
3+
- include: new_user.yml
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
###
2+
# establishes non-root user
3+
##
4+
- name: Run equivalent of "apt-get update"
5+
apt:
6+
update_cache: yes
7+
8+
- name: create a non-root group
9+
group:
10+
name: "{{ deploy_group }}"
11+
state: present
12+
13+
- name: create non-root user
14+
user:
15+
name: "deployer"
16+
group: "deployers"
17+
shell: "/bin/bash"
18+
state: present
19+
20+
- name: add authorized_key to non-root user
21+
authorized_key:
22+
user: deployer
23+
state: present
24+
key: "{{ lookup('file', '/home/matt/first_playbook/first_playbook.pub') }}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# entry point for common playbook
2+
- name: ping remote server
3+
ping:
4+
5+
6+

0 commit comments

Comments
 (0)