diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index cc677c5..6b66bb2 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -10,6 +10,8 @@ on: jobs: molecule: runs-on: ubuntu-latest + env: + ANSIBLE_ASYNC_DIR: "/tmp/.ansible_async" strategy: fail-fast: false matrix: diff --git a/README.md b/README.md index 441280e..0a83fb1 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,6 @@ The following variables are used in the role. See also Example Playbook | `vim_installed_packages` | `["vim"]` | A list of packages to install (passed to Ansible's Package module). | | `vim_removed_packages` | `[]` | A list of packages to remove (e.g. on Ubuntu, it might be preferable to remove `vim-tiny`). | | `vim_owner` | `""` | The system user to install Vim and/or associated plugins for. | -| `vim_group` | `""` | The group of the user specificed in `vim_owner`. | -| `vim_file_mode` | `'644'` | The permissions string to set on files copied or created by the role. | -| `vim_dir_mode` | `'755'` | The permissions string to set on directories copied or created by the role. | | `vim_pack_subdirectory` | `ansible-managed` | The name of the directory to place plugins installed by this role into the default creates e.g. `~/.vim/pack/ansible-managed/start` and `~/.vim/pack/ansible-managed/opt`. | | `vim_installed_plugins` | `[]` | The list of plugins to install to `~/.vim/pack/ansible-managed/start`--see `:help packages` for details on what this means. Should contain a `repo` property, a `type` property set to either 'start' or 'opt', and (optionally) a `version` property as used by Ansible's Git module. | | `vim_removed_plugins` | `[]` | A list of plugins to remove from `~/.vim/pack/ansible-managed/{opt,start}`. Each should contain a directory property set to the directory name of the plugin, and a `type` property set to either 'start' or 'opt'. | @@ -56,7 +53,6 @@ The following variables are used in the role. See also Example Playbook vim_removed_packages: - "vim-tiny" vim_owner: "molecule" - vim_group: "molecule" vim_installed_plugins: - repo: "https://github.com/altercation/vim-colors-solarized.git" type: "start" diff --git a/defaults/main.yml b/defaults/main.yml index d677097..3c228a2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,9 +5,6 @@ vim_installed_packages: - "vim" vim_removed_packages: [] vim_owner: "" -vim_group: "" -# vim_file_mode: "644" -# vim_dir_mode: "755" vim_pack_subdirectory: "ansible-managed" vim_installed_plugins: [] # - repo: "https://github.com/scrooloose/nerdtree.git" diff --git a/molecule/converge.yml b/molecule/converge.yml index a9a3fd3..70749e1 100644 --- a/molecule/converge.yml +++ b/molecule/converge.yml @@ -5,7 +5,6 @@ vim_removed_packages: - "vim-tiny" vim_owner: "molecule" - vim_group: "molecule" vim_dotfiles: - "{{ playbook_dir }}/files/dotfiles/.vimrc" tasks: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index a7f1607..582e65d 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -13,6 +13,8 @@ platforms: pre_build_image: true provisioner: name: ansible + env: + ANSIBLE_ASYNC_DIR: "/tmp/ansible_async_dir" playbooks: prepare: ../prepare.yml converge: ../converge.yml diff --git a/molecule/tests/test-config-files.yml b/molecule/tests/test-config-files.yml index f4b4844..795dc9d 100644 --- a/molecule/tests/test-config-files.yml +++ b/molecule/tests/test-config-files.yml @@ -19,14 +19,12 @@ (not rg__config_file.stat.exists and config_file.state == 'absent') fail_msg: "The config file '{{ config_file_name }}' is not {{ config_file.state }}." - - name: "Verify owner, group, and mode of '{{ config_file_name }}'." + - name: "Verify owner and group of '{{ config_file_name }}'." assert: that: - "rg__config_file.stat.pw_name == fact__vim_owner" - "rg__config_file.stat.gr_name == fact__vim_owner" - - "rg__config_file.stat.mode == config_file.mode" fail_msg: > - The owner, group, or mode of the '{{ config_file }}' file was + The owner or group of the '{{ config_file }}' file was incorrect. Found {{ rg__config_file.stat.pw_name }} (owner), - {{ rg__config_file.stat.gr_name }} (group), and - {{ rg__config_file.stat.mode }} (mode). + {{ rg__config_file.stat.gr_name }} (group). diff --git a/molecule/tests/test-directories.yml b/molecule/tests/test-directories.yml index d15d053..282390b 100644 --- a/molecule/tests/test-directories.yml +++ b/molecule/tests/test-directories.yml @@ -29,10 +29,8 @@ that: - "rg__dir_path.stat.pw_name == fact__vim_owner" - "rg__dir_path.stat.gr_name == fact__vim_owner" - - "rg__dir_path.stat.mode == dir.mode" fail_msg: > - The owner, group, or mode of the '{{ dir_name }}' {{ dir.type }} was - incorrect. Found {{ rg__dir_path.stat.pw_name }} (owner), - {{ rg__dir_path.stat.gr_name }} (group), and - {{ rg__dir_path.stat.mode }} (mode). + The owner or group of the '{{ dir_name }}' {{ dir.type }} was + incorrect. Found owner '{{ rg__dir_path.stat.pw_name }}' ({{ fact__vim_owner }}), + group '{{ rg__dir_path.stat.gr_name }}' ({{ fact__vim_owner }}). when: "rg__dir_path.stat.exists and dir.state == 'present'" diff --git a/molecule/tests/test-helptags.yml b/molecule/tests/test-helptags.yml index c5900f8..98c7dec 100644 --- a/molecule/tests/test-helptags.yml +++ b/molecule/tests/test-helptags.yml @@ -18,14 +18,12 @@ that: "rg__plugin_tags.stat.exists" fail_msg: "No helptags file was found for the '{{ plugin_name }}' plugin." - - name: "Verify owner, group, and mode of '{{ plugin_name }}' plugin helptags file." + - name: "Verify owner and group of '{{ plugin_name }}' plugin helptags file." assert: that: - "rg__plugin_tags.stat.pw_name == fact__vim_owner" - "rg__plugin_tags.stat.gr_name == fact__vim_owner" - - "rg__plugin_tags.stat.mode == '0664'" fail_msg: > - The owner, group, or mode of the '{{ plugin_name }}' plugin helptags - file was incorrect. Found {{ rg__plugin_tags.stat.pw_name }} (owner), - {{ rg__plugin_tags.stat.gr_name }} (group), and - {{ rg__plugin_tags.stat.mode }} (mode). + The owner or group of the '{{ plugin_name }}' plugin helptags + file was incorrect. Found owner '{{ rg__plugin_tags.stat.pw_name }}' ({{ fact__vim_owner }}), + and group '{{ rg__plugin_tags.stat.gr_name }}' ({{ fact__vim_owner }}). diff --git a/molecule/verify.yml b/molecule/verify.yml index a15f1e9..abb9082 100644 --- a/molecule/verify.yml +++ b/molecule/verify.yml @@ -23,38 +23,30 @@ fact__vim_config_files: - path: "{{ fact__vim_home_directory }}/.vimrc" state: present - mode: "0644" fact__vim_directories: - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed" state: present type: "directory" - mode: "0755" - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/start" state: present type: "directory" - mode: "0755" - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/opt" state: present type: "directory" - mode: "0755" fact__vim_plugins: # Installed plugins. - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/opt/vdebug" state: present type: "plugin" - mode: "0775" - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/start/vim-airline" state: present type: "plugin" - mode: "0775" - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/start/lightline.vim" state: present type: "plugin" - mode: "0775" - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/start/vim-colors-solarized" state: present type: "plugin" - mode: "0775" # Removed plugins. - path: "{{ fact__vim_home_directory }}/.vim/pack/ansible-managed/opt/tabular" state: absent diff --git a/tasks/copy-dotfiles.yml b/tasks/copy-dotfiles.yml index 94980a3..92df05c 100644 --- a/tasks/copy-dotfiles.yml +++ b/tasks/copy-dotfiles.yml @@ -5,9 +5,6 @@ ansible.builtin.copy: src: "{{ dotfile }}" dest: "{{ vim_user_home_directory }}/{{ dotfile | basename }}" - owner: "{{ vim_owner }}" - group: "{{ vim_group }}" - mode: "{{ vim_file_mode | default('644') }}" become: true become_user: "{{ vim_owner }}" loop: "{{ vim_dotfiles }}" diff --git a/tasks/setup.yml b/tasks/setup.yml index 8da53c2..969ebb8 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -2,7 +2,7 @@ # setup tasks for ansible-role-vim. - name: Get Vim version. - ansible.builtin.shell: "set -o pipefail && vim --version | head -n1 | awk '{ print $5 }'" + ansible.builtin.shell: "set -o pipefail && (vim --version | head -n1 | awk '{ print $5 }') || test $? -eq 141" args: executable: "/bin/bash" warn: false @@ -10,9 +10,9 @@ changed_when: false - name: Make sure it even makes sense to continue. - ansible.builtin.assert: - that: "{{ vim_version_string.stdout is version('8.0', '>=') }}" + ansible.builtin.fail: msg: "Vim does not support native package management in versions lower than 8.0." + when: "{{ vim_version_string.stdout is version('8.0', '<') }}" - name: Determine home directory. ansible.builtin.set_fact: @@ -38,9 +38,6 @@ ansible.builtin.file: path: "{{ vim_plugin_parent_directory }}/{{ vim_directory }}" state: directory - owner: "{{ vim_owner }}" - group: "{{ vim_group }}" - mode: "{{ vim_dir_mode | default('755') }}" become: true become_user: "{{ vim_owner }}" loop: