Add README for ansible/roles/core

+ Add blockchain subdirectory to root README
+ Ignore `node-modules` directory for future npm projects
Shaun Reed 2 years ago
parent 8177d4c191
commit cd63a02470

.gitignore vendored

@ -9,3 +9,4 @@

@ -5,6 +5,7 @@ This repository is a collection of useful code snippets and configurations.
├── ansible # Ansible roles, playbooks, and examples
├── blockchain # Blockchain related project templates and examples
├── cpp # C++ programs, datastructures, and other examples
├── figlet # Figlet fonts I like :)

@ -1,31 +1,112 @@
Role Name
A brief description of the role goes here.
An ansible role for deploying a default configuration for Ubuntu servers
This role installs ranger, vim with Pathogen and plugins, configures git, `.bashrc`, `.bash_aliases`,
unattended-upgrades, SSH configurations, PAM modules, Yubikey authentication,
and installs a custom MOTD to display on login.
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
None, this role will apply settings specified in `core/defaults/main.yml`
The only requirement is that we can run this play on the remote host to configure.
I test this role on Ubuntu servers.
Though the way packages are installed in this role is not specific to Ubuntu,
locations of certain destinations for configs may be slightly different.
As this role is a WIP, there is a *temporary* requirement to modify
`core/files/authorized_yubikeys` manually. Be sure these key prefixes match that
of your yubikeys, and that the username also corresponds with the user on the
system who should be identified and authenticated by this yubikey.
Where the user `username` can be identified by *two* yubikeys.
Both yubikeys generate OTP with a static prefix of
`cccckey1cccc` or `cccckey2cccc`
Role Variables
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
`packages: [python-apt, git, vim, ssh, libpam-yubico, ranger]`
* A list of packages to install on the system with the default package manager
`authusers: [user1, user2]`
* The users that should bypass additional PAM authentication modules.
This does not include public key authentication.
All users must provide a valid key. This will only bypass passwords and 2FA
`ssh_port: 22`
* The port SSH is running on the server
`auth_methods: "publickey,keyboard-interactive"`
* Authentication methods to configure within `/etc/sshd_config` file
`git_email: ""`
`git_name: "Shaun Reed"`
* The email address and name to configure within `~/.gitconfig` file.
This applies to the user that executes ansible plays on the remote server.
vim_plugins: [{ repo: 'dense-analysis/ale', dest: 'ale'},
{ repo: 'chrisbra/Colorizer', dest: 'colorizer'},
{ repo: 'ervandew/supertab', dest: 'supertab'},
{ repo: 'chrisbra/unicode.vim', dest: 'unicode'},
{ repo: 'vim-airline/vim-airline', dest: 'vim-airline'},
{ repo: 'vim-airline/vim-airline-themes', dest: 'vim-airline-themes'},
{ repo: 'mhinz/vim-signify', dest: 'signify'}
* A list of vim plugins to install.
These plugins will be installed for the user that executes ansible plays
on the remote host. These will also be cloned into `/etc/skel/.vim/bundle/`,
making all of these plugins available for all future users created on the system.
Vim plugins are managed by Pathogen.
* Used to configure `/etc/apt/apt.conf.d/50unattended-upgrades`.
Email alerts will be sent to this address when automatic upgrades are performed
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
First, make sure all settings within `defaults/main.yml` are correct for your
server. All settings and their purposes are outline in the section above.
Create a new ansible play. You can name it whatever you want, but this
example play will simply be named `core.yml`.
- hosts: testserver
become: yes
- core
Make sure the IP for `testserver` is correct in the `/etc/ansible/hosts` file -
- hosts: servers
- { role: username.rolename, x: 42 }
Run the play!
ansible-playbook core.yml
@ -35,4 +116,9 @@ BSD
Author Information
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Contact: | URL: | GitHub: shaunrd0
TODO: Add variables for `authorized_yubikeys`
TODO: Add variables for configuring a custom `/etc/hosts`
TODO: Use a package manager, or official repository to install ranger

@ -1,61 +0,0 @@
# Author: Shaun Reed | Contact: | URL: ##
## A custom bash script to configure vim with my preferred settings ##
## Run as user with sudo within directory to store / stash .vimrc configs ##
printf "\nUpdating, upgrading required packages...\n"
sudo apt -y update && sudo apt -y upgrade
sudo apt install vim git
# Clone klips repository in a temp directory
git clone temp/
# Relocate the files we need and remove the temp directory
mkdir -pv /etc/config-vim
mv -fuv temp/ /etc/config-vim/ && mv -fuv temp/configs/.vimrc* /etc/config-vim/
rm -Rf temp/
printf "\n${GREEN}Klips config files updated"\
"\nSee /etc/config-vim/ for more information.${NORMAL}\n\n"
# Create backup dir for .vimrc
mkdir -pv /etc/config-vim/backup/
printf "\n${GREEN}Backup directory created - /etc/config-vim/backup/${NORMAL}\n"
# Copy cloned clonfig into user directory
cp /etc/config-vim/.vimrc ~/
# Copy our cloned config into global directories
cp /etc/config-vim/.vimrc /etc/skel/.vimrc
cp /etc/config-vim/.vimrc /etc/vim/vimrc
printf "${GREEN}New /usr/share/vim/vimfiles configuration installed.${NORMAL}\n"
# Reinstall Pathogen plugin manager for vim
printf "\n${RED}Removing any previous installations of Pathogen...${NORMAL}\n"
sudo rm -f /usr/share/vim/vimfiles/autoload/pathogen.vim
# Install Pathogen
printf "\n${GREEN}Installing Pathogen plugin manager for Vim....\n"\
"\nIf they don't exist, we will create the following directories:\n"\
"/usr/share/vim/vimfiles/autoload/ /usr/share/vim/vimfiles/bundle/${NORMAL}"
mkdir -pv /usr/share/vim/vimfiles/autoload /usr/share/vim/vimfiles/bundle && \
sudo curl -LSso /usr/share/vim/vimfiles/autoload/pathogen.vim
printf "\n${GREEN}Pathogen has been installed! Plugins plugins can now be easily installed.\n"\
"Clone any plugin repositories into /usr/share/vim/vimfiles/bundles${NORMAL}\n"
# Remove any plugins managed by this config tool (Klips)
printf "\n${RED}Removing plugins installed by this tool...${NORMAL}\n"
sudo rm -R /usr/share/vim/vimfiles/bundle/*
# Clone plugin repos into pathogen plugin directory
printf "\n${GREEN}Installing updated plugins...${NORMAL}\n"
git clone /usr/share/vim/vimfiles/bundle/supertab && \
printf "\n${GREEN}Supertab plugin has been installed${NORMAL}\n\n" && \
git clone /usr/share/vim/vimfiles/bundle/clang_complete && \
printf "\n${GREEN}Clang Completion plugin has been installed${NORMAL}\n\n"
vimConf=( "\n${UNDERLINE}Vim has been configured with the Klips repository.${NORMAL}" \
"\nConfiguration Changes: " )
printf '%b\n' "${vimConf[@]}"
sudo cat /etc/klips/configs/.vimrc-README

@ -17,7 +17,7 @@
- /etc/skel/.vim/bundle/
- /etc/skel/.vim/autoload/
- name: Install Pathogen, sourcerer theme
- name: Install Pathogen, sourcerer theme for ansible user
src: files/{{ item.src }}
dest: /home/ansibleuser/.vim/{{ item.dest }}
@ -25,12 +25,7 @@
- { src: 'pathogen.vim', dest: 'autoload/pathogen.vim'}
- { src: 'sourcerer.vim', dest: 'colors/sourcerer.vim'}
- name: Install sourcerer theme
src: files/pathogen.vim
dest: /home/ansibleuser/.vim/autoload/
- name : Install vim plugins
- name : Install vim plugins for ansible user
repo:{{ item.repo }}
dest: /home/ansibleuser/.vim/bundle/{{ item.dest }}
@ -50,7 +45,7 @@
dest: /etc/skel/.vim/bundle/{{ item.dest }}
with_items: "{{ vim_plugins }}"
- name: Configure vim
- name: Configure .vimrc for ansible user and skeleton files
src: files/.vimrc
dest: "{{ item }}"