From 565b57a1b91dc15b6280b35cc370ce63cf77ec70 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 12 Dec 2020 23:03:33 +0100 Subject: [PATCH] Initial commit --- .github/FUNDING.yml | 4 + .github/license.svg | 217 ++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 24 +++++ .gitmodules | 12 +++ LICENCE | 21 +++++ README.md | 29 ++++++ ansible.cfg | 33 +++++++ hosts.ini | 2 + roles/README.md | 20 ++++ roles/base | 1 + roles/bat | 1 + roles/dotfiles | 1 + roles/ranger | 1 + site.yml | 9 ++ 14 files changed, 375 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/license.svg create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 LICENCE create mode 100644 README.md create mode 100644 ansible.cfg create mode 100644 hosts.ini create mode 100644 roles/README.md create mode 160000 roles/base create mode 160000 roles/bat create mode 160000 roles/dotfiles create mode 160000 roles/ranger create mode 100644 site.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..51ba466 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: [do1jlr] +liberapay: L3D diff --git a/.github/license.svg b/.github/license.svg new file mode 100644 index 0000000..4ab6d9a --- /dev/null +++ b/.github/license.svg @@ -0,0 +1,217 @@ + + + + + + image/svg+xml + + + + + + 3D <l3d@c3woc.de> + + + + + MIT License + + + + + + + + + + + + + + + + + + + + + + + + + + + MIT + MIT + + + license + license + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63b154d --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# ---> Ansible +*.retry +*.vault diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6046a9d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "roles/base"] + path = roles/base + url = https://github.com/roles-ansible/ansible_role_base.git +[submodule "roles/ranger"] + path = roles/ranger + url = https://github.com/roles-ansible/ansible_role_ranger.git +[submodule "roles/bat"] + path = roles/bat + url = https://github.com/gantsign/ansible_role_bat.git +[submodule "roles/dotfiles"] + path = roles/dotfiles + url = https://github.com/chaos-bodensee/role_dotfiles.git diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..10e0d6d --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 L3D + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..882f89f --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +[![MIT License](https://raw.githubusercontent.com/DO1JLR/ansible_playbook_template/main/.github/license.svg?sanitize=true)](https://github.com/DO1JLR/ansible_playbook_template/blob/main/LICENSE) + +Ansible playbook to set up ...something +========================================= + +This is a ansible playbook to setup ... Server and maybe some other projects. We will see... + + + + Tipps und Tricks: +--------- +### git submodule +Dieses Ansible verwendet submodule. Vergesst nicht diese regelmäßig mit auszuchecken! +``` +git config submodule.recurse true +git submodule update --init --recursive +``` + +### Standard Playbook +Das standard Playook ist ``site.yml``. Womöglich sind hier andere Playbooks eingebunden... + +### best practise Ansible-Vault: +[docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.htm](https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#tip-for-variables-and-vaults) + +### weitere Methide variablen ins ansible vault: +``` +ansible-vault encrypt_string 'encrypted_secret_string_value' \ + -n string_name +``` diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..2f2ccc3 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,33 @@ +[defaults] +inventory = ./hosts.ini +remote_user = root +retry_files_enabled = False +nocows = True + +log_path = $HOME/.ansible/ansible.log + +forks = 20 +gathering = smart +fact_caching = jsonfile +fact_caching_connection = $HOME/.ansible/facts +fact_caching_timeout = 7200 +host_key_checking = False +callback_whitelist = profile_tasks +stdout_callback = yaml + +interpreter_python = /usr/bin/python3 + +# vault_password_file =./.vault + +[ssh_connection] +control_path = %(directory)s/%%h-%%r-%%p +ssh_args = -o StrictHostKeyChecking=accept-new -o ControlMaster=auto -o ControlPersist=600s +pipelining = True +retries = 10 + +[privilege_escalation] +become=Yes +become_method=sudo +become_user=root +become_ask_pass=False + diff --git a/hosts.ini b/hosts.ini new file mode 100644 index 0000000..5a53c20 --- /dev/null +++ b/hosts.ini @@ -0,0 +1,2 @@ +[random_category] +localhost ansible_connection=local diff --git a/roles/README.md b/roles/README.md new file mode 100644 index 0000000..01210e7 --- /dev/null +++ b/roles/README.md @@ -0,0 +1,20 @@ + Subfolders to include ansible roles. +============================ + +All roles should be included in this subfolder. +This is usually done as git submodule. + +The most common command needed for this is: + +``` +git submodule add +``` + +A simple way to checkk out the latest commit at the main branch for all submodules is: +``` +git submodule foreach "(git checkout $(git symbolic-ref --short refs/remotes/origin/HEAD | sed "s@^origin/@@"); git pull)" +``` + +In abstract terms, the easiest way to do this is to treat submodules like normal git repositories after you have cloned them. This means checking out the main branch, committing things and similar actions. And when the local changes to submodule git repo are complete, add the new commit hash of submodule indein main git repo by adding, committing and pushing the entire submodule like an updated file. + +Further information is also available at [git-scm.com/docs/git-submodule](https://git-scm.com/docs/git-submodule) diff --git a/roles/base b/roles/base new file mode 160000 index 0000000..dcd3388 --- /dev/null +++ b/roles/base @@ -0,0 +1 @@ +Subproject commit dcd338825b32068e5147be59b07908393b26a7c0 diff --git a/roles/bat b/roles/bat new file mode 160000 index 0000000..8fe5ef7 --- /dev/null +++ b/roles/bat @@ -0,0 +1 @@ +Subproject commit 8fe5ef7651bcde31005d8e617a42e81d64616381 diff --git a/roles/dotfiles b/roles/dotfiles new file mode 160000 index 0000000..18581ea --- /dev/null +++ b/roles/dotfiles @@ -0,0 +1 @@ +Subproject commit 18581eac0d25f053d6005965618e9c180d0b5a6a diff --git a/roles/ranger b/roles/ranger new file mode 160000 index 0000000..a97cf9b --- /dev/null +++ b/roles/ranger @@ -0,0 +1 @@ +Subproject commit a97cf9b55b1eba65a5f22fc5886cf86271a7ce2b diff --git a/site.yml b/site.yml new file mode 100644 index 0000000..3b8a5ca --- /dev/null +++ b/site.yml @@ -0,0 +1,9 @@ +--- + +- name: roles for all hosts + hosts: all + roles: + - { role: base, tags: [default,packages,base]} + - { role: ranger, tags: [packages,ranger]} + - { role: bat, tags: [packages,bat], when: [ansible_os_family == 'Debian']} + - { role: dotfiles, tags: [default,dotfiles]}