├── .ansible-lint ├── .github └── workflows │ ├── galaxy.yml │ ├── lint.yml │ └── readme.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .yamllint ├── LICENSE ├── Makefile ├── README.md ├── README.yaml ├── defaults └── main.yml ├── meta └── main.yml ├── tasks ├── main.yml ├── users.yml └── zsh.yml ├── templates ├── config │ ├── bash_profile.in │ ├── extra.in │ ├── nrpe.in │ └── zshrc.in └── keys │ └── ssh_config └── tutorial-env ├── bin ├── python └── python3 ├── lib64 └── pyvenv.cfg /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | ## skip errors 3 | skip_list: 4 | - 'fqcn-builtins' 5 | - 'ignore_errors' 6 | -------------------------------------------------------------------------------- /.github/workflows/galaxy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release to Ansible Galaxy 3 | 4 | 'on': 5 | push: 6 | tags: 7 | - '*' 8 | 9 | jobs: 10 | release: 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - name: galaxy 14 | uses: robertdebock/galaxy-action@1.0.1 15 | with: 16 | galaxy_api_key: ${{ secrets.galaxy_api_key }} 17 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Lint 3 | 'on': 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | 11 | yamllint: 12 | name: yamllint 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Check out the codebase. 16 | uses: actions/checkout@v2 17 | 18 | - name: Set up Python 3.7. 19 | uses: actions/setup-python@v2 20 | with: 21 | python-version: '3.x' 22 | 23 | - name: Install yamllist 24 | run: pip3 install yamllint 25 | 26 | - name: Run yamllint. 27 | run: yamllint . 28 | 29 | ansible-lint: 30 | name: ansible-lint 31 | runs-on: ubuntu-latest 32 | steps: 33 | - name: Checkout the codebase. 34 | uses: actions/checkout@v2 35 | 36 | - name: Set up Python 3.7. 37 | uses: actions/setup-python@v2 38 | with: 39 | python-version: '3.x' 40 | 41 | - name: Install ansible and other packages 42 | run: pip3 install ansible ansible-lint 43 | 44 | - name: Run ansible-lint. 45 | run: ansible-lint 46 | 47 | pre-commit: 48 | name: 'Pre-Commit' 49 | needs: 50 | - yamllint 51 | - ansible-lint 52 | runs-on: ubuntu-latest 53 | steps: 54 | - name: 'Checkout' 55 | uses: actions/checkout@v2.3.4 56 | 57 | - name: Install ansible-lint 58 | run: pip3 install ansible-lint 59 | 60 | - name: 'Pre-Commit 🔎' 61 | uses: pre-commit/action@v2.0.3 62 | continue-on-error: true 63 | 64 | - name: 'Slack Notification' 65 | uses: clouddrove/action-slack@v2 66 | with: 67 | status: ${{ job.status }} 68 | fields: repo,author 69 | author_name: 'CloudDrove Inc.' 70 | env: 71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 72 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ANSIBLE }} 73 | if: always() 74 | -------------------------------------------------------------------------------- /.github/workflows/readme.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Create README.md file' 3 | 'on': 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | readme-create: 10 | name: 'Autogenerate Readme file' 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: 'Checkout' 14 | uses: actions/checkout@master 15 | 16 | - name: Set up Python 3.7. 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: '3.x' 20 | 21 | - name: 'Generate readme.md from readme.yaml' 22 | uses: 'clouddrove/github-actions@v8.0' 23 | with: 24 | actions_subcommand: 'readme' 25 | github_token: '${{ secrets.GITHUB }}' 26 | env: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | 29 | - name: Install ansible-lint 30 | run: pip3 install ansible-lint 31 | 32 | - name: pre-commit check errors 33 | uses: pre-commit/action@v2.0.0 34 | continue-on-error: true 35 | 36 | - name: pre-commit fix errors 37 | uses: pre-commit/action@v2.0.0 38 | continue-on-error: true 39 | 40 | - name: 'push readme' 41 | uses: 'clouddrove/github-actions@v8.0' 42 | continue-on-error: true 43 | with: 44 | actions_subcommand: 'push' 45 | env: 46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 47 | 48 | - name: 'Slack Notification' 49 | uses: clouddrove/action-slack@v2 50 | with: 51 | status: ${{ job.status }} 52 | fields: repo,author 53 | author_name: 'CloudDrove Inc.' 54 | env: 55 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 56 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ANSIBLE }} 57 | if: always() 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignored files 2 | .idea 3 | *.iml 4 | *.zip 5 | *.cache 6 | molecule 7 | 8 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | repos: 3 | 4 | - repo: https://github.com/pre-commit/pre-commit-hooks.git 5 | rev: v3.4.0 6 | hooks: 7 | - id: end-of-file-fixer 8 | - id: trailing-whitespace 9 | - id: mixed-line-ending 10 | - id: check-byte-order-marker 11 | - id: check-executables-have-shebangs 12 | - id: check-merge-conflict 13 | - id: debug-statements 14 | - id: check-yaml 15 | - id: check-added-large-files 16 | 17 | - repo: https://github.com/ansible/ansible-lint.git 18 | rev: v5.0.8 19 | hooks: 20 | - id: ansible-lint 21 | files: \.(yaml|yml)$ 22 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: 6 | max: 120 7 | level: warning 8 | truthy: 9 | allowed-values: ['true', 'false', 'yes', 'no'] 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Cloud Drove 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GENIE_PATH ?= $(shell 'pwd')/../../../genie 2 | 3 | include $(GENIE_PATH)/Makefile 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 |

7 | Ansible Role User 8 |

9 | 10 |

11 | This ansible role is used to create users on server. 12 |

13 | 14 |

15 | 16 | 17 | Ansible 18 | 19 | 20 | Licence 21 | 22 | 23 | Distribution 24 | 25 | 26 | Distribution 27 | 28 | 29 | 30 |

31 |

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |

44 |
45 | 46 | 47 | 48 | We eat, drink, sleep and most importantly love **DevOps**. DevOps always promotes automation and standardisation. While setting up various environments like local, dev, testing, production, etc. it is critical to maintain the same environment across. This can easily be achieved using automating the environment setup & installation with the help of ansible-playbooks. 49 | 50 | Smaller roles are created for each environment elements; which also include tasks & tests. These roles can then be grouped together in [ansible-playbook](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) to achieve the desired yet consistent results. 51 | 52 | 53 | 54 | ## Prerequisites 55 | 56 | This module has a few dependencies: 57 | 58 | - [Ansible2.8](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) 59 | - [Python](https://www.python.org/downloads) 60 | 61 | 62 | 63 | 64 | ## What Includes 65 | 66 | Followiing things includes in this role: 67 | - user management 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | ## Example Playbook 76 | 77 | **IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/ansible-role-user/releases). 78 | 79 | 80 | ```yaml 81 | - hosts: localhost 82 | remote_user: ubuntu 83 | become: true 84 | roles: 85 | - clouddrove.ansible_role_user 86 | ``` 87 | 88 | 89 | ## Variables 90 | 91 | ```yaml 92 | users: 93 | - username: nikita 94 | use_sudo: true 95 | 96 | - username: anmol 97 | use_sudo: false 98 | 99 | rm_users: 100 | - username: sohan 101 | ``` 102 | 103 | 104 | ## Installation 105 | 106 | ```console 107 | $ ansible-galaxy install clouddrove.ansible_role_user 108 | ``` 109 | 110 | 111 | 112 | 113 | 114 | 115 | ## Feedback 116 | If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/ansible-role-user/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com). 117 | 118 | If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/ansible-role-user)! 119 | 120 | ## About us 121 | 122 | At [CloudDrove][website], we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering. 123 | 124 |

We are The Cloud Experts!

125 |
126 |

We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.

127 | 128 | [website]: https://clouddrove.com 129 | [github]: https://github.com/clouddrove 130 | [linkedin]: https://cpco.io/linkedin 131 | [twitter]: https://twitter.com/clouddrove/ 132 | [email]: https://clouddrove.com/contact-us.html 133 | [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= 134 | -------------------------------------------------------------------------------- /README.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # This is the canonical configuration for the `README.md` 4 | # Run `make readme` to rebuild the `README.md` 5 | # 6 | 7 | # Name of this project 8 | name: Ansible Role User 9 | 10 | # License of this project 11 | license: "MIT" 12 | 13 | # Canonical GitHub repo 14 | github_repo: clouddrove/ansible-role-user 15 | 16 | # Badges to display 17 | badges: 18 | - name: "Ansible" 19 | image: "https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible" 20 | url: "https://www.ansible.com" 21 | - name: "Licence" 22 | image: "https://img.shields.io/badge/License-MIT-blue.svg" 23 | url: "LICENSE.md" 24 | - name: "Distribution" 25 | image: "https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu" 26 | url: "https://ubuntu.com/" 27 | - name: "Distribution" 28 | image: "https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu" 29 | url: "https://ubuntu.com/" 30 | # Prerequesties to display 31 | # yamllint disable 32 | prerequesties: 33 | - name: "Ansible2.8" 34 | url: "https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html" 35 | - name: "Python" 36 | url: "https://www.python.org/downloads" 37 | # yamllint enable 38 | # What Includes to display 39 | what_includes: 40 | - name: "user management" 41 | 42 | # description of this project 43 | description: |- 44 | This ansible role is used to create users on server. 45 | 46 | # How to use this project 47 | usage: |- 48 | ```yaml 49 | - hosts: localhost 50 | remote_user: ubuntu 51 | become: true 52 | roles: 53 | - clouddrove.ansible_role_user 54 | ``` 55 | # Variables use in the project 56 | variables: |- 57 | ```yaml 58 | users: 59 | - username: nikita 60 | use_sudo: true 61 | 62 | - username: anmol 63 | use_sudo: false 64 | 65 | rm_users: 66 | - username: sohan 67 | ``` 68 | # How to install project 69 | installation: |- 70 | ```console 71 | $ ansible-galaxy install clouddrove.ansible_role_user 72 | ``` 73 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # users list to create 4 | users: 5 | - username: anmol 6 | use_sudo: true 7 | zsh_theme: steeef 8 | 9 | # users list to remove 10 | rm_user_flag: false 11 | # rm_users: 12 | # - username: user #username 13 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | 4 | galaxy_info: 5 | author: Anmol Nagpal 6 | description: This ansible role is used to create users on server. 7 | company: "CloudDrove Inc." 8 | license: "license (BSD, MIT)" 9 | role_name: ansible_role_user 10 | namespace: "clouddrove" 11 | min_ansible_version: 2.4 12 | platforms: 13 | - name: Debian 14 | versions: 15 | - jessie 16 | - stretch 17 | - name: Ubuntu 18 | versions: 19 | - trusty 20 | - xenial 21 | - bionic 22 | galaxy_tags: 23 | - server 24 | - ubuntu 25 | - linux 26 | - user 27 | - users 28 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - import_tasks: users.yml 4 | - import_tasks: zsh.yml 5 | -------------------------------------------------------------------------------- /tasks/users.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: add users | create users, shell, home dirs 4 | user: 5 | name: "{{ item.username }}" 6 | shell: "/bin/bash" 7 | createhome: true 8 | comment: 'created with ansible' 9 | with_items: '{{ users }}' 10 | 11 | - name: modify .ssh permissions 12 | file: 13 | path: '/home/{{ item.username }}/.ssh' 14 | state: directory 15 | owner: "{{ item.username }}" 16 | group: "{{ item.username }}" 17 | mode: 0700 18 | with_items: '{{ users }}' 19 | 20 | - name: setup | authorized key upload 21 | authorized_key: 22 | user: "{{ item.username }}" 23 | key: "{{ lookup('file', './../../_ssh/'+Env+'/'+item.username+'.pub') }}" 24 | path: '/home/{{ item.username }}/.ssh/authorized_keys' 25 | manage_dir: false 26 | with_items: '{{ users }}' 27 | 28 | - name: transfer ssh config /etc/ssh/ssh_config 29 | copy: 30 | src: templates/keys/ssh_config 31 | dest: /home/{{ item.username }}/.ssh/config 32 | owner: "{{ item.username }}" 33 | group: "{{ item.username }}" 34 | mode: 0600 35 | with_items: '{{ users }}' 36 | 37 | - name: sudoers | update sudoers file and validate 38 | lineinfile: 39 | dest: "/etc/sudoers" 40 | insertafter: EOF 41 | line: '{{ item.username }} ALL=(ALL) NOPASSWD: ALL' 42 | regexp: '^{{ item.username }} .*' 43 | state: present 44 | when: item.use_sudo 45 | with_items: '{{ users }}' 46 | 47 | - name: delete user | remove user 48 | user: 49 | name: "{{ item.username }}" 50 | state: absent 51 | remove: true 52 | failed_when: "'NOTHING' in command_result.stderr" 53 | when: rm_user_flag 54 | with_items: '{{ rm_users }}' 55 | -------------------------------------------------------------------------------- /tasks/zsh.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Install Oh-my-zsh 3 | 4 | - name: install git and zsh debian 5 | apt: 6 | name: ['git', 'zsh'] 7 | state: present 8 | update_cache: true 9 | cache_valid_time: 5400 10 | 11 | - name: clone oh-my-zsh repo 12 | git: 13 | depth: 1 14 | repo: "{{ item.name }}" 15 | version: master 16 | dest: /usr/local/share/{{ item.dir }} 17 | with_items: 18 | - name: https://github.com/robbyrussell/oh-my-zsh 19 | dir: oh-my-zsh 20 | - name: https://github.com/zsh-users/zsh-syntax-highlighting 21 | dir: zsh-syntax-highlighting 22 | - name: https://github.com/zsh-users/zsh-autosuggestions 23 | dir: zsh-autosuggestions 24 | 25 | - name: create conf folder in home directory 26 | file: 27 | path: "{{ item }}" 28 | state: directory 29 | mode: 0777 30 | with_items: 31 | - "/usr/local/share/oh-my-zsh/conf/" 32 | - "/usr/local/share/oh-my-zsh/cache/" 33 | 34 | - name: deploy .zshrc 35 | template: 36 | src: config/zshrc.in 37 | dest: /usr/local/share/oh-my-zsh/conf/zshrc 38 | mode: 0777 39 | 40 | - name: deploy .extra 41 | template: 42 | src: config/extra.in 43 | dest: "{{ home_dir | default('/home/') }}{{ item.username }}/.extra" 44 | mode: 0777 45 | with_items: '{{ users }}' 46 | 47 | - name: deploy .bash_profile 48 | template: 49 | src: config/bash_profile.in 50 | dest: "{{ home_dir | default('/home/') }}{{ item.username }}/.bash_profile" 51 | mode: 0777 52 | with_items: '{{ users }}' 53 | 54 | - name: remove standard zshrc 55 | file: 56 | path: "{{ home_dir | default('/home/') }}{{ item.username }}/.zshrc" 57 | state: absent 58 | changed_when: false 59 | with_items: '{{ users }}' 60 | 61 | - name: symlink zshrc 62 | file: 63 | path: "{{ home_dir | default('/home/') }}{{ item.username }}/.zshrc" 64 | src: /usr/local/share/oh-my-zsh/conf/zshrc 65 | state: link 66 | mode: 0777 67 | changed_when: false 68 | with_items: '{{ users }}' 69 | 70 | - name: set zsh as default shell 71 | shell: "chsh -s $(which zsh) {{ item.username }}" 72 | changed_when: false 73 | with_items: '{{ users }}' 74 | -------------------------------------------------------------------------------- /templates/config/bash_profile.in: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | printf "\n" 4 | TEXT="{{Env | default ('')}} {{hostvars[inventory_hostname].EcType | default ('')}} {{hostvars[inventory_hostname].Nr | default ('')}}" 5 | sysbanner=`perl -e "print uc('$TEXT');"` 6 | figlet $sysbanner 7 | printf "\n" 8 | 9 | # Terminal PS1 10 | export PS1="\n\[\\e[1;37m\\]\T : \[\033[01;31m\]\u\[\033[01;33m\] @ \[\033[01;36m\]\H \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]" 11 | 12 | #UTF-8 Compass generation 13 | export LC_ALL="en_US.UTF-8" 14 | export LANG="en_US.UTF-8" 15 | -------------------------------------------------------------------------------- /templates/config/extra.in: -------------------------------------------------------------------------------- 1 | # Ansible managed 2 | 3 | TEXT="prod bastion 1" 4 | 5 | upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" 6 | secs=$((${upSeconds}%60)) 7 | mins=$((${upSeconds}/60%60)) 8 | hours=$((${upSeconds}/3600%24)) 9 | days=$((${upSeconds}/86400)) 10 | UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` 11 | 12 | # get the load averages 13 | read one five fifteen rest < /proc/loadavg 14 | 15 | echo "$(tput setaf 033) 16 | .//////////////, 17 | //////////////////// 18 | .///////////////////(((. 19 | /(((((((((((((((((. $(tput setaf 244) ./((((( (( ((((((* (( /( (((((/, $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) HostName...........:$(tput setaf 244) $(tput bold)`perl -e "print uc('$TEXT');"`$(tput sgr0)$(tput setaf 033) 20 | /(((((((((((((%(, $(tput setaf 244) (/ (( /( /( (( (( (( ,( $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) OS.................:$(tput setaf 244) `uname -srmo`$(tput setaf 033) 21 | /((((((((((((/ $(tput setaf 244) (( (( (( (, (( (( (( (/ $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Uptime.............:$(tput setaf 244) ${UPTIME}$(tput setaf 033) 22 | /((((((((((%*. $(tput setaf 244) .((((((( (((((( ((((((((, (((((((* (((((((( $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Memory.............:$(tput setaf 244) `cat /proc/meminfo | grep MemFree | awk {'print $2/1000000'}`G (Free) / `cat /proc/meminfo | grep MemTotal | awk {'print $2/1000000'}`G (Total) $(tput setaf 033) 23 | /((((####(, $(tput setaf 244) $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) HDD................:$(tput setaf 244) `df -h --total | grep total | awk '{print $4}'` (Free) / `df -h --total | grep total | awk '{print $2}'` (Total) $(tput setaf 033) 24 | /######### $(tput setaf 244) ###(####. ###*/(## ###%#(##/ ### ## ####### $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Load Averages......:$(tput setaf 244) ${one}, ${five}, ${fifteen} (1, 5, 15 min) $(tput setaf 033) 25 | /##########. $(tput setaf 244) ##* ## ### ### ## ##. ### ## #,,,,, $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Running Processes..:$(tput setaf 244) `ps ax | wc -l | tr -d " "` $(tput setaf 033) 26 | /################ $(tput setaf 244) ##* %## ###.## ### ### ## ##/ #''''' $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Internal IP........:$(tput setaf 244) `ip a | grep glo | awk '{print $2}' | head -1 | cut -f1 -d/` $(tput setaf 033) 27 | *#################* $(tput setaf 244) %%%%%%% %%# %%# %%%%%%. %%%# %%%%%%% $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) External IP........:$(tput setaf 244) `wget -q -O - http://icanhazip.com/ | tail` $(tput setaf 033) 28 | %%%%%%%%%%%%%%%%%%%%%%. 29 | *%%%%%%%%%%%%%%%%%%* 30 | .,/#%%%%%%%%#/,. 31 | 32 | $(tput sgr0)" 33 | 34 | # UTF-8 Compass generation 35 | export LC_ALL='en_US.UTF-8' 36 | export LANG='en_US.UTF-8' 37 | -------------------------------------------------------------------------------- /templates/config/nrpe.in: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | ############################################################################# 4 | # Sample NRPE Config File 5 | # Written by: Ethan Galstad (nagios@nagios.org) 6 | # 7 | # Last Modified: 11-23-2007 8 | # 9 | # NOTES: 10 | # This is a sample configuration file for the NRPE daemon. It needs to be 11 | # located on the remote host that is running the NRPE daemon, not the host 12 | # from which the check_nrpe client is being executed. 13 | ############################################################################# 14 | 15 | 16 | # LOG FACILITY 17 | # The syslog facility that should be used for logging purposes. 18 | 19 | log_facility=daemon 20 | 21 | 22 | 23 | # PID FILE 24 | # The name of the file in which the NRPE daemon should write it's process ID 25 | # number. The file is only written if the NRPE daemon is started by the root 26 | # user and is running in standalone mode. 27 | 28 | pid_file=/var/run/nagios/nrpe.pid 29 | 30 | 31 | 32 | # PORT NUMBER 33 | # Port number we should wait for connections on. 34 | # NOTE: This must be a non-priviledged port (i.e. > 1024). 35 | # NOTE: This option is ignored if NRPE is running under either inetd or xinetd 36 | 37 | server_port=5666 38 | 39 | 40 | 41 | # SERVER ADDRESS 42 | # Address that nrpe should bind to in case there are more than one interface 43 | # and you do not want nrpe to bind on all interfaces. 44 | # NOTE: This option is ignored if NRPE is running under either inetd or xinetd 45 | 46 | #server_address={{ansible_hostname}} 47 | 48 | 49 | 50 | # NRPE USER 51 | # This determines the effective user that the NRPE daemon should run as. 52 | # You can either supply a username or a UID. 53 | # 54 | # NOTE: This option is ignored if NRPE is running under either inetd or xinetd 55 | 56 | nrpe_user=nagios 57 | 58 | 59 | 60 | # NRPE GROUP 61 | # This determines the effective group that the NRPE daemon should run as. 62 | # You can either supply a group name or a GID. 63 | # 64 | # NOTE: This option is ignored if NRPE is running under either inetd or xinetd 65 | 66 | nrpe_group=nagios 67 | 68 | 69 | 70 | # ALLOWED HOST ADDRESSES 71 | # This is an optional comma-delimited list of IP address or hostnames 72 | # that are allowed to talk to the NRPE daemon. Network addresses with a bit mask 73 | # (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently 74 | # supported. 75 | # 76 | # Note: The daemon only does rudimentary checking of the client's IP 77 | # address. I would highly recommend adding entries in your /etc/hosts.allow 78 | # file to allow only the specified host to connect to the port 79 | # you are running this daemon on. 80 | # 81 | # NOTE: This option is ignored if NRPE is running under either inetd or xinetd 82 | 83 | allowed_hosts=52.31.32.200 84 | 85 | 86 | 87 | # COMMAND ARGUMENT PROCESSING 88 | # This option determines whether or not the NRPE daemon will allow clients 89 | # to specify arguments to commands that are executed. This option only works 90 | # if the daemon was configured with the --enable-command-args configure script 91 | # option. 92 | # 93 | # *** ENABLING THIS OPTION IS A SECURITY RISK! *** 94 | # Read the SECURITY file for information on some of the security implications 95 | # of enabling this variable. 96 | # 97 | # Values: 0=do not allow arguments, 1=allow command arguments 98 | 99 | dont_blame_nrpe=0 100 | 101 | 102 | 103 | # BASH COMMAND SUBTITUTION 104 | # This option determines whether or not the NRPE daemon will allow clients 105 | # to specify arguments that contain bash command substitutions of the form 106 | # $(...). This option only works if the daemon was configured with both 107 | # the --enable-command-args and --enable-bash-command-substitution configure 108 | # script options. 109 | # 110 | # *** ENABLING THIS OPTION IS A HIGH SECURITY RISK! *** 111 | # Read the SECURITY file for information on some of the security implications 112 | # of enabling this variable. 113 | # 114 | # Values: 0=do not allow bash command substitutions, 115 | # 1=allow bash command substitutions 116 | 117 | allow_bash_command_substitution=0 118 | 119 | 120 | 121 | # COMMAND PREFIX 122 | # This option allows you to prefix all commands with a user-defined string. 123 | # A space is automatically added between the specified prefix string and the 124 | # command line from the command definition. 125 | # 126 | # *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! *** 127 | # Usage scenario: 128 | # Execute restricted commmands using sudo. For this to work, you need to add 129 | # the nagios user to your /etc/sudoers. An example entry for alllowing 130 | # execution of the plugins from might be: 131 | # 132 | # nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/ 133 | # 134 | # This lets the nagios user run all commands in that directory (and only them) 135 | # without asking for a password. If you do this, make sure you don't give 136 | # random users write access to that directory or its contents! 137 | 138 | # command_prefix=/usr/bin/sudo 139 | 140 | 141 | 142 | # DEBUGGING OPTION 143 | # This option determines whether or not debugging messages are logged to the 144 | # syslog facility. 145 | # Values: 0=debugging off, 1=debugging on 146 | 147 | debug=0 148 | 149 | 150 | 151 | # COMMAND TIMEOUT 152 | # This specifies the maximum number of seconds that the NRPE daemon will 153 | # allow plugins to finish executing before killing them off. 154 | 155 | command_timeout=60 156 | 157 | 158 | 159 | # CONNECTION TIMEOUT 160 | # This specifies the maximum number of seconds that the NRPE daemon will 161 | # wait for a connection to be established before exiting. This is sometimes 162 | # seen where a network problem stops the SSL being established even though 163 | # all network sessions are connected. This causes the nrpe daemons to 164 | # accumulate, eating system resources. Do not set this too low. 165 | 166 | connection_timeout=300 167 | 168 | 169 | 170 | # WEEK RANDOM SEED OPTION 171 | # This directive allows you to use SSL even if your system does not have 172 | # a /dev/random or /dev/urandom (on purpose or because the necessary patches 173 | # were not applied). The random number generator will be seeded from a file 174 | # which is either a file pointed to by the environment valiable $RANDFILE 175 | # or $HOME/.rnd. If neither exists, the pseudo random number generator will 176 | # be initialized and a warning will be issued. 177 | # Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness 178 | 179 | #allow_weak_random_seed=1 180 | 181 | 182 | 183 | # INCLUDE CONFIG FILE 184 | # This directive allows you to include definitions from an external config file. 185 | 186 | #include= 187 | 188 | 189 | 190 | # INCLUDE CONFIG DIRECTORY 191 | # This directive allows you to include definitions from config files (with a 192 | # .cfg extension) in one or more directories (with recursion). 193 | 194 | #include_dir= 195 | #include_dir= 196 | 197 | 198 | 199 | # COMMAND DEFINITIONS 200 | # Command definitions that this daemon will run. Definitions 201 | # are in the following format: 202 | # 203 | # command[]= 204 | # 205 | # When the daemon receives a request to return the results of 206 | # it will execute the command specified by the argument. 207 | # 208 | # Unlike Nagios, the command line cannot contain macros - it must be 209 | # typed exactly as it should be executed. 210 | # 211 | # Note: Any plugins that are used in the command lines must reside 212 | # on the machine that this daemon is running on! The examples below 213 | # assume that you have plugins installed in a /usr/local/nagios/libexec 214 | # directory. Also note that you will have to modify the definitions below 215 | # to match the argument format the plugins expect. Remember, these are 216 | # examples only! 217 | 218 | 219 | # The following examples use hardcoded command arguments... 220 | 221 | command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 222 | command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 223 | command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 224 | command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z 225 | command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 226 | 227 | 228 | # The following examples allow user-supplied arguments and can 229 | # only be used if the NRPE daemon was compiled with support for 230 | # command arguments *AND* the dont_blame_nrpe directive in this 231 | # config file is set to '1'. This poses a potential security risk, so 232 | # make sure you read the SECURITY file before doing this. 233 | 234 | #command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$ 235 | #command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$ 236 | #command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ 237 | #command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ 238 | 239 | # 240 | # local configuration: 241 | # if you'd prefer, you can instead place directives here 242 | include=/etc/nagios/nrpe_local.cfg 243 | 244 | # 245 | # you can place your config snipplets into nrpe.d/ 246 | # only snipplets ending in .cfg will get included 247 | include_dir=/etc/nagios/nrpe.d/ 248 | -------------------------------------------------------------------------------- /templates/config/zshrc.in: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | 3 | # Path to your oh-my-zsh configuration. 4 | ZSH=/usr/local/share/oh-my-zsh 5 | 6 | # For Solarized 7 | export TERM="xterm-256color" 8 | 9 | # Set name of the theme to load. 10 | # Look in ~/.oh-my-zsh/themes/ 11 | # Optionally, if you set this to "random", it'll load a random theme each 12 | # time that oh-my-zsh is loaded. 13 | # ZSH_THEME="steeef" 14 | ZSH_THEME="{{ zsh_theme }}" 15 | ZSH_DISABLE_COMPFIX="true" 16 | 17 | # Example aliases 18 | # alias zshconfig="mate ~/.zshrc" 19 | # alias ohmyzsh="mate /usr/local/share/oh-my-zsh" 20 | 21 | # Set to this to use case-sensitive completion 22 | # CASE_SENSITIVE="true" 23 | 24 | # Comment this out to disable bi-weekly auto-update checks 25 | DISABLE_AUTO_UPDATE="true" 26 | 27 | # Uncomment to change how many often would you like to wait before auto-updates occur? (in days) 28 | # export UPDATE_ZSH_DAYS=13 29 | 30 | # Uncomment following line if you want to disable colors in ls 31 | # DISABLE_LS_COLORS="true" 32 | 33 | # Uncomment following line if you want to disable autosetting terminal title. 34 | # DISABLE_AUTO_TITLE="true" 35 | 36 | # Uncomment following line if you want red dots to be displayed while waiting for completion 37 | # COMPLETION_WAITING_DOTS="true" 38 | 39 | HISTSIZE=5000 # session history size 40 | SAVEHIST=1000 # saved history 41 | 42 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 43 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 44 | # Example format: plugins=(rails git textmate ruby lighthouse) 45 | 46 | source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 47 | source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh 48 | 49 | plugins=(git cp git-extras gnu-utils history pip python ruby screen svn npm node common-aliases cp copyfile copypath github grunt sudo ubuntu history-substring-search) 50 | 51 | bindkey '^[[A' history-substring-search-up 52 | bindkey '^[[B' history-substring-search-down 53 | 54 | # Enable Colours 55 | export CLICOLOR=1 56 | 57 | 58 | # aliases 59 | [[ -f ~/.aliases ]] && source ~/.aliases 60 | 61 | # Local config 62 | [[ -f ~/.zshrc.local ]] && source ~/.zshrc.local 63 | 64 | # functions 65 | [[ -f ~/.functions ]] && source ~/.functions 66 | 67 | # extra 68 | [[ -f ~/.extra ]] && source ~/.extra 69 | 70 | 71 | source $ZSH/oh-my-zsh.sh 72 | 73 | # Customize to your needs... 74 | export PATH="/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin" 75 | 76 | PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting 77 | -------------------------------------------------------------------------------- /templates/keys/ssh_config: -------------------------------------------------------------------------------- 1 | #{{ ansible_managed }} 2 | Host * 3 | LogLevel QUIET 4 | StrictHostKeyChecking no 5 | UserKnownHostsFile /dev/null 6 | ControlMaster auto 7 | ControlPersist 10m 8 | ControlPath /tmp/instance_socket-%r@%h:%p 9 | ForwardAgent yes 10 | -------------------------------------------------------------------------------- /tutorial-env/bin/python: -------------------------------------------------------------------------------- 1 | python3 -------------------------------------------------------------------------------- /tutorial-env/bin/python3: -------------------------------------------------------------------------------- 1 | /usr/bin/python3 -------------------------------------------------------------------------------- /tutorial-env/lib64: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /tutorial-env/pyvenv.cfg: -------------------------------------------------------------------------------- 1 | home = /usr/bin 2 | include-system-site-packages = false 3 | version = 3.7.8 4 | --------------------------------------------------------------------------------