diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 51ba466..fab5174 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ +--- # These are supported funding model platforms github: [do1jlr] diff --git a/.github/workflows/ansible-archlinux-latest.yml b/.github/workflows/ansible-archlinux-latest.yml index 9d651a3..e823f0c 100644 --- a/.github/workflows/ansible-archlinux-latest.yml +++ b/.github/workflows/ansible-archlinux-latest.yml @@ -1,5 +1,7 @@ +--- name: Ansible check archlinux:latest +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with archlinux:latest - uses: roles-ansible/check-ansible-archlinux-latest-action@master - with: - targets: "./" + - name: ansible check with archlinux:latest + uses: roles-ansible/check-ansible-archlinux-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-centos-latest.yml b/.github/workflows/ansible-centos-latest.yml new file mode 100644 index 0000000..94eb54b --- /dev/null +++ b/.github/workflows/ansible-centos-latest.yml @@ -0,0 +1,18 @@ +--- +name: Ansible check centos:latest + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: ansible check with ubuntu:latest + uses: roles-ansible/check-ansible-centos-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-buster.yml b/.github/workflows/ansible-debian-buster.yml index a7650ad..d76b02c 100644 --- a/.github/workflows/ansible-debian-buster.yml +++ b/.github/workflows/ansible-debian-buster.yml @@ -1,5 +1,7 @@ +--- name: Ansible check debian:buster +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with debian:buster - uses: roles-ansible/check-ansible-debian-buster-action@master - with: - targets: "./" + - name: ansible check with debian:buster + uses: roles-ansible/check-ansible-debian-buster-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-latest.yml b/.github/workflows/ansible-debian-latest.yml index d0ad4ca..f7eb5b6 100644 --- a/.github/workflows/ansible-debian-latest.yml +++ b/.github/workflows/ansible-debian-latest.yml @@ -1,5 +1,7 @@ +--- name: Ansible check debian:latest +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with debian:latest - uses: roles-ansible/check-ansible-debian-latest-action@master - with: - targets: "./" + - name: ansible check with debian:latest + uses: roles-ansible/check-ansible-debian-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-sid.yml b/.github/workflows/ansible-debian-sid.yml index 72fe3a8..2e3215a 100644 --- a/.github/workflows/ansible-debian-sid.yml +++ b/.github/workflows/ansible-debian-sid.yml @@ -1,5 +1,7 @@ +--- name: Ansible check debian:sid +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with debian:sid - uses: roles-ansible/check-ansible-debian-sid-action@master - with: - targets: "./" + - name: ansible check with debian:sid + uses: roles-ansible/check-ansible-debian-sid-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-stable.yml b/.github/workflows/ansible-debian-stable.yml index 97076ae..e47f773 100644 --- a/.github/workflows/ansible-debian-stable.yml +++ b/.github/workflows/ansible-debian-stable.yml @@ -1,5 +1,7 @@ +--- name: Ansible check debian:stable +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with debian:stable - uses: roles-ansible/check-ansible-debian-stable-action@master - with: - targets: "./" + - name: ansible check with debian:stable + uses: roles-ansible/check-ansible-debian-stable-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-debian-stretch.yml b/.github/workflows/ansible-debian-stretch.yml index 19ac5fb..c947cae 100644 --- a/.github/workflows/ansible-debian-stretch.yml +++ b/.github/workflows/ansible-debian-stretch.yml @@ -1,5 +1,7 @@ +--- name: Ansible check debian:stretch +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with debian:stretch - uses: roles-ansible/check-ansible-debian-stretch-action@master - with: - targets: "./" + - name: ansible check with debian:stretch + uses: roles-ansible/check-ansible-debian-stretch-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-fedora-31.yml b/.github/workflows/ansible-fedora-31.yml index 6bbe44d..08502fe 100644 --- a/.github/workflows/ansible-fedora-31.yml +++ b/.github/workflows/ansible-fedora-31.yml @@ -1,5 +1,7 @@ +--- name: Ansible check fedora:31 +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with fedora:31 - uses: roles-ansible/check-ansible-fedora-31-action@master - with: - targets: "./" + - name: ansible check with fedora:31 + uses: roles-ansible/check-ansible-fedora-31-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-fedora-32.yml b/.github/workflows/ansible-fedora-32.yml index 70fc147..e362dd4 100644 --- a/.github/workflows/ansible-fedora-32.yml +++ b/.github/workflows/ansible-fedora-32.yml @@ -1,5 +1,7 @@ +--- name: Ansible check fedora:32 +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with fedora:32 - uses: roles-ansible/check-ansible-fedora-32-action@master - with: - targets: "./" + - name: ansible check with fedora:32 + uses: roles-ansible/check-ansible-fedora-32-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-fedora-33.yml b/.github/workflows/ansible-fedora-33.yml index 6032811..70c52ad 100644 --- a/.github/workflows/ansible-fedora-33.yml +++ b/.github/workflows/ansible-fedora-33.yml @@ -1,5 +1,7 @@ +--- name: Ansible check fedora:33 +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with fedora:33 - uses: roles-ansible/check-ansible-fedora-33-action@master - with: - targets: "./" + - name: ansible check with fedora:33 + uses: roles-ansible/check-ansible-fedora-33-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-fedora-latest.yml b/.github/workflows/ansible-fedora-latest.yml index 8b14097..7cfbdf7 100644 --- a/.github/workflows/ansible-fedora-latest.yml +++ b/.github/workflows/ansible-fedora-latest.yml @@ -1,5 +1,7 @@ +--- name: Ansible check fedora:latest +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with fedora:latest - uses: roles-ansible/check-ansible-fedora-latest-action@master - with: - targets: "./" \ No newline at end of file + - name: ansible check with fedora:latest + uses: roles-ansible/check-ansible-fedora-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 712c76f..7973217 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -1,6 +1,14 @@ +--- name: Ansible Lint check -on: [push, pull_request] +# yamllint disable-line rule:truthy +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '42 6 * */1 *' jobs: build: @@ -8,13 +16,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - 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] + - 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/ansible-ubuntu-bionic.yml b/.github/workflows/ansible-ubuntu-bionic.yml index aea24a2..0f9edd8 100644 --- a/.github/workflows/ansible-ubuntu-bionic.yml +++ b/.github/workflows/ansible-ubuntu-bionic.yml @@ -1,5 +1,7 @@ +--- name: Ansible check ubuntu:bionic +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with ubuntu:bionic - uses: roles-ansible/check-ansible-ubuntu-bionic-action@master - with: - targets: "./" + - name: ansible check with ubuntu:bionic + uses: roles-ansible/check-ansible-ubuntu-bionic-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-ubuntu-eoan.yml b/.github/workflows/ansible-ubuntu-eoan.yml deleted file mode 100644 index 30b5779..0000000 --- a/.github/workflows/ansible-ubuntu-eoan.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Ansible check ubuntu:eoan - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:eoan - uses: roles-ansible/check-ansible-ubuntu-eoan-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-ubuntu-latest.yml b/.github/workflows/ansible-ubuntu-latest.yml index 2e34685..b9544a5 100644 --- a/.github/workflows/ansible-ubuntu-latest.yml +++ b/.github/workflows/ansible-ubuntu-latest.yml @@ -1,5 +1,7 @@ +--- name: Ansible check ubuntu:latest +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with ubuntu:latest - uses: roles-ansible/check-ansible-ubuntu-latest-action@master - with: - targets: "./" + - name: ansible check with ubuntu:latest + uses: roles-ansible/check-ansible-ubuntu-latest-action@master + with: + targets: "./" diff --git a/.github/workflows/ansible-ubuntu-trusty.yml b/.github/workflows/ansible-ubuntu-trusty.yml index a18c397..6cde8b8 100644 --- a/.github/workflows/ansible-ubuntu-trusty.yml +++ b/.github/workflows/ansible-ubuntu-trusty.yml @@ -1,5 +1,7 @@ +--- name: Ansible check ubuntu:trusty +# yamllint disable-line rule:truthy on: [push, pull_request] jobs: @@ -8,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: ansible check with ubuntu:trusty - uses: roles-ansible/check-ansible-ubuntu-trusty-action@master - with: - targets: "./" + - name: ansible check with ubuntu:trusty + uses: roles-ansible/check-ansible-ubuntu-trusty-action@master + with: + targets: "./" 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/.travis.yml b/.travis.yml deleted file mode 100644 index 51d5ef7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# OS Details -os: linux -language: python -python: '3.8' - -cache: - pip: true - -# Install ansible and ansible-lint -install: - - pip install ansible - - pip install ansible-lint - -# testing galaxy install and ansible lint -# more advanced testing is currently handled with -# github actions. The gh-actions for our test are there: -# https://github.com/roles-ansible and are tagged -# with 'github-actions' --> https://github.com/search?q=topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories -script: - - ansible-galaxy install do1jlr.ranger - - ansible-lint . - - echo -e "\n\n\n\n\nWe use github actions for more detailed tests.\n\nMore details about that in our github repo at:\nhttps://github.com/chaos-bodensee/role-weechat/actions\n\n\n\n\n\n" - -notifications: - email: - on_success: never - on_failure: always - webhooks: https://galaxy.ansible.com/api/v1/notifications/ 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/handlers/main.yml b/handlers/main.yml index 847712f..46b55cb 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: systemctl restart weechat.service become: true - systemd: + ansible.builtin.systemd: state: restarted name: weechat.service - daemon_reload: yes + daemon_reload: true diff --git a/meta/main.yml b/meta/main.yml index de64335..1b7d539 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,24 +1,21 @@ --- -dependencies: [] - galaxy_info: - author: L3D - description: Install WeeChat - license: "license (MIT)" + role_name: weechat + author: do1jlr + description: Install and optional configure weechat via ansible + license: "MIT" + min_ansible_version: 2.11 + github_branch: main platforms: + - name: Archlinux + versions: all - name: Debian - versions: - - all - - name: ArchLinux - versions: - - all - - name: Fedora - versions: - - all + versions: all - name: Ubuntu - versions: - - all - min_ansible_version: 2.8 + versions: all + - name: Fedora + versions: all galaxy_tags: - - system - weechat + - irc +dependencies: [] diff --git a/tasks/configure_custom_config.yml b/tasks/configure_custom_config.yml index 7df7b8a..9cec6ab 100644 --- a/tasks/configure_custom_config.yml +++ b/tasks/configure_custom_config.yml @@ -2,7 +2,7 @@ - name: create ssh key pair (if needed) become_user: "{{ weechat.user }}" become: true - openssh_keypair: + community.cryptop.openssh_keypair: path: "{{ weechat.home_directory }}/.ssh/id_ed25519" type: ed25519 owner: "{{ weechat.user }}" @@ -10,7 +10,7 @@ when: weechat.custom_config.gen_ssh_key_pair | bool - name: print ssh public key to user - pause: + ansible.builtin.pause: prompt: | We generated a new ssh key pair for you. Please use the following public key as deployment key @@ -38,22 +38,22 @@ become: true block: - name: try to download/update git repo - git: + ansible.builtin.git: repo: "{{ weechat.custom_config.private_repo }}" dest: "{{ weechat.home_directory }}/.weechat" version: master - accept_hostkey: yes - update: yes + accept_hostkey: true + update: true rescue: - name: wait until you fixed remote git issues pause: prompt: "Please fix the issue with your git repository and try again" - name: try to download/update git repo again - git: + ansible.builtin.git: repo: "{{ weechat.custom_config.private_repo }}" dest: "{{ weechat.home_directory }}/.weechat" version: master - accept_hostkey: yes - update: yes + accept_hostkey: true + update: true when: not weechat.custom_config.private_repo | bool diff --git a/tasks/install-archlinux.yml b/tasks/install-archlinux.yml index bd24b77..41a6dbe 100644 --- a/tasks/install-archlinux.yml +++ b/tasks/install-archlinux.yml @@ -1,6 +1,7 @@ --- - name: install weechat if available - package: + become: true + ansible.builtin.package: name: - weechat state: present diff --git a/tasks/install-debian.yml b/tasks/install-debian.yml index 17cbb41..dadbf9e 100644 --- a/tasks/install-debian.yml +++ b/tasks/install-debian.yml @@ -1,34 +1,34 @@ --- - name: install apt-transport-https become: true - apt: + ansible.builtin.apt: name: apt-transport-https state: present - name: Add weechat repository gpg-key become: true - apt_key: + ansible.builtin.apt_key: keyserver: 'keys.openpgp.org' id: "{{ weechat.gpg_id }}" state: present - name: add weechat repo become: true - apt_repository: + ansible.builtin.apt_repository: repo: "deb {{ weechat__debian_weechat_repo }}" state: present update_cache: true - name: add weechat repo-src become: true - apt_repository: + ansible.builtin.apt_repository: repo: "deb-src {{ weechat__debian_weechat_repo }}" state: present update_cache: true - name: install recomended weechat packages become: true - apt: + ansible.builtin.apt: name: - weechat-curses - weechat-plugins diff --git a/tasks/install-redhat.yml b/tasks/install-redhat.yml index bd24b77..41a6dbe 100644 --- a/tasks/install-redhat.yml +++ b/tasks/install-redhat.yml @@ -1,6 +1,7 @@ --- - name: install weechat if available - package: + become: true + ansible.builtin.package: name: - weechat state: present diff --git a/tasks/main.yml b/tasks/main.yml index 5000d4d..1fdd62e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,17 +3,22 @@ set_fact: weechat: "{{ _weechat | combine(weechat, recursive=True) }}" -- include_tasks: versioncheck.yml +- name: perform optinal versionscheck + ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool -- include_tasks: "install-{{ ansible_os_family|lower }}.yml" +- name: install weechat + ansible.builtin.include_tasks: "install-{{ ansible_os_family|lower }}.yml" when: weechat.install | bool -- include_tasks: configure_custom_config.yml +- name: deploy weechat configuration + ansible.builtin.include_tasks: configure_custom_config.yml when: weechat.use_custom_config | bool -- include_tasks: configure_plugins.yml +- name: install requirements for weechat plugins + ansible.builtin.include_tasks: configure_plugins.yml when: weechat.install_plugins | bool -- include_tasks: setup_autostart.yml +- name: setup weechat autostart + ansible.builtin.include_tasks: setup_autostart.yml when: weechat.autostart | bool diff --git a/tasks/setup_autostart.yml b/tasks/setup_autostart.yml index 5631aa6..dddaae1 100644 --- a/tasks/setup_autostart.yml +++ b/tasks/setup_autostart.yml @@ -1,14 +1,14 @@ --- - name: install tmux to launch weechat become: true - package: + ansible.builtin.package: name: tmux state: present when: weechat.install | bool - name: copy systemd service for weechat become: true - template: + ansible.builtin.template: src: templates/weechat.service dest: /etc/systemd/system/weechat.service owner: root @@ -18,7 +18,7 @@ - name: enable weechat.service become: true - systemd: + ansible.builtin.systemd: enabled: true state: started name: weechat.service diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index fa361f6..5128cc8 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -1,7 +1,10 @@ --- +# Copyright (c) 2021 L3D +# this file is released with the MIT license. +# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE - name: Create directory for versionscheck become: true - file: + ansible.builtin.file: path: '/etc/.ansible-version' state: directory mode: 0755 @@ -9,37 +12,32 @@ - 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 -- name: check if '/etc/ansible-version/' is empty - find: - paths: '/etc/ansible-version/' - register: filesFound - - 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' diff --git a/vars/main.yml b/vars/main.yml index c86796a..0d4838d 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -9,7 +9,7 @@ weechat_plugin_languages: lua: lua # version management -playbook_version_number: 4099 # should be over ninethousand +playbook_version_number: 4199 # should be over ninethousand playbook_version_path: 'role-weechat_roles-ansible_github.com.version' # default values