From 015c3758d922cd2e06290c460bc34815088848c2 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Mon, 11 Aug 2025 00:33:28 +0200 Subject: Initial commit --- .ansible-lint | 4 ++++ .build.yml | 18 ++++++++++++++++++ .editorconfig | 11 +++++++++++ .gitattributes | 2 ++ .gitignore | 1 + .markdownlint.json | 10 ++++++++++ .yamllint | 15 +++++++++++++++ LICENSE.md | 21 +++++++++++++++++++++ README.md | 38 ++++++++++++++++++++++++++++++++++++++ ansible.cfg | 8 ++++++++ requirements.yml | 7 +++++++ site.yml | 6 ++++++ 12 files changed, 141 insertions(+) create mode 100644 .ansible-lint create mode 100644 .build.yml create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .markdownlint.json create mode 100644 .yamllint create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 ansible.cfg create mode 100644 requirements.yml create mode 100644 site.yml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..26c3c91 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,4 @@ +--- +skip_list: + - 'yaml' + - 'role-name' diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..ff5f9fd --- /dev/null +++ b/.build.yml @@ -0,0 +1,18 @@ +--- +image: alpine/edge +secrets: + - 5077f4a0-6a32-46e8-aa7c-5be8778d0524 +sources: + - git@git.sr.ht/~a14m/ansible-distro-install +environment: + GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no +tasks: + - setup: | + # This is for not having to cd into your for each task + echo 'cd ansible-distro-install' >> ~/.buildenv + - check: | + if [ "$(git rev-parse origin/main)" != "$(git rev-parse HEAD)" ]; then \ + complete-build; \ + fi + - mirror: | + git push --force --mirror git@github.com:a14m/ansible-distro-install.git diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ea82bb0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# See documentation at: http://editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..91fcf56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +host_vars/*.yml filter=git-crypt diff=git-crypt +group_vars/*.yml filter=git-crypt diff=git-crypt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..904cae8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.ansible diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..4b45e22 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,10 @@ +{ + "default": true, + "MD033": false, + "MD034": false, + "MD013": { + "code_block_line_length": 120, + "line_length": 120, + "tables": false + } +} diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..3df54a1 --- /dev/null +++ b/.yamllint @@ -0,0 +1,15 @@ +--- +extends: default + +rules: + line-length: + max: 120 + level: warning + comments: + min-spaces-from-content: 1 + comments-indentation: false + braces: + max-spaces-inside: 1 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a57826e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) + +Copyright (c) 2025- [a14m](https://sr.ht/~a14m) + +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..4b846f4 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Ansible RC Playbooks + +Ansible roles and playbooks to install different distros and configure `.rc`. + +## Prerequisite + +- [Ansible][ansible] +- [`sshpass`][sshpass] **required** for `--ask-pass` +- [`git-crypt`][git-crypt] **optional** for keeping encrypted configurations. + +[sshpass]: https://man.freebsd.org/cgi/man.cgi?query=sshpass +[ansible]: https://docs.ansible.com/ansible/latest/index.html +[git-crypt]: https://github.com/AGWA/git-crypt + +If you are using `git-crypt`, setup your key, and override the encrypted files (`host_vars/*.yml`) +with your own version. + +If you are not using `git-crypt`, delete the `.gitattributes` file and override the encrypted files +with your own version. +Ex. `rm .gitattributes && cp host_vars/ubuntuiso.local.yml.example host_vars/ubuntuiso.local.yml` + +## Boot distro live image + +## Playbook: distro-install + +- Follow the pre-install guides for desired distro in "Boot distro live image" +- Install ansible required dependencies +- Run the playbook + +```bash +ansible-galaxy install -r requirements.yml + +ansible-playbook site.yml --ask-pass +``` + +## Special Thanks to + +- [Jeff Geerling](https://www.jeffgeerling.com/), who I learned a **LOT** from his open-source work. diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..18b6f30 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,8 @@ +[defaults] +display_skipped_hosts = no +interpreter_python = auto_silent +inventory = ./inventory/ +callback_result_format = yaml + +[ssh_connection] +pipelining = yes diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..6dce4c4 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,7 @@ +--- +collections: + - name: community.general + version: ">=10.7.0,<11.0.0" + + - name: ansible.posix + version: ">=1.6.0,<2.0.0" diff --git a/site.yml b/site.yml new file mode 100644 index 0000000..1e67b3b --- /dev/null +++ b/site.yml @@ -0,0 +1,6 @@ +--- +- name: Distro Install + hosts: all + become: true + roles: + - role: partition -- cgit v1.2.3