Created
August 23, 2015 20:54
-
-
Save asachs01/ed6c1fecee53e13f3d32 to your computer and use it in GitHub Desktop.
An Ansible Playbook to Setup My Odroid Herd Easily
This file contains 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
--- | |
- name: Initial Odroid Setup | |
hosts: odroids-local | |
user: root | |
vars: | |
- root_password: 'HASHED ROOT PASSWORD HERE' | |
- <YOUR USER>_password: 'USER PASSSWORD HERE' | |
tasks: | |
- name: Change root password | |
user: | |
name=root | |
password={{ root_password }} | |
- name: Add user <YOUR USER> | |
user: | |
name=<YOUR USER> | |
password={{ <YOUR USER>_password }} | |
comment="<YOUR USER'S REAL NAME>" | |
state=present | |
- name: Add SSH public key to user <YOUR USER> | |
authorized_key: | |
user=<YOUR USER> | |
key="{{ lookup('file', "~/.ssh/id_rsa.pub") }}" | |
- name: Add user <YOUR USER> to sudoers | |
lineinfile: | |
"dest=/etc/sudoers | |
regexp='^<YOUR USER> ALL' | |
line='<YOUR USER> ALL=(ALL) NOPASSWD: ALL' | |
state=present" | |
- name: Disallow root SSH access | |
lineinfile: | |
dest=/etc/ssh/sshd_config | |
regexp="^PermitRootLogin" | |
line="PermitRootLogin no" | |
state=present | |
notify: | |
- restart sshd | |
- name: Disallow SSH GSS API authentication | |
lineinfile: | |
dest=/etc/ssh/sshd_config | |
regexp="^GSSAPIAuthentication" | |
line="GSSAPIAuthentication no" | |
state=present | |
notify: | |
- restart sshd | |
- name: Run apt-get update & upgrade | |
apt: update_cache=yes upgrade=dist | |
- name: Install Packages | |
apt: name={{item}} state=latest | |
with_items: | |
- vim | |
- git | |
- nginx | |
handlers: | |
- name: restart sshd | |
service: | |
name=sshd | |
state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment