---
- hosts: gsoc
  become: yes

  tasks:
    - name: Upgrade system.
      yum: name=* state=latest

    - name: Import EPEL GPG key.
      rpm_key: "key={{ item }} state=present"
      with_items:
        - https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

    - name: Install EPEL repository.
      command: "rpm -Uvh {{ item.href }} creates={{ item.creates }}"
      with_items:
        - href: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
          creates: "/etc/yum.repos.d/epel.repo"

    - name: Install firewalld and fail2ban.
      yum: name={{ item }} state=present
      with_items:
        - firewalld
        - fail2ban

    - name: Start and enable firewalld and fail2ban.
      service: name={{ item }} state=started enabled=yes
      with_items:
        - firewalld
        - fail2ban

    - name: Create user for jflory.
      user: name=jflory createhome=yes

    - name: Upload public key to SSH directory for jflory.
      copy: 
        src: "{{ item.src }}"
        dest: "{{ item.dest }}"
        owner: jflory
        group: jflory
        mode: 0400
      with_items:
        - src: "~/.ssh/id_rsa.pub"
          dest: "/home/jflory/.ssh/authorized_keys"

    - name: Install Mosh server.
      yum: name=mosh state=present

    - name: Start and enable Mosh server.
      service: name=mosh state=started enabled=yes

    - name: Set up firewalld rule for Mosh.
      firewalld: immediate=yes permanent=yes port=60597/udp state=enabled

Add playbook for a basic setup of CentOS/RHEL 7 machine
Add playbook for a basic setup of CentOS/RHEL 7 machine

This commit adds my first-ever playbook to the repo!

Additions based off of "Ansible for DevOps" by Jeff Geerling and the things I first do whenever I log into a new machine. This should automate the first 30 minutes of setting up a new machine... more additions will be added as I continue to pick up things.
