diff --git a/.github/workflows/ansible-role-phpstorm.yml b/.github/workflows/ansible-role-phpstorm.yml new file mode 100644 index 0000000..130e647 --- /dev/null +++ b/.github/workflows/ansible-role-phpstorm.yml @@ -0,0 +1,50 @@ +--- +# This workflow requires a GALAXY_API_KEY secret present in the GitHub +# repository or organization. + +name: CI + +"on": + push: + branches: + - main + paths: + - "roles/phpstorm/**" + workflow_dispatch: + +jobs: + molecule: + runs-on: ubuntu-20.04 + name: Molecule test "phpstorm" role + strategy: + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: "Free Disk Space." + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies. + working-directory: roles/phpstorm + run: pip3 install -r requirements.txt + + - name: Install Ansible dependencies. + run: ansible-galaxy install -r requirements.yml + + - name: Install Ansible dependencies specific to role. + working-directory: roles/phpstorm + run: ansible-galaxy install -r requirements.yml + + - name: Run molecule + working-directory: roles/phpstorm + run: "molecule test" + +... diff --git a/roles/phpstorm/.ansible-lint b/roles/phpstorm/.ansible-lint new file mode 100644 index 0000000..a221a4b --- /dev/null +++ b/roles/phpstorm/.ansible-lint @@ -0,0 +1,12 @@ +--- +skip_list: + - "var-naming[no-role-prefix]" # Allow _ and __ internal vars + - run-once[task] # This check is broken + +# Exclude downloaded roles and collections from linting +exclude_paths: + - collections/** + - roles/** + - changelogs + +... diff --git a/roles/phpstorm/.gitignore b/roles/phpstorm/.gitignore new file mode 100644 index 0000000..fdaee52 --- /dev/null +++ b/roles/phpstorm/.gitignore @@ -0,0 +1,153 @@ +# Editors +.idea/ +.vscode/ + +# Credentials +**/kubeconfig.yaml +.*vault* + +# Terraform +**/.terraform/* +*.tfstate +*.tfstate.* +.terraform.lock.hcl + +# Ansible +/tests/output/ +/changelogs/.plugin-cache.yaml +output/ +.collection_root/* + +**/collections/** +!**/collections/requirements.yml +**/roles/** +!**/roles/requirements.yml +!/**/.gitkeep + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.venv +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/roles/phpstorm/.pre-commit-config.yaml b/roles/phpstorm/.pre-commit-config.yaml new file mode 100644 index 0000000..dc43d3d --- /dev/null +++ b/roles/phpstorm/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + - id: check-added-large-files + - id: check-yaml + files: .*\.(yaml|yml)$ + args: [--unsafe] + - id: check-json + - id: check-xml + - id: check-toml + - id: check-case-conflict + - id: check-merge-conflict + - id: detect-private-key + - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs + - id: check-added-large-files + + - repo: https://github.com/ansible/ansible-lint + rev: v6.17.0 + hooks: + - id: ansible-lint + files: \.(yaml|yml)$ + entry: sh -c 'python3 -m pip install -r requirements.txt; python3 -m ansiblelint -v --force-color' + +... diff --git a/roles/phpstorm/LICENSE b/roles/phpstorm/LICENSE new file mode 100644 index 0000000..5defc68 --- /dev/null +++ b/roles/phpstorm/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 diademiemi + +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/roles/phpstorm/README.md b/roles/phpstorm/README.md new file mode 100644 index 0000000..3530d7f --- /dev/null +++ b/roles/phpstorm/README.md @@ -0,0 +1,86 @@ +Ansible Role PhpStorm +========= + +[![Molecule test](https://github.com/diademiemi/ansible_collection_diademiemi.jetbrains/actions/workflows/ansible-role-phpstorm.yml/badge.svg)](https://github.com/diademiemi/ansible_collection_diademiemi.jetbrains/actions/workflows/ansible-role-phpstorm.yml) + +This is an Ansible role to install and configure phpstorm. + +Include more information about phpstorm in this section. + +Requirements +------------ +These platforms are supported: +- Ubuntu 20.04 +- Ubuntu 22.04 +- Debian 10 +- Debian 11 +- Debian 12 +- EL 8 (Tested on Rocky Linux 8) +- EL 9 (Tested on Rocky Linux 9) +- Fedora 38 +- openSUSE Leap 15.5 + + + +Role Variables +-------------- + +Variable | Default | Description +--- | --- | --- +`jetbrains_phpstorm_version` | `2023.1.4` | Version of phpstorm to install +`jetbrains_phpstorm_plugins` | `[]` | List of plugin IDs to install +`jetbrains_phpstorm_plugins_user` | `{{ ansible_user_id }}` | User to install plugins for. Defaults to the remote user +`jetbrains_phpstorm_plugins_group` | `{{ ansible_user_id }}` | Group to install plugins for. Defaults to the remote user + + +Dependencies +------------ + +- `diademiemi.jetbrains.common` role + + +Example Playbook +---------------- + +```yaml +- name: Use diademiemi.jetbrains.phpstorm role + hosts: "{{ target | default('phpstorm') }}" + roles: + - role: "diademiemi.jetbrains.phpstorm" + tags: ['diademiemi', 'phpstorm', 'setup'] ``` + +``` + +License +------- + +MIT + +Author Information +------------------ + +- diademiemi (@diademiemi) + +Role Testing +------------ + +This repository comes with Molecule that run in Podman on the supported platforms. +Install Molecule by running + +```bash +pip3 install -r requirements.txt +``` + +Run the tests with + +```bash +molecule test +``` + +These tests are automatically ran by GitHub Actions on push. If the tests are successful, the role is automatically published to Ansible Galaxy. diff --git a/roles/phpstorm/ansible_role_.code-workspace b/roles/phpstorm/ansible_role_.code-workspace new file mode 100644 index 0000000..8be0ad8 --- /dev/null +++ b/roles/phpstorm/ansible_role_.code-workspace @@ -0,0 +1,35 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "ansible.python.interpreterPath": "/bin/python3", + "files.associations": { + "**/tasks/**/*.yml": "ansible", + "**/vars/**/*.yml": "ansible", + "**/molecule/*.yml": "ansible", + "**/molecule/molecule.yml": "ansible", + "**/handlers/**/*.yml": "ansible", + "**/defaults/*.yml": "ansible", + "**/host_vars/**/*.yml": "ansible", + "**/group_vars/**/*.yml": "ansible", + "**/inventories/*.yml": "ansible", + "**/meta/*.yml": "ansible", + "**/requirements.yml": "ansible", + "**/terraform/**": "terraform", + "**/inventories/terraform/**": "ansible" + } + }, + "extensions": { + "recommendations": [ + "redhat.ansible", + "redhat.vscode-yaml", + "hashicorp.terraform", + "GitHub.copilot-nightly", + "GitLab.gitlab-workflow", + "yzhang.markdown-all-in-one" + ] + } +} diff --git a/roles/phpstorm/defaults/main.yml b/roles/phpstorm/defaults/main.yml new file mode 100644 index 0000000..c0b055b --- /dev/null +++ b/roles/phpstorm/defaults/main.yml @@ -0,0 +1,8 @@ +--- +jetbrains_phpstorm_version: "2023.3.2" + +jetbrains_phpstorm_plugins: [] +jetbrains_phpstorm_plugins_user: "{{ ansible_user_id }}" +jetbrains_phpstorm_plugins_group: "{{ ansible_user_id }}" + +... diff --git a/roles/phpstorm/files/.gitkeep b/roles/phpstorm/files/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/roles/phpstorm/handlers/main.yml b/roles/phpstorm/handlers/main.yml new file mode 100644 index 0000000..c81cf5b --- /dev/null +++ b/roles/phpstorm/handlers/main.yml @@ -0,0 +1,3 @@ +--- + +... diff --git a/roles/phpstorm/meta/main.yml b/roles/phpstorm/meta/main.yml new file mode 100644 index 0000000..e115508 --- /dev/null +++ b/roles/phpstorm/meta/main.yml @@ -0,0 +1,64 @@ +galaxy_info: + author: diademiemi + namespace: diademiemi + company: diademiemi + description: Ansible role to install and configure phpstorm + role_name: phpstorm + + # 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: MIT + + min_ansible_version: "2.11" + + # 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: "EL" + versions: + - "8" + - "9" + - name: "Fedora" + versions: + - "38" + - name: Ubuntu + versions: + - focal + - jammy + - name: Debian + versions: + - buster + - bullseye + - bookworm + - name: opensuse + versions: + - "15.5" + + 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/phpstorm/molecule/default/converge.yml b/roles/phpstorm/molecule/default/converge.yml new file mode 100644 index 0000000..0277e9d --- /dev/null +++ b/roles/phpstorm/molecule/default/converge.yml @@ -0,0 +1,54 @@ +--- +- name: Converge + hosts: all + gather_facts: true + serial: 1 + pre_tasks: + # Prevent Apt cache errors + - name: "Refresh Apt cache" + ansible.builtin.apt: + update_cache: true + when: ansible_facts["pkg_mgr"] == "apt" + changed_when: false # Breaks idempotency test + + # https://www.jeffgeerling.com/blog/2020/resolving-fedora-dnf-error-no-such-file-or-directory-varlibdnfrpmdblockpid + - name: Wait for systemd to complete initialization. # noqa command-instead-of-module + ansible.builtin.command: systemctl is-system-running + register: systemctl_status + until: > + 'running' in systemctl_status.stdout or + 'degraded' in systemctl_status.stdout + retries: 30 + delay: 2 + when: ansible_facts["service_mgr"] == 'systemd' + changed_when: false + failed_when: false + + tasks: + - name: "Include diademiemi.jetbrains.phpstorm" + ansible.builtin.include_role: + name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + + - name: Get all tar.gz files in /tmp + ansible.builtin.find: + paths: /tmp + patterns: "*.tar.gz" + recurse: false + register: tar_files + changed_when: false + # failed_when: false + when: '"molecule-idempotence-notest" in ansible_skip_tags' + + - name: Remove data after tests to free up space on GitHub Runner + become: true + ansible.builtin.file: + path: "" + state: absent + changed_when: false + # failed_when: false + when: '"molecule-idempotence-notest" in ansible_skip_tags' + loop: + - "{{ tar_files.files | map(attribute='path') | list }}" + - /opt/ + +... diff --git a/roles/phpstorm/molecule/default/host_vars/debian11.yml b/roles/phpstorm/molecule/default/host_vars/debian11.yml new file mode 100644 index 0000000..c81cf5b --- /dev/null +++ b/roles/phpstorm/molecule/default/host_vars/debian11.yml @@ -0,0 +1,3 @@ +--- + +... diff --git a/roles/phpstorm/molecule/default/host_vars/ubuntu2204.yml b/roles/phpstorm/molecule/default/host_vars/ubuntu2204.yml new file mode 100644 index 0000000..ee2686c --- /dev/null +++ b/roles/phpstorm/molecule/default/host_vars/ubuntu2204.yml @@ -0,0 +1,5 @@ +--- +jetbrains_phpstorm_plugins: + - 17718 # GitHub Copilot + +... diff --git a/roles/phpstorm/molecule/default/molecule.yml b/roles/phpstorm/molecule/default/molecule.yml new file mode 100644 index 0000000..732fa01 --- /dev/null +++ b/roles/phpstorm/molecule/default/molecule.yml @@ -0,0 +1,123 @@ +--- +dependency: + name: galaxy +driver: + name: podman +platforms: + - name: ubuntu2004 + image: docker.io/geerlingguy/docker-ubuntu2004-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/sbin/init" + - name: ubuntu2204 + image: docker.io/geerlingguy/docker-ubuntu2204-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/sbin/init" + - name: debian10 + image: docker.io/geerlingguy/docker-debian10-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/sbin/init" + - name: debian11 + image: docker.io/geerlingguy/docker-debian11-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/sbin/init" + - name: debian12 + image: docker.io/geerlingguy/docker-debian12-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/sbin/init" + - name: el8 + image: docker.io/geerlingguy/docker-rockylinux8-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/sbin/init" + - name: el9 + image: docker.io/geerlingguy/docker-rockylinux9-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/sbin/init" + - name: fedora38 + image: docker.io/geerlingguy/docker-fedora38-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/sbin/init" + - name: opensuse15 + image: docker.io/geerlingguy/docker-opensuseleap15-ansible + pre_build_image: true + systemd: true + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + cgroupns_mode: host + privileged: true + command: "/usr/lib/systemd/systemd" +provisioner: + name: ansible + env: + ANSIBLE_LOCAL_TEMP: "${HOME}/.ansible/tmp" + ANSIBLE_REMOTE_TMP: /tmp/ansible +verifier: + name: ansible + +... diff --git a/roles/phpstorm/molecule/default/verify.yml b/roles/phpstorm/molecule/default/verify.yml new file mode 100644 index 0000000..784a1f6 --- /dev/null +++ b/roles/phpstorm/molecule/default/verify.yml @@ -0,0 +1,12 @@ +--- +# This is an example playbook to execute Ansible tests. + +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Example assertion + ansible.builtin.assert: + that: true + +... diff --git a/roles/phpstorm/requirements.txt b/roles/phpstorm/requirements.txt new file mode 100644 index 0000000..13b3e09 --- /dev/null +++ b/roles/phpstorm/requirements.txt @@ -0,0 +1,8 @@ +yamllint +ansible-lint +ansible +ansible-compat +antsibull-changelog +molecule +molecule-plugins[podman] +jmespath \ No newline at end of file diff --git a/roles/phpstorm/requirements.yml b/roles/phpstorm/requirements.yml new file mode 100644 index 0000000..91f7a45 --- /dev/null +++ b/roles/phpstorm/requirements.yml @@ -0,0 +1,5 @@ +--- +collections: [] + +roles: [] +... diff --git a/roles/phpstorm/tasks/assert/default.yml b/roles/phpstorm/tasks/assert/default.yml new file mode 100644 index 0000000..1bf3ec4 --- /dev/null +++ b/roles/phpstorm/tasks/assert/default.yml @@ -0,0 +1,11 @@ +--- +- name: Ensure __role_name is defined + ansible.builtin.assert: + that: + - __role_name is defined + - __role_name is string + - __role_name | length > 0 + # Make sure I don't forget to replace the role name + # This assert failing also ensures this role is not uploaded to Ansible Galaxy + - "__role_name != ['temp', 'late'] | join('')" +... diff --git a/roles/phpstorm/tasks/main.yml b/roles/phpstorm/tasks/main.yml new file mode 100644 index 0000000..1ce2558 --- /dev/null +++ b/roles/phpstorm/tasks/main.yml @@ -0,0 +1,68 @@ +--- +# ---------------------------------------------------------------------------------------------- # +# This file is not meant to be modified, it serves as an entrypoint for other files in the role. # +# Files are named after the platform, see vars/main.yml for the order and example filenames # +# For vars, it will loop through every file it can find and include them, the most specific file # +# will be included last. This allows for more specific variables to override less specific ones # +# For assertions, all matching files will be ran in order from least to most specific # +# For tasks, only the most specific file will be ran. A post task file always.yml can be # +# created to run tasks that must be ran on every host regardless of platform in parallel. # +# A variable __role_action can be set to specify which path(s) to search for tasks. # +# ---------------------------------------------------------------------------------------------- # + +# Ensure distribution facts are gathered +- name: "Main | Ensure ansible_facts used by role" + ansible.builtin.setup: + gather_subset: min + +# Set all variables matching this platform +- name: "Main | Set platform/version specific variables" + ansible.builtin.include_vars: "{{ __role_found_vars }}" + vars: + __role_find_vars: + files: ["{{ __role_var_search }}"] + skip: true + paths: ["{{ role_path }}/vars"] + __role_found_vars: "{{ lookup('ansible.builtin.first_found', __role_find_vars) }}" + when: __role_found_vars | length > 0 # Check if any variables were found + loop: "{{ __role_file_search_order | reverse | unique }}" # reverse order to allow for more specific variables to override less specific ones + loop_control: + loop_var: __role_var_search + +# Assert variables are set correctly for this platform +- name: "Main | Assert platform/version specific variables" + ansible.builtin.include_tasks: "{{ __role_found_asserts }}" + vars: + __role_find_asserts: + files: ["{{ __role_assert_search }}"] + skip: true + paths: ["{{ role_path }}/tasks/assert"] + __role_found_asserts: "{{ lookup('ansible.builtin.first_found', __role_find_asserts) }}" + when: __role_found_asserts | length > 0 # Check if any assertions were found + loop: "{{ __role_file_search_order | unique }}" + loop_control: + loop_var: __role_assert_search + +# Run task file most specific to this platform +- name: "Main | Run platform/version specific tasks" + ansible.builtin.include_tasks: "{{ __role_found_tasks }}" + vars: + __role_find_tasks: + files: "{{ __role_file_search_order }}" + skip: true + paths: ["{{ role_path }}/tasks/{{ __role_action | default('setup') }}"] + __role_found_tasks: "{{ lookup('ansible.builtin.first_found', __role_find_tasks) }}" + when: __role_found_tasks | length > 0 # Check if any tasks were found + +# Run tasks in parallel with all hosts +- name: "Main | tasks that always run" + ansible.builtin.include_tasks: "{{ __role_found_tasks }}" + vars: + __role_find_tasks: + files: ["always.yml"] + skip: true + paths: ["{{ role_path }}/tasks/{{ __role_action | default('setup') }}"] + __role_found_tasks: "{{ lookup('ansible.builtin.first_found', __role_find_tasks) }}" + when: __role_found_tasks | length > 0 # Check if task was found + +... diff --git a/roles/phpstorm/tasks/setup/default.yml b/roles/phpstorm/tasks/setup/default.yml new file mode 100644 index 0000000..90611cc --- /dev/null +++ b/roles/phpstorm/tasks/setup/default.yml @@ -0,0 +1,19 @@ +--- +- name: Include common role + ansible.builtin.include_role: + name: diademiemi.jetbrains.common + tasks_from: main.yml + vars: + jetbrains_common_name: "{{ jetbrains_phpstorm_name }}" + jetbrains_common_stylized_name: "{{ jetbrains_phpstorm_stylized_name }}" + jetbrains_common_version: "{{ jetbrains_phpstorm_version }}" + jetbrains_common_edition: "{{ jetbrains_phpstorm_edition }}" + jetbrains_common_naming_map: "{{ jetbrains_phpstorm_naming_map }}" + jetbrains_common_url: "{{ jetbrains_phpstorm_url }}" + jetbrains_common_url_prefix: "{{ jetbrains_phpstorm_url_prefix }}" + jetbrains_common_url_download_name: "{{ jetbrains_phpstorm_url_download_name }}" + jetbrains_common_plugins: "{{ jetbrains_phpstorm_plugins }}" + jetbrains_common_plugins_user: "{{ jetbrains_phpstorm_plugins_user }}" + jetbrains_common_plugins_group: "{{ jetbrains_phpstorm_plugins_group }}" + +... diff --git a/roles/phpstorm/templates/.gitkeep b/roles/phpstorm/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/roles/phpstorm/tests/inventory b/roles/phpstorm/tests/inventory new file mode 100644 index 0000000..2302eda --- /dev/null +++ b/roles/phpstorm/tests/inventory @@ -0,0 +1 @@ +localhost ansible_connection=local diff --git a/roles/phpstorm/tests/test.yml b/roles/phpstorm/tests/test.yml new file mode 100644 index 0000000..24b5e9a --- /dev/null +++ b/roles/phpstorm/tests/test.yml @@ -0,0 +1,23 @@ +--- +- name: Run diademiemi.jetbrains.phpstorm on localhost + hosts: localhost + tasks: + - name: "Ensure temporary roles directory exists" + ansible.builtin.file: + path: "~/.ansible/roles" + state: directory + mode: '0755' + - name: "Create temporary symlink in roles directory " + ansible.builtin.file: + src: "{{ lookup('env', 'PWD') }}" + dest: "~/.ansible/roles/{{ lookup('env', 'PWD') | basename }}" + state: link + - name: "Include diademiemi.jetbrains.phpstorm" + ansible.builtin.include_role: + name: "{{ lookup('env', 'PWD') | basename }}" + - name: "Remove temporary symlink in roles directory" + ansible.builtin.file: + path: "~/.ansible/roles/{{ lookup('env', 'PWD') | basename }}" + state: absent + +... diff --git a/roles/phpstorm/vars/default.yml b/roles/phpstorm/vars/default.yml new file mode 100644 index 0000000..d58e987 --- /dev/null +++ b/roles/phpstorm/vars/default.yml @@ -0,0 +1,19 @@ +--- +jetbrains_phpstorm_name: "phpstorm" +jetbrains_phpstorm_stylized_name: "PhpStorm" + +jetbrains_phpstorm_edition: "" + +jetbrains_phpstorm_naming_map: + "": + name: "PhpStorm" + comment: "Cross-platform IDE for PHP" + code: "" + +jetbrains_phpstorm_url_prefix: "webide" +jetbrains_phpstorm_url_download_name: "{{ jetbrains_phpstorm_stylized_name }}" + +jetbrains_phpstorm_url: "https://download-cdn.jetbrains.com/{{ jetbrains_common_url_prefix }}/\ + {{ jetbrains_common_url_download_name }}-{{ jetbrains_common_version }}.tar.gz" + +... diff --git a/roles/phpstorm/vars/main.yml b/roles/phpstorm/vars/main.yml new file mode 100644 index 0000000..aa18c07 --- /dev/null +++ b/roles/phpstorm/vars/main.yml @@ -0,0 +1,22 @@ +--- +__role_name: "phpstorm" +__role_file_search_order: + - "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_release'] | lower | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_version'] }}.yml" # centos_stream_8_6.yml + - "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_version'] }}.yml" # centos_8.6.yml + - "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_release'] | lower | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_major_version'] }}.yml" # centos_stream_8.yml + - "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}_\ + {{ ansible_facts['distribution_major_version'] }}.yml" # centos_8.yml + - "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}.yml" # centos.yml + - "{{ ansible_facts['os_family'] | lower }}_\ + {{ ansible_facts['distribution_version'] }}.yml" # redhat_8.6.yml + - "{{ ansible_facts['os_family'] | lower }}_\ + {{ ansible_facts['distribution_major_version'] }}.yml" # redhat_8.yml + - "{{ ansible_facts['os_family'] | lower }}.yml" # redhat.yml + - "default.yml" # default.yml + +...