diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:31:59 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:31:59 +0200 |
| commit | f25661df2508980d84157b6d99369602c8b241b8 (patch) | |
| tree | da3d65ecb7533cf5f857271c72b32468a0cd3285 | |
| parent | f62adf7ff2d9a31dcab6e8883b206c0347f45b02 (diff) | |
Init commit
| -rw-r--r-- | .ansible-lint | 4 | ||||
| -rw-r--r-- | .build.yml | 18 | ||||
| -rw-r--r-- | .editorconfig | 11 | ||||
| -rw-r--r-- | .gitattributes | 2 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .markdownlint.json | 10 | ||||
| -rw-r--r-- | .yamllint | 15 | ||||
| -rw-r--r-- | LICENSE.md | 21 | ||||
| -rw-r--r-- | README.md | 53 | ||||
| -rw-r--r-- | ansible.cfg | 8 | ||||
| -rw-r--r-- | requirements.yml | 4 |
11 files changed, 147 insertions, 0 deletions
diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 00000000..26c3c913 --- /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 00000000..252abbeb --- /dev/null +++ b/.build.yml @@ -0,0 +1,18 @@ +--- +image: alpine/edge +secrets: + - 5077f4a0-6a32-46e8-aa7c-5be8778d0524 +sources: + - [email protected]/~a14m/ansible-distro-configure +environment: + GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no +tasks: + - setup: | + # This is for not having to cd into your <repo> for each task + echo 'cd ansible-distro-configure' >> ~/.buildenv + - check: | + if [ "$(git rev-parse origin/main)" != "$(git rev-parse HEAD)" ]; then \ + complete-build; \ + fi + - mirror: | + git push --force --mirror [email protected]:a14m/ansible-distro-configure.git diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..ea82bb0e --- /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 00000000..91fcf568 --- /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 00000000..904cae88 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.ansible diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000..4b45e226 --- /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 00000000..3df54a17 --- /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 00000000..a57826ea --- /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 00000000..747f2d24 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# 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 + +- [Arch Linux](./archlinux.md) +- [Debian Ubuntu](./ubuntu.md) + +## Playbook: distro-install + +- Optional: Clone the [`distro-configure`](https://git.sr.ht/~a14m/ansible-distro-configure) playbook +- Optional: Configure the desired `host_vars` in the `distro-configure` playbook +- Follow the pre-install guides for desired distro in "Boot distro live image" +- Install ansible required dependencies +- Configure the desired `host_vars` in this playbook +- Run the playbook + +**Example**: + +```bash +git clone https://git.sr.ht/~a14m/ansible-distro-configure /opt/distro-configure +cp /opt/distro-configure/host_vars/${DISTRO}.local.yml.example /opt/distro-configure/host_vars/${DISTRO}.local.yml + +git clone https://git.sr.ht/~a14m/ansible-distro-install /opt/distro-install +cp /opt/distro-install/host_vars/${DISTRO}iso.local.yml.example /opt/distro-install/host_vars/${DISTRO}iso.local.yml + +ansible-galaxy install -r requirements.yml +cd /opt/distro-install + +ansible-playbook site.yml --ask-pass --extra-vars '{"configure_playbook_dir":"/opt/distro-configure"}' +``` + +## 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 00000000..18b6f301 --- /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 00000000..6d1f983e --- /dev/null +++ b/requirements.yml @@ -0,0 +1,4 @@ +--- +collections: + - name: community.general + version: ">=10.7.0,<11.0.0" |
