From 4354c8fa6488d5ed9a5bc4f2031b077ee2d7f6fb Mon Sep 17 00:00:00 2001 From: ilia Date: Wed, 27 Aug 2025 02:28:58 +0000 Subject: [PATCH] first commit --- ansible.cfg | 0 dev-playbook.yml | 80 +++++++++++++++++++ host_vars/bottom.yml | 7 ++ host_vars/debianDesktopVM.yml | 7 ++ host_vars/devVM.yml | 7 ++ hosts | 16 ++++ roles/base/README.md | 38 ++++++++++ roles/base/defaults/main.yml | 2 + roles/base/handlers/main.yml | 2 + roles/base/meta/main.yml | 52 +++++++++++++ roles/base/tasks/main.yml | 12 +++ roles/base/tests/inventory | 2 + roles/base/tests/test.yml | 5 ++ roles/base/vars/main.yml | 2 + roles/development/README.md | 38 ++++++++++ roles/development/defaults/main.yml | 2 + roles/development/handlers/main.yml | 2 + roles/development/meta/main.yml | 52 +++++++++++++ roles/development/tasks/main.yml | 8 ++ roles/development/tests/inventory | 2 + roles/development/tests/test.yml | 5 ++ roles/development/vars/main.yml | 2 + roles/docker/README.md | 38 ++++++++++ roles/docker/defaults/main.yml | 2 + roles/docker/handlers/main.yml | 2 + roles/docker/meta/main.yml | 52 +++++++++++++ roles/docker/tasks/main.yml | 12 +++ roles/docker/tests/inventory | 2 + roles/docker/tests/test.yml | 5 ++ roles/docker/vars/main.yml | 2 + roles/maintenance/README.md | 38 ++++++++++ roles/maintenance/defaults/main.yml | 2 + roles/maintenance/handlers/main.yml | 2 + roles/maintenance/meta/main.yml | 52 +++++++++++++ roles/maintenance/tasks/main.yml | 21 +++++ roles/maintenance/tests/inventory | 2 + roles/maintenance/tests/test.yml | 5 ++ roles/maintenance/vars/main.yml | 2 + roles/shell/README.md | 38 ++++++++++ roles/shell/defaults/main.yml | 2 + roles/shell/files/.zshrc | 114 ++++++++++++++++++++++++++++ roles/shell/handlers/main.yml | 2 + roles/shell/meta/main.yml | 52 +++++++++++++ roles/shell/tasks/main.yml | 36 +++++++++ roles/shell/tests/inventory | 2 + roles/shell/tests/test.yml | 5 ++ roles/shell/vars/main.yml | 2 + roles/ssh/README.md | 38 ++++++++++ roles/ssh/defaults/main.yml | 2 + roles/ssh/handlers/main.yml | 2 + roles/ssh/meta/main.yml | 52 +++++++++++++ roles/ssh/tasks/main.yml | 6 ++ roles/ssh/tests/inventory | 2 + roles/ssh/tests/test.yml | 5 ++ roles/ssh/vars/main.yml | 2 + roles/user/README.md | 38 ++++++++++ roles/user/defaults/main.yml | 2 + roles/user/handlers/main.yml | 2 + roles/user/meta/main.yml | 52 +++++++++++++ roles/user/tasks/main.yml | 7 ++ roles/user/tests/inventory | 2 + roles/user/tests/test.yml | 5 ++ roles/user/vars/main.yml | 2 + 63 files changed, 1054 insertions(+) create mode 100644 ansible.cfg create mode 100644 dev-playbook.yml create mode 100644 host_vars/bottom.yml create mode 100644 host_vars/debianDesktopVM.yml create mode 100644 host_vars/devVM.yml create mode 100644 hosts create mode 100644 roles/base/README.md create mode 100644 roles/base/defaults/main.yml create mode 100644 roles/base/handlers/main.yml create mode 100644 roles/base/meta/main.yml create mode 100644 roles/base/tasks/main.yml create mode 100644 roles/base/tests/inventory create mode 100644 roles/base/tests/test.yml create mode 100644 roles/base/vars/main.yml create mode 100644 roles/development/README.md create mode 100644 roles/development/defaults/main.yml create mode 100644 roles/development/handlers/main.yml create mode 100644 roles/development/meta/main.yml create mode 100644 roles/development/tasks/main.yml create mode 100644 roles/development/tests/inventory create mode 100644 roles/development/tests/test.yml create mode 100644 roles/development/vars/main.yml create mode 100644 roles/docker/README.md create mode 100644 roles/docker/defaults/main.yml create mode 100644 roles/docker/handlers/main.yml create mode 100644 roles/docker/meta/main.yml create mode 100644 roles/docker/tasks/main.yml create mode 100644 roles/docker/tests/inventory create mode 100644 roles/docker/tests/test.yml create mode 100644 roles/docker/vars/main.yml create mode 100644 roles/maintenance/README.md create mode 100644 roles/maintenance/defaults/main.yml create mode 100644 roles/maintenance/handlers/main.yml create mode 100644 roles/maintenance/meta/main.yml create mode 100644 roles/maintenance/tasks/main.yml create mode 100644 roles/maintenance/tests/inventory create mode 100644 roles/maintenance/tests/test.yml create mode 100644 roles/maintenance/vars/main.yml create mode 100644 roles/shell/README.md create mode 100644 roles/shell/defaults/main.yml create mode 100644 roles/shell/files/.zshrc create mode 100644 roles/shell/handlers/main.yml create mode 100644 roles/shell/meta/main.yml create mode 100644 roles/shell/tasks/main.yml create mode 100644 roles/shell/tests/inventory create mode 100644 roles/shell/tests/test.yml create mode 100644 roles/shell/vars/main.yml create mode 100644 roles/ssh/README.md create mode 100644 roles/ssh/defaults/main.yml create mode 100644 roles/ssh/handlers/main.yml create mode 100644 roles/ssh/meta/main.yml create mode 100644 roles/ssh/tasks/main.yml create mode 100644 roles/ssh/tests/inventory create mode 100644 roles/ssh/tests/test.yml create mode 100644 roles/ssh/vars/main.yml create mode 100644 roles/user/README.md create mode 100644 roles/user/defaults/main.yml create mode 100644 roles/user/handlers/main.yml create mode 100644 roles/user/meta/main.yml create mode 100644 roles/user/tasks/main.yml create mode 100644 roles/user/tests/inventory create mode 100644 roles/user/tests/test.yml create mode 100644 roles/user/vars/main.yml diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..e69de29 diff --git a/dev-playbook.yml b/dev-playbook.yml new file mode 100644 index 0000000..847fd3b --- /dev/null +++ b/dev-playbook.yml @@ -0,0 +1,80 @@ +- hosts: dev + become: true + + roles: + - maintenance + - base + - development + - shell + - docker + - ssh + - user + + tasks: + - name: Update apt cache + apt: + update_cache: yes + + - name: Enable 'universe' repo on Ubuntu (needed for snapd) + command: add-apt-repository universe + when: ansible_facts['os_family'] == "Debian" + changed_when: false + ignore_errors: true + + - name: Install Redshift + apt: + name: redshift + state: present + + - name: Add Brave's APT key + apt_key: + url: https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg + state: present + + - name: Add Brave repo + apt_repository: + repo: 'deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main' + filename: brave-browser + state: present + + - name: Install Brave browser + apt: + name: brave-browser + state: present + - name: Remove Mint’s nosnap.pref block + file: + path: /etc/apt/preferences.d/nosnap.pref + state: absent + + - name: Update apt cache + apt: + update_cache: yes + + - name: Install Snap daemon + apt: + name: snapd + state: present + + - name: Force Ansible to reload facts + setup: + + - name: Install Cursor + community.general.snap: + name: cursor + state: present + + - name: Install VSCode + community.general.snap: + name: code + classic: true + state: present + + - name: Install LibreOffice + apt: + name: libreoffice + state: present + + - name: Install PDF reader (Evince) + apt: + name: evince + state: present diff --git a/host_vars/bottom.yml b/host_vars/bottom.yml new file mode 100644 index 0000000..f38a32e --- /dev/null +++ b/host_vars/bottom.yml @@ -0,0 +1,7 @@ +$ANSIBLE_VAULT;1.1;AES256 +37646438353233376464643364306161636364356130316530366430306530323635616531346661 +3935613366376138313461633662353037623534353433620a613163333332346564666530653862 +31636565306234366537623763376161346139306131323366643138613730643761633335343330 +3634376334636363300a666432306663643632353233396666333336386238386438666133303432 +31356266353035303732353661343634653732626166626461333939663033346166393861396332 +6461326530623939336462346531363335383237303731303964 diff --git a/host_vars/debianDesktopVM.yml b/host_vars/debianDesktopVM.yml new file mode 100644 index 0000000..48cfbd8 --- /dev/null +++ b/host_vars/debianDesktopVM.yml @@ -0,0 +1,7 @@ +$ANSIBLE_VAULT;1.1;AES256 +65643434353032343662326530613038373164393531393865633934333838373232326265646262 +3866613232353361626333323666666563323634383064340a346434393261346461643061306563 +32323730393439663931663734326134633166333866393834353637666465313962363339323930 +6638646636366463360a633731383838656535353536366136616637393332613138313838623337 +62616462623734373932316635623030623335613939313334393632323363316635333839663964 +6235376161333834383438373164396537343438366239356134 diff --git a/host_vars/devVM.yml b/host_vars/devVM.yml new file mode 100644 index 0000000..a67c650 --- /dev/null +++ b/host_vars/devVM.yml @@ -0,0 +1,7 @@ +$ANSIBLE_VAULT;1.1;AES256 +31613237643164326433613265306534626435313661663530613134393739633734633130653439 +6265613832306138643133356333336539643636313732660a626262313139623534326137643230 +38346634623535343233336238646335666331393064616631643439353264633262326536363830 +3739663737323639300a396361346133363763356232316338646535383964653331613738616262 +31643031636334373266306266383730656161663566353532353239323130376539363433623362 +6664663838393235323664633038356533313833306432353861 diff --git a/hosts b/hosts new file mode 100644 index 0000000..305305f --- /dev/null +++ b/hosts @@ -0,0 +1,16 @@ +[gitea] +giteaVM ansible_host=10.0.10.10 + +[portainer] +portainerVM ansible_host=10.0.10.20 + +[homepage] +homepageVM ansible_host=10.0.10.30 + +[dev] +devVM ansible_host=10.0.30.105 ansible_user=ladmin +bottom ansible_host=10.0.10.156 ansible_user=beast +debianDesktopVM ansible_host=10.0.10.206 ansible_user=user + +[ansible] +ansible-controlVM ansible_host=localhost ansible_user=master diff --git a/roles/base/README.md b/roles/base/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/base/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/base/defaults/main.yml b/roles/base/defaults/main.yml new file mode 100644 index 0000000..eb0f24a --- /dev/null +++ b/roles/base/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for base diff --git a/roles/base/handlers/main.yml b/roles/base/handlers/main.yml new file mode 100644 index 0000000..2edada2 --- /dev/null +++ b/roles/base/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for base diff --git a/roles/base/meta/main.yml b/roles/base/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/base/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml new file mode 100644 index 0000000..c213865 --- /dev/null +++ b/roles/base/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: Install base packages + apt: + name: + - htop + - curl + - wget + - unzip + - xclip + state: present + update_cache: yes + diff --git a/roles/base/tests/inventory b/roles/base/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/base/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/base/tests/test.yml b/roles/base/tests/test.yml new file mode 100644 index 0000000..f1bada0 --- /dev/null +++ b/roles/base/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - base diff --git a/roles/base/vars/main.yml b/roles/base/vars/main.yml new file mode 100644 index 0000000..a8e01ef --- /dev/null +++ b/roles/base/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for base diff --git a/roles/development/README.md b/roles/development/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/development/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/development/defaults/main.yml b/roles/development/defaults/main.yml new file mode 100644 index 0000000..5a86ca1 --- /dev/null +++ b/roles/development/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for development diff --git a/roles/development/handlers/main.yml b/roles/development/handlers/main.yml new file mode 100644 index 0000000..109321f --- /dev/null +++ b/roles/development/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for development diff --git a/roles/development/meta/main.yml b/roles/development/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/development/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/development/tasks/main.yml b/roles/development/tasks/main.yml new file mode 100644 index 0000000..7d7c3d1 --- /dev/null +++ b/roles/development/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Install dev packages + apt: + name: + - git + - nodejs + state: present + diff --git a/roles/development/tests/inventory b/roles/development/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/development/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/development/tests/test.yml b/roles/development/tests/test.yml new file mode 100644 index 0000000..fc1ae60 --- /dev/null +++ b/roles/development/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - development diff --git a/roles/development/vars/main.yml b/roles/development/vars/main.yml new file mode 100644 index 0000000..4e56a97 --- /dev/null +++ b/roles/development/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for development diff --git a/roles/docker/README.md b/roles/docker/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/docker/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml new file mode 100644 index 0000000..f0327f6 --- /dev/null +++ b/roles/docker/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for docker diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml new file mode 100644 index 0000000..a2bea01 --- /dev/null +++ b/roles/docker/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for docker diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/docker/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml new file mode 100644 index 0000000..0a097bc --- /dev/null +++ b/roles/docker/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: Install Docker requirements + apt: + name: + - apt-transport-https + - ca-certificates + - curl + - gnupg + - lsb-release + state: present + update_cache: yes + diff --git a/roles/docker/tests/inventory b/roles/docker/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/docker/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/docker/tests/test.yml b/roles/docker/tests/test.yml new file mode 100644 index 0000000..7aabdb0 --- /dev/null +++ b/roles/docker/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - docker diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml new file mode 100644 index 0000000..3806b4c --- /dev/null +++ b/roles/docker/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for docker diff --git a/roles/maintenance/README.md b/roles/maintenance/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/maintenance/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/maintenance/defaults/main.yml b/roles/maintenance/defaults/main.yml new file mode 100644 index 0000000..dbeeaad --- /dev/null +++ b/roles/maintenance/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for maintenance diff --git a/roles/maintenance/handlers/main.yml b/roles/maintenance/handlers/main.yml new file mode 100644 index 0000000..5e27bfd --- /dev/null +++ b/roles/maintenance/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for maintenance diff --git a/roles/maintenance/meta/main.yml b/roles/maintenance/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/maintenance/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/maintenance/tasks/main.yml b/roles/maintenance/tasks/main.yml new file mode 100644 index 0000000..c853b41 --- /dev/null +++ b/roles/maintenance/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- name: Update apt cache + apt: + update_cache: yes + +- name: Upgrade all packages + apt: + upgrade: dist + +- name: Autoremove unused packages + apt: + autoremove: yes + +- name: Clean apt cache + apt: + autoclean: yes + +- name: Reboot if tasks changed things + reboot: + msg: "Reboot triggered by Ansible after system changes." + when: ansible_facts['pkg_mgr'] == "apt" diff --git a/roles/maintenance/tests/inventory b/roles/maintenance/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/maintenance/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/maintenance/tests/test.yml b/roles/maintenance/tests/test.yml new file mode 100644 index 0000000..1510a55 --- /dev/null +++ b/roles/maintenance/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - maintenance diff --git a/roles/maintenance/vars/main.yml b/roles/maintenance/vars/main.yml new file mode 100644 index 0000000..5026cbd --- /dev/null +++ b/roles/maintenance/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for maintenance diff --git a/roles/shell/README.md b/roles/shell/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/shell/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/shell/defaults/main.yml b/roles/shell/defaults/main.yml new file mode 100644 index 0000000..57ae107 --- /dev/null +++ b/roles/shell/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for shell diff --git a/roles/shell/files/.zshrc b/roles/shell/files/.zshrc new file mode 100644 index 0000000..0250ff7 --- /dev/null +++ b/roles/shell/files/.zshrc @@ -0,0 +1,114 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH + +# Path to your Oh My Zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time Oh My Zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="powerlevel10k/powerlevel10k" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git sudo z colored-man-pages fzf zsh-syntax-highlighting zsh-autosuggestions web-search copypath) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='nvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch $(uname -m)" + +# Set personal aliases, overriding those provided by Oh My Zsh libs, +# plugins, and themes. Aliases can be placed here, though Oh My Zsh +# users are encouraged to define aliases within a top-level file in +# the $ZSH_CUSTOM folder, with .zsh extension. Examples: +# - $ZSH_CUSTOM/aliases.zsh +# - $ZSH_CUSTOM/macos.zsh +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh diff --git a/roles/shell/handlers/main.yml b/roles/shell/handlers/main.yml new file mode 100644 index 0000000..0e8b478 --- /dev/null +++ b/roles/shell/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for shell diff --git a/roles/shell/meta/main.yml b/roles/shell/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/shell/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/shell/tasks/main.yml b/roles/shell/tasks/main.yml new file mode 100644 index 0000000..0017921 --- /dev/null +++ b/roles/shell/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- name: Install shell packages + apt: + name: + - zsh + - tmux + state: present + +- name: Set zsh as default shell for user + user: + name: "{{ ansible_user }}" + shell: /usr/bin/zsh + +- name: Install Oh My Zsh for user + become: true + become_user: "{{ ansible_user }}" + shell: sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended + args: + creates: "/home/{{ ansible_user }}/.oh-my-zsh" + +- name: Clone Powerlevel10k theme + git: + repo: https://github.com/romkatv/powerlevel10k.git + dest: "/home/{{ ansible_user }}/.oh-my-zsh/custom/themes/powerlevel10k" + depth: 1 + update: no + become: true + become_user: "{{ ansible_user }}" + +- name: Deploy .zshrc for user + copy: + src: files/.zshrc + dest: "/home/{{ ansible_user }}/.zshrc" + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + mode: '0644' diff --git a/roles/shell/tests/inventory b/roles/shell/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/shell/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/shell/tests/test.yml b/roles/shell/tests/test.yml new file mode 100644 index 0000000..16f6612 --- /dev/null +++ b/roles/shell/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - shell diff --git a/roles/shell/vars/main.yml b/roles/shell/vars/main.yml new file mode 100644 index 0000000..ce79234 --- /dev/null +++ b/roles/shell/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for shell diff --git a/roles/ssh/README.md b/roles/ssh/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/ssh/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/ssh/defaults/main.yml b/roles/ssh/defaults/main.yml new file mode 100644 index 0000000..e627c09 --- /dev/null +++ b/roles/ssh/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for ssh diff --git a/roles/ssh/handlers/main.yml b/roles/ssh/handlers/main.yml new file mode 100644 index 0000000..7e51bf6 --- /dev/null +++ b/roles/ssh/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ssh diff --git a/roles/ssh/meta/main.yml b/roles/ssh/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/ssh/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml new file mode 100644 index 0000000..fcd0dc2 --- /dev/null +++ b/roles/ssh/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: Ensure SSH server installed + apt: + name: openssh-server + state: present + diff --git a/roles/ssh/tests/inventory b/roles/ssh/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/ssh/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/ssh/tests/test.yml b/roles/ssh/tests/test.yml new file mode 100644 index 0000000..3692ead --- /dev/null +++ b/roles/ssh/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ssh diff --git a/roles/ssh/vars/main.yml b/roles/ssh/vars/main.yml new file mode 100644 index 0000000..91d7182 --- /dev/null +++ b/roles/ssh/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for ssh diff --git a/roles/user/README.md b/roles/user/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/user/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +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. + +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. + +Dependencies +------------ + +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: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/user/defaults/main.yml b/roles/user/defaults/main.yml new file mode 100644 index 0000000..d26c1f3 --- /dev/null +++ b/roles/user/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for user diff --git a/roles/user/handlers/main.yml b/roles/user/handlers/main.yml new file mode 100644 index 0000000..8a97928 --- /dev/null +++ b/roles/user/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for user diff --git a/roles/user/meta/main.yml b/roles/user/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/roles/user/meta/main.yml @@ -0,0 +1,52 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml new file mode 100644 index 0000000..5d94331 --- /dev/null +++ b/roles/user/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Ensure ladmin user exists + user: + name: "{{ ansible_user }}" + state: present + shell: /bin/bash + diff --git a/roles/user/tests/inventory b/roles/user/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/user/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/user/tests/test.yml b/roles/user/tests/test.yml new file mode 100644 index 0000000..724a2ab --- /dev/null +++ b/roles/user/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - user diff --git a/roles/user/vars/main.yml b/roles/user/vars/main.yml new file mode 100644 index 0000000..578d047 --- /dev/null +++ b/roles/user/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for user