From 0eaf04211ab28628d9d4799db5017bd4553f6b2f Mon Sep 17 00:00:00 2001 From: patbec <29308797+patbec@users.noreply.github.com> Date: Sun, 31 Dec 2023 13:31:08 +0100 Subject: [PATCH 1/2] Added line-break. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69d9861..017d1fc 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,6 @@ [![Molecule](https://github.com/bec-galaxy/ansible-collection-shell/actions/workflows/molecule.yml/badge.svg)](https://github.com/bec-galaxy/ansible-collection-shell/actions/workflows/molecule.yml) [![Licence](https://img.shields.io/github/license/bec-galaxy/ansible-collection-shell?label=Licence&color=informational)](https://github.com/bec-galaxy/ansible-collection-shell/blob/main/LICENSE) -A simple collection to install and set up a **shell** on Linux. The roles contain documentation with examples. \ No newline at end of file +A simple collection to install and set up a **shell** on Linux. + +The roles contain documentation with examples. \ No newline at end of file From 2aac27595c69bda771e5d4f5f05b6368430d8ebe Mon Sep 17 00:00:00 2001 From: patbec <29308797+patbec@users.noreply.github.com> Date: Thu, 9 May 2024 02:55:43 +0200 Subject: [PATCH 2/2] Switch to ansible-test and moved the examples to the wiki. --- .github/workflows/molecule.yml | 36 -- .gitignore | 21 ++ .yamllint | 32 -- LICENSE | 2 +- README.md | 4 +- changelogs/changelog.yaml | 5 + docs/example/playbook.yml | 28 -- docs/example/templates/zshrc.j2 | 37 --- galaxy.yml | 11 +- molecule/default/converge.yml | 42 --- molecule/default/molecule.yml | 24 -- molecule/default/prepare.yml | 10 - roles/zsh/README.md | 312 +----------------- roles/zsh/meta/main.yml | 2 +- tests/integration/targets/setup/aliases | 0 .../integration/targets/setup/tasks/main.yml | 7 + tests/integration/targets/zsh/aliases | 1 + .../integration/targets/zsh/defaults/main.yml | 35 ++ .../targets/zsh}/tasks/checksum.yml | 2 +- .../integration/targets/zsh/tasks/main.yml | 10 +- .../targets/zsh}/templates/test_zlogin.j2 | 0 .../targets/zsh}/templates/test_zlogout.j2 | 0 .../targets/zsh}/templates/test_zprofile.j2 | 0 .../targets/zsh}/templates/test_zshenv.j2 | 0 .../targets/zsh}/templates/test_zshrc.j2 | 0 25 files changed, 86 insertions(+), 535 deletions(-) delete mode 100644 .github/workflows/molecule.yml create mode 100644 .gitignore delete mode 100644 .yamllint delete mode 100644 docs/example/playbook.yml delete mode 100644 docs/example/templates/zshrc.j2 delete mode 100644 molecule/default/converge.yml delete mode 100644 molecule/default/molecule.yml delete mode 100644 molecule/default/prepare.yml create mode 100644 tests/integration/targets/setup/aliases create mode 100644 tests/integration/targets/setup/tasks/main.yml create mode 100644 tests/integration/targets/zsh/aliases create mode 100644 tests/integration/targets/zsh/defaults/main.yml rename {molecule/default => tests/integration/targets/zsh}/tasks/checksum.yml (88%) rename molecule/default/verify.yml => tests/integration/targets/zsh/tasks/main.yml (94%) rename {molecule/default => tests/integration/targets/zsh}/templates/test_zlogin.j2 (100%) rename {molecule/default => tests/integration/targets/zsh}/templates/test_zlogout.j2 (100%) rename {molecule/default => tests/integration/targets/zsh}/templates/test_zprofile.j2 (100%) rename {molecule/default => tests/integration/targets/zsh}/templates/test_zshenv.j2 (100%) rename {molecule/default => tests/integration/targets/zsh}/templates/test_zshrc.j2 (100%) diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml deleted file mode 100644 index 1d87b6b..0000000 --- a/.github/workflows/molecule.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Molecule - -"on": - pull_request: - -env: - PY_COLORS: "1" - ANSIBLE_FORCE_COLOR: "1" -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Checkout the codebase - uses: actions/checkout@v3 - - - name: Setup Lint - uses: bec-galaxy/setup-lint@v1 - - - name: Run Lint tests - run: ansible-lint - - molecule: - name: Molecule - runs-on: ubuntu-latest - needs: lint - steps: - - name: Checkout the codebase - uses: actions/checkout@v3 - - - name: Setup Molecule - uses: bec-galaxy/setup-molecule@v1 - - - name: Run Molecule tests - run: molecule test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c383ef1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Changelog cache files +changelogs/.plugin-cache.yaml + +# ansible-test ignores +tests/integration/inventory* +tests/integration/targets/domain_controller/.vagrant +tests/integration/targets/membership/.vagrant +tests/output/ \ No newline at end of file diff --git a/.yamllint b/.yamllint deleted file mode 100644 index 6ac0986..0000000 --- a/.yamllint +++ /dev/null @@ -1,32 +0,0 @@ ---- -rules: - anchors: enable - braces: enable - brackets: enable - colons: enable - commas: enable - comments: - level: warning - comments-indentation: - level: warning - document-end: disable - document-start: - level: warning - empty-lines: enable - empty-values: disable - float-values: disable - hyphens: enable - indentation: enable - key-duplicates: enable - key-ordering: disable - line-length: - max: 120 - allow-non-breakable-words: true - allow-non-breakable-inline-mappings: false - new-line-at-end-of-file: enable - new-lines: enable - octal-values: disable - quoted-strings: disable - trailing-spaces: enable - truthy: - level: warning diff --git a/LICENSE b/LICENSE index 6491d81..72aa6c2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Patrick Becker +Copyright (c) 2024 Patrick Becker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 017d1fc..d10b3eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Shell Collection for Ansible +# Ansible Collection: bec.shell -[![Molecule](https://github.com/bec-galaxy/ansible-collection-shell/actions/workflows/molecule.yml/badge.svg)](https://github.com/bec-galaxy/ansible-collection-shell/actions/workflows/molecule.yml) [![Licence](https://img.shields.io/github/license/bec-galaxy/ansible-collection-shell?label=Licence&color=informational)](https://github.com/bec-galaxy/ansible-collection-shell/blob/main/LICENSE) +[![Licence](https://img.shields.io/github/license/bec-galaxy/ansible-collection-shell?label=Licence&color=informational)](https://github.com/bec-galaxy/ansible-collection-shell/blob/main/LICENSE) A simple collection to install and set up a **shell** on Linux. diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 250e150..de2fcc5 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -47,3 +47,8 @@ releases: minor_changes: - Documentation and examples updated. release_date: "2023-12-31" + 1.1.4: + changes: + minor_changes: + - Documentation and test framework updated. + release_date: "2024-05-09" diff --git a/docs/example/playbook.yml b/docs/example/playbook.yml deleted file mode 100644 index a31d97b..0000000 --- a/docs/example/playbook.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: Zsh - hosts: localhost - connection: local - vars: - zsh_config_backup: false - zsh_config_overwrite: false # Existing config files are preserved. - - zsh_users: - - "root" - - "{{ ansible_user | default(ansible_env.USER) }}" - - zsh_users_config: - - template: "zshrc.j2" - filename: ".zshrc" - - zsh_dependencies: - - exa - - zsh-autosuggestions - - zsh-syntax-highlighting - - zsh_additional_lines: "" - roles: - - bec.shell.zsh - tasks: - - name: "Output message" - ansible.builtin.debug: - msg: "ZSH was installed." diff --git a/docs/example/templates/zshrc.j2 b/docs/example/templates/zshrc.j2 deleted file mode 100644 index 07b92f5..0000000 --- a/docs/example/templates/zshrc.j2 +++ /dev/null @@ -1,37 +0,0 @@ -autoload colors && colors - -{% raw %} -PROMPT="%{%F{40}%}%n@%m" -PROMPT+="%{$fg[cyan]%} %c %(?:%{$fg[cyan]%}%# :%{$fg[red]%}%# )%{$reset_color%}" -{% endraw %} - -source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh -source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -alias ls='exa --group-directories-first' -alias ll='exa --group-directories-first -a -l -b -g -F -G' -alias lx='exa --group-directories-first -a -l -b -g -h -H -i -m -S --time-style=long-iso' - -HISTFILE="$HOME/.zsh_history" -HISTSIZE=50000 -SAVEHIST=50000 - -setopt INC_APPEND_HISTORY -setopt AUTOCD - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/.local/bin" ] ; then - PATH="$HOME/.local/bin:$PATH" -fi - -{% if zsh_additional_lines is defined and zsh_additional_lines | length %} -# -# Host specific additions -# -{{ zsh_additional_lines }} -{% endif %} \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index decb23d..abd1f7b 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -2,10 +2,10 @@ namespace: bec name: shell -version: 1.1.3 +version: 1.1.4 readme: README.md authors: - - Patrick Becker + - Patrick Becker description: A simple collection to install and set up a shell on Linux. @@ -28,11 +28,10 @@ tags: dependencies: {} -repository: https://github.com/bec-galaxy/ansible-collection-shell -documentation: https://github.com/bec-galaxy/ansible-collection-shell +repository: https://github.com/bec-galaxy/bec.shell +documentation: https://github.com/bec-galaxy/bec.shell homepage: https://github.com/bec-galaxy -issues: https://github.com/bec-galaxy/ansible-collection-shell/issues +issues: https://github.com/bec-galaxy/bec.shell/issues build_ignore: - - "molecule" - "*.tar.gz" diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index 80fdad3..0000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: Converge - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - "{{ ansible_user }}" - - "test" - - zsh_users_config: - - template: "test_zshrc.j2" - filename: ".zshrc" - - template: "test_zshenv.j2" - filename: ".zshenv" - - template: "test_zprofile.j2" - filename: ".zprofile" - - template: "test_zlogin.j2" - filename: ".zlogin" - - template: "test_zlogout.j2" - filename: ".zlogout" - - zsh_system_config: - - template: "test_zshrc.j2" - filename: "zshrc" - - template: "test_zshenv.j2" - filename: "zshenv" - - template: "test_zprofile.j2" - filename: "zprofile" - - template: "test_zlogin.j2" - filename: "zlogin" - - template: "test_zlogout.j2" - filename: "zlogout" - - zsh_dependencies: - - zsh-autosuggestions - - zsh-syntax-highlighting - tasks: - - name: "Include role" - ansible.builtin.include_role: - name: "bec.shell.zsh" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index f07e317..0000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: docker -platforms: - - name: ubuntu-23.04 - image: ubuntu:23.04 - - name: ubuntu-22.04 - image: ubuntu:22.04 - - name: ubuntu-20.04 - image: ubuntu:20.04 - - name: debian-12 - image: debian:12 - - name: debian-11 - image: debian:11 -provisioner: - name: ansible - inventory: - group_vars: - all: - ansible_user: root -scenario: - name: default diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml deleted file mode 100644 index c07d727..0000000 --- a/molecule/default/prepare.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Prepare - hosts: all - tasks: - - name: Ensure that the additional test user exists - ansible.builtin.user: - name: "test" - state: "present" - comment: "Non administrator account for testing." - become: true diff --git a/roles/zsh/README.md b/roles/zsh/README.md index 6f796b9..a3ed825 100644 --- a/roles/zsh/README.md +++ b/roles/zsh/README.md @@ -26,8 +26,6 @@ Default variables in this playbook. | zsh_global | Target for global zsh configuration files. | `/etc/` | | zsh_executable | Path to the executable. | `/usr/bin/zsh` | -> **Molecule:** Unit test fails if a symbolic link like `/bin/zsh` is specified for `zsh_executable`. - The `zsh_users_config` property is a dictionary: ```yaml @@ -78,312 +76,4 @@ zsh_system_config: The target path is the `/etc/` directory, this can be changed in the variable `zsh_global`. -## Examples - -Here are a few examples of how this role can be used. - - 1. [Basic](#basic)
Install zsh and set it as default shell for the ansible user. - 2. [Multiple users](#multiple-users)
Install zsh and set it as default shell for a list of specified users. - 3. [User defined config file](#user-defined-config-file)
Distribute a custom `.zshrc` file for a list of users. - 4. [Custom dependencies](#custom-dependencies)
Distribute a custom `.zshrc` file with a dependency. - 5. [Extra functions](#extra-functions)
Distribute a custom `.zshrc` file with `autosuggestions` and `syntax-highlighting` functions. - 6. [Complete](#complete)
Full example of a zsh shell with a [screenshot](#preview). - -### Basic - -Install zsh and set it as default shell for the [ansible_user](https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#connection-variables). - -* Install the zsh package. -* Set zsh as default shell for the `ansible_user`. - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH has been installed and set as default for the user {{ ansible_user }}." -``` - -### Multiple users - -Install zsh and set it as default shell for a list of specified users. - -* Install the zsh package. -* Set zsh as default shell for the specified users. - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - lorem - - ipsum - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH was installed and set as default for 2 users." -``` - -### User defined config file - -Distribute a custom `.zshrc` file for a list of users. - -* Install the zsh package. -* Set zsh as default shell for the specified users. -* Distribute a custom `.zshrc` for each user. - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - lorem - - ipsum - - zsh_users_config: - - template: "zshrc.j2" - filename: ".zshrc" - - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH was installed and a custom file was distributed." -``` - -`zshrc.j2` file in your **templates folder**: - -```jinja -{% if zsh_config_overwrite is true %} -# -# {{ ansible_managed }} -# -{% endif %} - -# Add your content here. - -``` - -### Custom dependencies - -Distribute a custom `.zshrc` file with a dependency. - -* Install the zsh package. -* Set zsh as default shell for the specified users. -* Distribute a custom `.zshrc` for each user. -* Install a dependency. - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - lorem - - ipsum - - zsh_users_config: - - template: "zshrc.j2" - filename: ".zshrc" - - zsh_dependencies: - - exa - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH has been installed and exa is used to list files." -``` - -`zshrc.j2` file in your **templates folder**: - -```jinja -{% if zsh_config_overwrite is true %} -# -# {{ ansible_managed }} -# -{% endif %} - -alias ls='exa --group-directories-first' -alias ll='exa --group-directories-first -a -l -b -g -F -G' -alias lx='exa --group-directories-first -a -l -b -g -h -H -i -m -S --time-style=long-iso' -``` - -> [exa](https://the.exa.website/) is an improved file lister with more features and better defaults. It uses colours to distinguish file types and metadata. - -### Extra functions - -Distribute a custom `.zshrc` file with [autosuggestions](https://github.com/zsh-users/zsh-autosuggestions#zsh-autosuggestions) and [syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting#zsh-syntax-highlighting-) functions. - -* Install the zsh package. -* Set zsh as default shell for the specified users. -* Distribute a custom `.zshrc` for each user. -* Install [autosuggestions](https://github.com/zsh-users/zsh-autosuggestions#zsh-autosuggestions) and [syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting#zsh-syntax-highlighting-). - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - lorem - - ipsum - - zsh_users_config: - - template: "zshrc.j2" - filename: ".zshrc" - - zsh_dependencies: - - zsh-autosuggestions - - zsh-syntax-highlighting - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH was installed and additional functions were enabled." -``` - -`zshrc.j2` file in your **templates folder**: - -```jinja -{% if zsh_config_overwrite is true %} -# -# {{ ansible_managed }} -# -{% endif %} - -autoload colors && colors - -source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh -source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -``` - -### Complete - -Full example of a zsh shell. - -* Install the zsh package. -* Set zsh as default shell for the specified users. -* Distribute a custom `.zshrc` for each user. -* Install [autosuggestions](https://github.com/zsh-users/zsh-autosuggestions#zsh-autosuggestions), [syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting#zsh-syntax-highlighting-) and [exa](https://github.com/ogham/exa). -* Set `history`, `color` and `cd` settings. - -`main.yml` file in your **project folder**: - -```yaml -- name: zsh - hosts: all - vars: - zsh_config_backup: false - zsh_config_overwrite: true - - zsh_users: - - lorem - - ipsum - - zsh_users_config: - - template: "zshrc.j2" - filename: ".zshrc" - - zsh_dependencies: - - exa - - zsh-autosuggestions - - zsh-syntax-highlighting - - zsh_additional_lines: "" - roles: - - bec.shell.zsh - tasks: - - ansible.builtin.debug: - msg: "ZSH was installed." -``` - -`zshrc.j2` file in your **templates folder**: - -```jinja -{% if zsh_config_overwrite is true %} -# -# {{ ansible_managed }} -# -{% endif %} - -autoload colors && colors - -{% raw %} -PROMPT="%{%F{40}%}%n@%m" -PROMPT+="%{$fg[cyan]%} %c %(?:%{$fg[cyan]%}%# :%{$fg[red]%}%# )%{$reset_color%}" -{% endraw %} - -source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh -source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -alias ls='exa --group-directories-first' -alias ll='exa --group-directories-first -a -l -b -g -F -G' -alias lx='exa --group-directories-first -a -l -b -g -h -H -i -m -S --time-style=long-iso' - -HISTFILE="$HOME/.zsh_history" -HISTSIZE=50000 -SAVEHIST=50000 - -setopt INC_APPEND_HISTORY -setopt AUTOCD - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/.local/bin" ] ; then - PATH="$HOME/.local/bin:$PATH" -fi - -{% if zsh_additional_lines is defined and zsh_additional_lines | length %} -# -# Host specific additions -# -{{ zsh_additional_lines }} -{% endif %} -``` - -#### Preview - -A preview of this configuration: -![zsh console](https://raw.githubusercontent.com/patbec/zsh-console-icons/master/zsh-console.svg) -You can find the used [ANSI console colors here](https://github.com/patbec/zsh-console-icons#colors). - -### Apply local - -This last example can be found in the [docs](https://github.com/bec-galaxy/ansible-collection-shell/tree/main/docs/example) folder - in slightly modified form, you can apply it with the following local command: -```shell -ansible-galaxy collection install bec.shell --force -ansible-playbook ./docs/example/playbook.yml --ask-become-pass -``` - -Note: Playbook in the docs folder does not overwrite any existing zsh configuration files. \ No newline at end of file +[Click here](https://github.com/bec-galaxy/bec.shell/wiki) to show examples. diff --git a/roles/zsh/meta/main.yml b/roles/zsh/meta/main.yml index 8ff83c6..574abb1 100644 --- a/roles/zsh/meta/main.yml +++ b/roles/zsh/meta/main.yml @@ -1,6 +1,6 @@ --- galaxy_info: - author: Patrick Becker + author: Patrick Becker description: Installs and configures zsh for one or more users on Linux. license: MIT diff --git a/tests/integration/targets/setup/aliases b/tests/integration/targets/setup/aliases new file mode 100644 index 0000000..e69de29 diff --git a/tests/integration/targets/setup/tasks/main.yml b/tests/integration/targets/setup/tasks/main.yml new file mode 100644 index 0000000..6265633 --- /dev/null +++ b/tests/integration/targets/setup/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Ensure that the additional test user exists + ansible.builtin.user: + name: "test" + state: "present" + comment: "Non administrator account for testing." + become: true diff --git a/tests/integration/targets/zsh/aliases b/tests/integration/targets/zsh/aliases new file mode 100644 index 0000000..ef36bad --- /dev/null +++ b/tests/integration/targets/zsh/aliases @@ -0,0 +1 @@ +needs/target/setup diff --git a/tests/integration/targets/zsh/defaults/main.yml b/tests/integration/targets/zsh/defaults/main.yml new file mode 100644 index 0000000..3a4c78d --- /dev/null +++ b/tests/integration/targets/zsh/defaults/main.yml @@ -0,0 +1,35 @@ +--- +zsh_config_backup: false +zsh_config_overwrite: true + +zsh_users: + - "{{ ansible_user }}" + - "test" + +zsh_users_config: + - template: "test_zshrc.j2" + filename: ".zshrc" + - template: "test_zshenv.j2" + filename: ".zshenv" + - template: "test_zprofile.j2" + filename: ".zprofile" + - template: "test_zlogin.j2" + filename: ".zlogin" + - template: "test_zlogout.j2" + filename: ".zlogout" + +zsh_system_config: + - template: "test_zshrc.j2" + filename: "zshrc" + - template: "test_zshenv.j2" + filename: "zshenv" + - template: "test_zprofile.j2" + filename: "zprofile" + - template: "test_zlogin.j2" + filename: "zlogin" + - template: "test_zlogout.j2" + filename: "zlogout" + +zsh_dependencies: + - zsh-autosuggestions + - zsh-syntax-highlighting diff --git a/molecule/default/tasks/checksum.yml b/tests/integration/targets/zsh/tasks/checksum.yml similarity index 88% rename from molecule/default/tasks/checksum.yml rename to tests/integration/targets/zsh/tasks/checksum.yml index 036c7d0..b5c500d 100644 --- a/molecule/default/tasks/checksum.yml +++ b/tests/integration/targets/zsh/tasks/checksum.yml @@ -1,6 +1,6 @@ --- # -# Included file for the molecule verify step - to compare checksums. +# Included file for the verify step - to compare checksums. # - name: Get stats of a zsh file ansible.builtin.stat: diff --git a/molecule/default/verify.yml b/tests/integration/targets/zsh/tasks/main.yml similarity index 94% rename from molecule/default/verify.yml rename to tests/integration/targets/zsh/tasks/main.yml index bb00ed9..2767d3b 100644 --- a/molecule/default/verify.yml +++ b/tests/integration/targets/zsh/tasks/main.yml @@ -1,8 +1,10 @@ --- +- name: Test + ansible.builtin.debug: + msg: Hello World + - name: Verify - hosts: all - gather_facts: false - tasks: + block: - name: Get user shell check_mode: true ansible.builtin.user: @@ -28,7 +30,7 @@ fail_msg: Failed to set zsh as default shell for a user. - name: Check file paths - ansible.builtin.include_tasks: tasks/checksum.yml + ansible.builtin.include_tasks: checksum.yml loop: - filename: /root/.zshrc checksum: 1920cfdbd67240c69a78172d912e41e47421b303 diff --git a/molecule/default/templates/test_zlogin.j2 b/tests/integration/targets/zsh/templates/test_zlogin.j2 similarity index 100% rename from molecule/default/templates/test_zlogin.j2 rename to tests/integration/targets/zsh/templates/test_zlogin.j2 diff --git a/molecule/default/templates/test_zlogout.j2 b/tests/integration/targets/zsh/templates/test_zlogout.j2 similarity index 100% rename from molecule/default/templates/test_zlogout.j2 rename to tests/integration/targets/zsh/templates/test_zlogout.j2 diff --git a/molecule/default/templates/test_zprofile.j2 b/tests/integration/targets/zsh/templates/test_zprofile.j2 similarity index 100% rename from molecule/default/templates/test_zprofile.j2 rename to tests/integration/targets/zsh/templates/test_zprofile.j2 diff --git a/molecule/default/templates/test_zshenv.j2 b/tests/integration/targets/zsh/templates/test_zshenv.j2 similarity index 100% rename from molecule/default/templates/test_zshenv.j2 rename to tests/integration/targets/zsh/templates/test_zshenv.j2 diff --git a/molecule/default/templates/test_zshrc.j2 b/tests/integration/targets/zsh/templates/test_zshrc.j2 similarity index 100% rename from molecule/default/templates/test_zshrc.j2 rename to tests/integration/targets/zsh/templates/test_zshrc.j2