diff --git a/.ansible-lint.yml b/.ansible-lint.yml index a4930f3..e91e711 100644 --- a/.ansible-lint.yml +++ b/.ansible-lint.yml @@ -1,3 +1,3 @@ --- exclude_paths: -- 'galaxy.roles/' + - "galaxy.roles/" diff --git a/playbook-app-homepage.yml b/playbook-app-homepage.yml index 554ca4e..efedee7 100644 --- a/playbook-app-homepage.yml +++ b/playbook-app-homepage.yml @@ -8,7 +8,7 @@ vars: app_name: "homepage" - base_dir: "/home/major/applications/{{ app_name }}/" + base_dir: "/home/{{ primary_user }}/applications/{{ app_name }}/" docker_registry_prefix: "cr.yandex/crplfk0168i4o8kd7ade" homepage_web_image: "{{ homepage_web_image | default(omit) }}" diff --git a/playbook-netdata.yml b/playbook-netdata.yml index 4c67550..fe0734d 100644 --- a/playbook-netdata.yml +++ b/playbook-netdata.yml @@ -7,12 +7,12 @@ - vars/vars.yml vars: - netdata_version: 'v2.4.0' - netdata_image: 'netdata/netdata:{{ netdata_version }}' - netdata_exposed_port: '{{ netdata_port }}' + netdata_version: "v2.4.0" + netdata_image: "netdata/netdata:{{ netdata_version }}" + netdata_exposed_port: "{{ netdata_port }}" tasks: - - name: 'Grab docker group id.' + - name: "Grab docker group id." ansible.builtin.shell: cmd: | set -o pipefail @@ -21,29 +21,29 @@ register: netdata_docker_group_output changed_when: netdata_docker_group_output.rc != 0 - - name: 'Create NetData container from {{ netdata_image }}' + - name: "Create NetData container from {{ netdata_image }}" community.docker.docker_container: name: netdata - image: '{{ netdata_image }}' - image_name_mismatch: 'recreate' - restart_policy: 'unless-stopped' + image: "{{ netdata_image }}" + image_name_mismatch: "recreate" + restart_policy: "unless-stopped" published_ports: - - '127.0.0.1:{{ netdata_exposed_port }}:19999' + - "127.0.0.1:{{ netdata_exposed_port }}:19999" volumes: - - '/:/host/root:ro,rslave' - - '/etc/group:/host/etc/group:ro' - - '/etc/localtime:/etc/localtime:ro' - - '/etc/os-release:/host/etc/os-release:ro' - - '/etc/passwd:/host/etc/passwd:ro' - - '/proc:/host/proc:ro' - - '/run/dbus:/run/dbus:ro' - - '/sys:/host/sys:ro' - - '/var/log:/host/var/log:ro' - - '/var/run/docker.sock:/var/run/docker.sock:ro' + - "/:/host/root:ro,rslave" + - "/etc/group:/host/etc/group:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/etc/os-release:/host/etc/os-release:ro" + - "/etc/passwd:/host/etc/passwd:ro" + - "/proc:/host/proc:ro" + - "/run/dbus:/run/dbus:ro" + - "/sys:/host/sys:ro" + - "/var/log:/host/var/log:ro" + - "/var/run/docker.sock:/var/run/docker.sock:ro" capabilities: - - 'SYS_PTRACE' - - 'SYS_ADMIN' + - "SYS_PTRACE" + - "SYS_ADMIN" security_opts: - - 'apparmor:unconfined' + - "apparmor:unconfined" env: - PGID: '{{ netdata_docker_group_output.stdout | default(999) }}' + PGID: "{{ netdata_docker_group_output.stdout | default(999) }}" diff --git a/roles/eget/defaults/main.yml b/roles/eget/defaults/main.yml index c0e61c0..920edb0 100644 --- a/roles/eget/defaults/main.yml +++ b/roles/eget/defaults/main.yml @@ -1,8 +1,8 @@ --- # defaults file for eget -eget_version: '1.3.4' -eget_download_url: 'https://github.com/zyedidia/eget/releases/download/v{{ eget_version }}/eget-{{ eget_version }}-linux_amd64.tar.gz' -eget_install_path: '/usr/bin/eget' +eget_version: "1.3.4" +eget_download_url: "https://github.com/zyedidia/eget/releases/download/v{{ eget_version }}/eget-{{ eget_version }}-linux_amd64.tar.gz" +eget_install_path: "/usr/bin/eget" eget_download_dest: '/tmp/{{ eget_download_url | split("/") | last }}' eget_unarchive_dest: '{{ eget_download_dest | regex_replace("(\.tar\.gz|\.zip)$", "") }}' diff --git a/roles/eget/meta/main.yml b/roles/eget/meta/main.yml index 9328fbe..7f0a2da 100644 --- a/roles/eget/meta/main.yml +++ b/roles/eget/meta/main.yml @@ -1,6 +1,7 @@ +--- galaxy_info: - author: 'Anton Vakhrushev' - description: 'Role for installation eget utility' + author: "Anton Vakhrushev" + description: "Role for installation eget utility" # If the issue tracker for your role is not on github, uncomment the # next line and provide a value @@ -13,9 +14,9 @@ galaxy_info: # - GPL-3.0-only # - Apache-2.0 # - CC-BY-4.0 - license: 'MIT' + license: "MIT" - min_ansible_version: '2.1' + min_ansible_version: "2.1" # If this a Container Enabled role, provide the minimum Ansible Container version. # min_ansible_container_version: diff --git a/roles/eget/tasks/install.yml b/roles/eget/tasks/install.yml index 4d6fdde..9f56389 100644 --- a/roles/eget/tasks/install.yml +++ b/roles/eget/tasks/install.yml @@ -1,30 +1,30 @@ --- - name: 'Download eget from url "{{ eget_download_url }}"' ansible.builtin.get_url: - url: '{{ eget_download_url }}' - dest: '{{ eget_download_dest }}' - mode: '0600' + url: "{{ eget_download_url }}" + dest: "{{ eget_download_dest }}" + mode: "0600" -- name: 'Unarchive eget' +- name: "Unarchive eget" ansible.builtin.unarchive: - src: '{{ eget_download_dest }}' - dest: '/tmp' + src: "{{ eget_download_dest }}" + dest: "/tmp" list_files: true remote_src: true -- name: 'Install eget binary' +- name: "Install eget binary" ansible.builtin.copy: src: '{{ (eget_unarchive_dest, "eget") | path_join }}' - dest: '{{ eget_install_path }}' - mode: '0755' + dest: "{{ eget_install_path }}" + mode: "0755" remote_src: true -- name: 'Remove temporary files' +- name: "Remove temporary files" ansible.builtin.file: - path: '{{ eget_download_dest }}' + path: "{{ eget_download_dest }}" state: absent -- name: 'Remove temporary directories' +- name: "Remove temporary directories" ansible.builtin.file: - path: '{{ eget_unarchive_dest }}' + path: "{{ eget_unarchive_dest }}" state: absent diff --git a/roles/eget/tasks/main.yml b/roles/eget/tasks/main.yml index 3aea7a0..a15c998 100644 --- a/roles/eget/tasks/main.yml +++ b/roles/eget/tasks/main.yml @@ -1,24 +1,24 @@ --- # tasks file for eget -- name: 'Check if eget installed' +- name: "Check if eget installed" ansible.builtin.command: - cmd: '{{ eget_install_path }} --version' + cmd: "{{ eget_install_path }} --version" register: eget_installed_output ignore_errors: true changed_when: false -- name: 'Check eget installed version' +- name: "Check eget installed version" ansible.builtin.set_fact: - eget_need_install: '{{ not (eget_installed_output.rc == 0 and eget_version in eget_installed_output.stdout) }}' + eget_need_install: "{{ not (eget_installed_output.rc == 0 and eget_version in eget_installed_output.stdout) }}" -- name: 'Assert that installation flag is defined' +- name: "Assert that installation flag is defined" ansible.builtin.assert: that: - eget_need_install is defined - eget_need_install is boolean -- name: 'Download eget and install eget' +- name: "Download eget and install eget" ansible.builtin.include_tasks: - file: 'install.yml' + file: "install.yml" when: eget_need_install diff --git a/roles/owner/tasks/main.yml b/roles/owner/tasks/main.yml index 9bcbae2..f2b22bf 100644 --- a/roles/owner/tasks/main.yml +++ b/roles/owner/tasks/main.yml @@ -27,7 +27,8 @@ - name: "Prepare env variables." ansible.builtin.set_fact: - env_dict: '{{ owner_env | combine({"CURRENT_UID": user_create_result.uid | default(owner_name), "CURRENT_GID": user_create_result.group | default(owner_group)}) }}' + env_dict: '{{ owner_env | combine({"CURRENT_UID": user_create_result.uid | default(owner_name), "CURRENT_GID": user_create_result.group | default(owner_group)}) + }}' - name: 'Set up environment variables for user "{{ owner_name }}".' ansible.builtin.template: