diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1a95489..67818dd 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,4 @@ -# These are supported funding model platforms +--- github: [do1jlr] liberapay: L3D -custom: https://paypal.me/c3woc diff --git a/.github/galaxy.svg b/.github/galaxy.svg new file mode 100644 index 0000000..8ac31f6 --- /dev/null +++ b/.github/galaxy.svg @@ -0,0 +1,416 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/license.svg b/.github/license.svg new file mode 100644 index 0000000..4ab6d9a --- /dev/null +++ b/.github/license.svg @@ -0,0 +1,217 @@ + + + + + + image/svg+xml + + + + + + 3D <l3d@c3woc.de> + + + + + MIT License + + + + + + + + + + + + + + + + + + + + + + + + + + + MIT + MIT + + + license + license + + diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml new file mode 100644 index 0000000..7973217 --- /dev/null +++ b/.github/workflows/ansible-linting-check.yml @@ -0,0 +1,28 @@ +--- +name: Ansible Lint check + +# yamllint disable-line rule:truthy +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '42 6 * */1 *' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Lint Ansible Playbook + uses: ansible/ansible-lint-action@master + with: + targets: "." + # [required] + # Paths to ansible files (i.e., playbooks, tasks, handlers etc..) + args: "" + # [optional] diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml new file mode 100644 index 0000000..b5dc0ec --- /dev/null +++ b/.github/workflows/galaxy.yml @@ -0,0 +1,20 @@ +--- +name: Galaxy release + +# yamllint disable-line rule:truthy +on: + push: + branches: ['main'] + release: + types: ['created'] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: galaxy + uses: robertdebock/galaxy-action@1.1.0 + with: + galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..ddb5b89 --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,24 @@ +--- +name: 'Yamllint GitHub Actions' + +# yamllint disable-line rule:truthy +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '23 6 * */1 *' + +jobs: + yamllint: + name: 'Yamllint' + runs-on: ubuntu-latest + steps: + - name: 'Checkout' + uses: actions/checkout@master + - name: 'Yamllint' + uses: karancode/yamllint-github-action@master + with: + yamllint_file_or_dir: '.' + yamllint_config_filepath: './.yamllint' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16d3c4d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.cache diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..c8bbc93 --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +extends: default + +rules: + # 160 chars should be enough, but don't fail if a line is longer + line-length: + max: 160 + level: warning diff --git a/README.md b/README.md index 9661b82..bac0567 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ - xrandr - Ansible role +[![Ansible Galaxy](https://raw.githubusercontent.com/roles-ansible/ansible_role_xrandr_help/main/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/xrandr_help) [![MIT License](https://raw.githubusercontent.com/roles-ansible/ansible_role_xrandr_help/main/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/ansible_role_xrandr_help/blob/main/LICENSE) + + ansible_role_xrandr_help ========================== diff --git a/meta/main.yml b/meta/main.yml index 8d3d0e0..d6e898a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,11 +1,11 @@ --- galaxy_info: - author: L3D - description: Install xrandr and their graphical version (arandr) to control your monitors. - license: license (MIT) - min_ansible_version: 2.3 + author: do1jlr role_name: xrandr_help - github_branch: master + description: Install xrandr and their graphical version (arandr) to control your monitors. + license: MIT + min_ansible_version: 2.8 + github_branch: main platforms: - name: Archlinux versions: all @@ -24,7 +24,6 @@ galaxy_info: - monitor - help - hdmi - - i3wm - arch - desktop dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index 5127a67..9202be1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,27 +1,27 @@ --- - name: Include OS Specific vars - include_vars: "{{ ansible_os_family }}.yml" + ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" - name: make versionscheck - include_tasks: versioncheck.yml + ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool - name: Install xrandr become: true - package: + ansible.builtin.package: name: "{{ xrandr_package }}" state: present - name: Install arandr gui become: true - package: + ansible.builtin.package: name: "{{ graphical_xrandr_packages }}" state: present when: install_graphical_application|bool - name: Install autorandr become: true - package: + ansible.builtin.package: name: "{{ autorandr }}" state: present when: install_autorandr_application|bool diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index 9cfdbba..dca3e47 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -1,67 +1,46 @@ --- - name: Create directory for versionscheck become: true - file: + ansible.builtin.file: path: '/etc/.ansible-version' state: directory mode: 0755 when: submodules_versioncheck|bool -- name: check legacy playbook version - become: true - slurp: - src: "/etc/ansible-version/{{ playbook_version_path }}" - register: legacy_playbook_version - when: submodules_versioncheck|bool - ignore_errors: yes - changed_when: False - - name: check playbook version become: true - slurp: + ansible.builtin.slurp: src: "/etc/.ansible-version/{{ playbook_version_path }}" register: playbook_version when: submodules_versioncheck|bool - ignore_errors: yes + ignore_errors: true + failed_when: false - name: Print remote role version - debug: + ansible.builtin.debug: msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" when: submodules_versioncheck|bool - name: Print locale role version - debug: + ansible.builtin.debug: msg: "Local role version: '{{ playbook_version_number|string }}'." when: submodules_versioncheck|bool - name: Check if your version is outdated - fail: + ansible.builtin.fail: msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!" when: - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool - - legacy_playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool - -- name: delete legacy version if needed - become: true - file: - state: absent - path: "/etc/ansible-version/{{ playbook_version_path }}" - name: check if '/etc/ansible-version/' is empty - find: + ansible.builtin.find: paths: '/etc/ansible-version/' register: filesFound -- name: delete legacy version folder if needed - become: true - file: - state: absent - path: "/etc/ansible-version" - when: filesFound.matched < 0 - - name: write new version to remote disk become: true - copy: + ansible.builtin.copy: content: "{{ playbook_version_number }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}" + mode: '0644' when: submodules_versioncheck|bool diff --git a/vars/main.yml b/vars/main.yml index f5f6ff5..442b3c7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,3 @@ --- -playbook_version_number: 1024 # should be high!!! -playbook_version_path: 'role-xrandr_chaos-bodensee_github.com.version' +playbook_version_number: 1026 # should be int +playbook_version_path: 'role-xrandr_chaos-bodensee_github.com.version'