Commit 8964b221 authored by EKbfh's avatar EKbfh

Fix lints

parent d2e0c800
skip_list:
- '204'
\ No newline at end of file
......@@ -36,7 +36,7 @@ DOCUMENTATION:
the files/ directory in the role will be chosen over files/ directory in play.
EXAMPLES:
- name: "copy configs"
copy: src={{item}} dest=/etc/conf.d/
copy: src={{ item }} dest=/etc/conf.d/
with_fileglob:
- 'files/conf.d/*.conf'
......
......@@ -7,15 +7,15 @@
- name: export use_cache var
set_fact:
use_cache: "{{ lookup('env','USE_CACHE') or True | bool }}"
minio_bucket: "myminio/{{inventory_hostname | replace('_','-')}}"
minio_bucket: "myminio/{{ inventory_hostname | replace('_','-') }}"
pip_cache_dir: "{{ lookup('env','PIP_CACHE') }}"
pkg_cache_dir: "{{ lookup('env','PKG_CACHE') }}"
- block:
- name: upload pip cache
command: /tmp/mc mirror {{pip_cache_dir}} {{minio_bucket}}/pip
command: /tmp/mc mirror {{ pip_cache_dir }} {{ minio_bucket }}/pip
- name: upload pkg cache
command: /tmp/mc mirror {{pkg_cache_dir}} {{minio_bucket}}/pkgs
command: /tmp/mc mirror {{ pkg_cache_dir }} {{ minio_bucket }}/pkgs
when: use_cache
......@@ -4,7 +4,7 @@
minio_url: "{{ lookup('env','MINIO_URL') }}"
minio_key: "{{ lookup('env','MINIO_KEY') }}"
minio_secret: "{{ lookup('env','MINIO_SECRET') }}"
minio_bucket: "myminio/{{inventory_hostname | replace('_','-')}}"
minio_bucket: "myminio/{{ inventory_hostname | replace('_','-') }}"
pip_cache_dir: "{{ lookup('env','PIP_CACHE') }}"
pkg_cache_dir: "{{ lookup('env','PKG_CACHE') }}"
......@@ -29,7 +29,7 @@
mode: 0755
- name: config cache url
command: "/tmp/mc config host add myminio {{ minio_url }} {{minio_key}} {{minio_secret}}"
command: "/tmp/mc config host add myminio {{ minio_url }} {{ minio_key }} {{ minio_secret }}"
- name: create minio bucket
command: "/tmp/mc mb {{ minio_bucket }}"
......@@ -47,7 +47,7 @@
command: "/tmp/mc mirror {{ minio_bucket }}/pip {{ pip_cache_dir }}"
- name: download pkg cache
command: "/tmp/mc mirror {{ minio_bucket }}/pkgs {{pkg_cache_dir}}"
command: "/tmp/mc mirror {{ minio_bucket }}/pkgs {{ pkg_cache_dir }}"
- name: Enable pkg cache
lineinfile:
......
{% for host in instance_conf %}
Host {{host.instance}}
HostName {{host.address}}
Port {{host.port}}
IdentityFile {{host.identity_file}}
Host {{ host.instance }}
HostName {{ host.address }}
Port {{ host.port }}
IdentityFile {{ host.identity_file }}
PreferredAuthentications publickey
User {{host.user}}
User {{ host.user }}
StrictHostKeyChecking=no
{%endfor%}
......@@ -15,7 +15,7 @@
vars:
goss_version: v0.3.5
goss_arch: amd64
goss_dst: /opt/goss_{{goss_version}}/goss
goss_dst: /opt/goss_{{ goss_version }}/goss
goss_test_directory: /etc/goss/goss.d
goss_format: documentation
tasks:
......
......@@ -7,15 +7,15 @@
- name: export use_cache var
set_fact:
use_cache: "{{ lookup('env','USE_CACHE') or True | bool }}"
minio_bucket: "myminio/{{inventory_hostname | replace('_','-')}}"
minio_bucket: "myminio/{{ inventory_hostname | replace('_','-') }}"
pip_cache_dir: "{{ lookup('env','PIP_CACHE') }}"
pkg_cache_dir: "{{ lookup('env','PKG_CACHE') }}"
- block:
- name: upload pip cache
command: minio-client mirror {{pip_cache_dir}} {{minio_bucket}}/pip --overwrite
command: minio-client mirror {{ pip_cache_dir }} {{ minio_bucket }}/pip --overwrite
- name: upload pkg cache
command: minio-client mirror {{pkg_cache_dir}} {{minio_bucket}}/pkgs --overwrite
command: minio-client mirror {{ pkg_cache_dir }} {{ minio_bucket }}/pkgs --overwrite
when: use_cache
......@@ -4,7 +4,7 @@
minio_url: "{{ lookup('env','MINIO_URL') }}"
minio_key: "{{ lookup('env','MINIO_KEY') }}"
minio_secret: "{{ lookup('env','MINIO_SECRET') }}"
minio_bucket: "myminio/{{inventory_hostname | replace('_','-')}}"
minio_bucket: "myminio/{{ inventory_hostname | replace('_','-') }}"
pip_cache_dir: "{{ lookup('env','PIP_CACHE') }}"
pkg_cache_dir: "{{ lookup('env','PKG_CACHE') }}"
......@@ -31,7 +31,7 @@
IGNORE_OSVERSION: "yes"
- name: config cache url
command: "minio-client config host add myminio {{ minio_url }} {{minio_key}} {{minio_secret}}"
command: "minio-client config host add myminio {{ minio_url }} {{ minio_key }} {{ minio_secret }}"
- name: create minio bucket
command: "minio-client mb {{ minio_bucket }}"
......@@ -48,4 +48,4 @@
command: "minio-client mirror {{ minio_bucket }}/pip {{ pip_cache_dir }} --overwrite"
- name: download pkg cache
command: "minio-client mirror {{ minio_bucket }}/pkgs {{pkg_cache_dir}} --overwrite"
command: "minio-client mirror {{ minio_bucket }}/pkgs {{ pkg_cache_dir }} --overwrite"
......@@ -5,12 +5,12 @@
- name: Install activator python packages
pip:
chdir: "{{noc_root}}"
chdir: "{{ noc_root }}"
requirements: "requirements/activator.txt"
virtualenv: "{{noc_root}}"
virtualenv: "{{ noc_root }}"
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
CFLAGS: "{{ pip_cflags | default('') }}"
LDFLAGS: "{{ pip_ldflags | default('') }}"
tags:
......@@ -41,8 +41,8 @@
- name: Tune sysctl.conf for activator
sysctl:
name: "{{item.name}}"
value: "{{item.value}}"
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
reload: "True"
with_items:
......
......@@ -8,7 +8,7 @@
- libssh2
- libssh2-devel
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
tags:
- requirements
......@@ -3,13 +3,13 @@
apt:
name: "{{ packages }}"
update_cache: "True"
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
cache_valid_time: "{{ apt_cache_valid_time | default (3600) }}"
vars:
packages:
- libssh2-1
- libssh2-1-dev
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
tags:
- requirements
......@@ -8,7 +8,7 @@
- libssh2
- libssh2-devel
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
tags:
- requirements
......@@ -8,7 +8,7 @@
- libssh2
- libssh2-devel
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
tags:
- requirements
......@@ -3,13 +3,13 @@
apt:
name: "{{ packages }}"
update_cache: "True"
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
cache_valid_time: "{{ apt_cache_valid_time | default (3600) }}"
vars:
packages:
- libssh2-1
- libssh2-1-dev
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
tags:
- requirements
......@@ -5,7 +5,7 @@
msg: |
To use bi you have to setup at least 3.4 mongo.
Check https://kb.nocproject.org/x/TIHJAQ for more details.
Current version selected: {{mongod_version}}
Current version selected: {{ mongod_version }}
Otherwise you can disable bi service on services tab
when:
- mongod_version is version_compare('3.4', operator='lt', strict=True)
......
......@@ -10,8 +10,8 @@
changed_when: "'CHANGED' in s.stdout"
with_items: "{{ required_assets }}"
environment:
http_proxy: "{{http_proxy}}"
https_proxy: "{{http_proxy}}"
NOC_CONFIG: "{{config_order}}"
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ http_proxy }}"
NOC_CONFIG: "{{ config_order }}"
tags:
- requirements
......@@ -10,8 +10,8 @@
changed_when: "'CHANGED' in s.stdout"
with_items: "{{ required_assets }}"
environment:
http_proxy: "{{http_proxy}}"
https_proxy: "{{http_proxy}}"
NOC_CONFIG: "{{config_order}}"
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ http_proxy }}"
NOC_CONFIG: "{{ config_order }}"
tags:
- requirements
......@@ -4,12 +4,12 @@
- name: Install classifier python packages
pip:
chdir: "{{noc_root}}"
chdir: "{{ noc_root }}"
requirements: "requirements/classifier.txt"
virtualenv: "{{noc_root}}"
virtualenv: "{{ noc_root }}"
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
CFLAGS: "{{ pip_cflags | default('') }}"
LDFLAGS: "{{ pip_ldflags | default('') }}"
tags:
......
......@@ -5,7 +5,7 @@
msg: |
To use datastream you have to setup at least 3.6 mongo.
Check https://kb.nocproject.org/x/TIHJAQ for more details.
Current version selected: {{mongod_version}}
Current version selected: {{ mongod_version }}
Otherwise you can disable datastream service on services tab
when:
- mongod_version is version_compare('3.6', operator='lt', strict=True)
......
......@@ -4,8 +4,8 @@
- name: Tune sysctl.conf for keepalive
sysctl:
name: "{{item.name}}"
value: "{{item.value}}"
name: "{{ item.name }}"
value: "{{ item.value }}"
state: present
reload: "True"
with_items:
......
......@@ -14,5 +14,5 @@
url: "https://{{ noc_web_host }}/api/grafanads"
isDefault: False # yamllint disable-line rule:truthy
editable: False # yamllint disable-line rule:truthy
delegate_to: "{{item}}"
with_items: '{{groups["svc-grafana-exec"]}}'
delegate_to: "{{ item }}"
with_items: '{{ groups["svc-grafana-exec"] }}'
---
- name: Install RADIUS python packages
pip:
chdir: "{{noc_root}}"
chdir: "{{ noc_root }}"
requirements: "requirements/login-radius.txt"
virtualenv: "{{noc_root}}"
virtualenv: "{{ noc_root }}"
extra_args: "--trusted-host cdn.getnoc.com --find-links https://cdn.getnoc.com/npkg/simple/ --upgrade"
when:
- login_methods is defined
- "'radius' in login_methods"
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
CFLAGS: "{{ pip_cflags | default('') }}"
LDFLAGS: "{{ pip_ldflags | default('') }}"
tags:
......@@ -18,16 +18,16 @@
- name: Install LDAP python packages
pip:
chdir: "{{noc_root}}"
chdir: "{{ noc_root }}"
requirements: "requirements/login-ldap.txt"
virtualenv: "{{noc_root}}"
virtualenv: "{{ noc_root }}"
extra_args: "--trusted-host cdn.getnoc.com --find-links https://cdn.getnoc.com/npkg/simple/ --upgrade"
when:
- login_methods is defined
- "'ldap' in login_methods"
environment:
https_proxy: "{{http_proxy}}"
http_proxy: "{{http_proxy}}"
https_proxy: "{{ http_proxy }}"
http_proxy: "{{ http_proxy }}"
CFLAGS: "{{ pip_cflags | default('') }}"
LDFLAGS: "{{ pip_ldflags | default('') }}"
tags:
......
......@@ -12,4 +12,4 @@
- role: migrate
run_once: "True"
environment:
NOC_CONFIG: "{{config_order}}"
NOC_CONFIG: "{{ config_order }}"
......@@ -7,11 +7,11 @@
name: consul
tasks_from: service_config_update
vars:
consul_service_key: "noc/slots/discovery-{{item}}/manifest"
consul_service_key: "noc/slots/discovery-{{ item }}/manifest"
consul_service_internal_key: "Limit"
consul_service_value: "{{hostvars |json_query(\"*.noc_services[] | [?name=='discovery'].{n:pool,num:config.power} | [?n=='\"+item+\"'] | sum([].num)\")}}"
consul_service_value: "{{ hostvars | json_query(\"*.noc_services[] | [?name=='discovery'].{n:pool,num:config.power} | [?n=='\"+item+\"'] | sum([].num)\") }}" # noqa 204
consul_service_token: None
with_items: "{{hostvars |json_query('*.noc_services[] | [].pool') |unique}}"
with_items: "{{ hostvars |json_query('*.noc_services[] | [].pool') |unique }}"
tags:
- discovery
......@@ -21,10 +21,10 @@
name: consul
tasks_from: service_config_update
vars:
consul_service_key: "noc/slots/ping-{{item}}/manifest"
consul_service_key: "noc/slots/ping-{{ item }}/manifest"
consul_service_internal_key: "Limit"
consul_service_value: "{{hostvars |json_query(\"*.noc_services[] | [?name=='ping'].{n:pool,num:config.power} | [?n=='\"+item+\"'] | sum([].num)\")}}"
consul_service_value: "{{ hostvars |json_query(\"*.noc_services[] | [?name=='ping'].{n:pool,num:config.power} | [?n=='\"+item+\"'] | sum([].num)\") }}" # noqa 204
consul_service_token: None
with_items: "{{hostvars |json_query('*.noc_services[] | [].pool') |unique}}"
with_items: "{{ hostvars |json_query('*.noc_services[] | [].pool') |unique }}"
tags:
- discovery
......@@ -5,10 +5,10 @@
name: postgres
tasks_from: users
vars:
db_name: "{{postgres_noc_db}}"
db_password: "{{postgres_noc_password}}"
db_user: "{{postgres_noc_user}}"
delegate_to: "{{postgres_master_node}}"
db_name: "{{ postgres_noc_db }}"
db_password: "{{ postgres_noc_password }}"
db_user: "{{ postgres_noc_user }}"
delegate_to: "{{ postgres_master_node }}"
when: postgres_master_node is defined
tags:
- postgres
......@@ -22,9 +22,9 @@
register: s
changed_when: "'CHANGED' in s.stdout"
environment:
http_proxy: "{{http_proxy}}"
https_proxy: "{{http_proxy}}"
NOC_CONFIG: "{{config_order}}"
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ http_proxy }}"
NOC_CONFIG: "{{ config_order }}"
tags:
- requirements
- coll_sync
......@@ -99,12 +99,12 @@
changed_when: mibs_out.stdout | length > 7
- name: migrate ch db
command: ./noc migrate-ch --host "{{item}}"
command: ./noc migrate-ch --host "{{ item }}"
args:
chdir: "{{ noc_root }}"
register: migrate_ch
with_items: "{{groups['svc-clickhouse-exec']}}"
delegate_to: "{{groups['svc-chwriter-exec'][0]}}"
with_items: "{{ groups['svc-clickhouse-exec'] }}"
delegate_to: "{{ groups['svc-chwriter-exec'][0] }}"
changed_when: "'CHANGED' in migrate_ch.stdout"
when:
- "'svc-chwriter-exec' in groups"
......@@ -6,18 +6,18 @@ noc_var_lib: /var/lib/noc
noc_repo: https://github.com/nocproject/noc.git
noc_version: microservices
noc_root: /opt/noc
noc_etc: "{{noc_root}}/etc"
noc_reports_dir: "{{noc_var_lib}}/reports"
noc_crashinfo_dir: "{{noc_var_lib}}/var/cp/crashinfo/new"
noc_services_file: "{{noc_etc}}/noc_services.conf"
noc_etc: "{{ noc_root }}/etc"
noc_reports_dir: "{{ noc_var_lib }}/reports"
noc_crashinfo_dir: "{{ noc_var_lib }}/var/cp/crashinfo/new"
noc_services_file: "{{ noc_etc }}/noc_services.conf"
pypy_version: 5.9
pypy_hash_sha256: 8d39eb98df3adf7882a7f3551f47b8c7cff47a0e20d6aabc57bb592f155c2616
pypy_download_url_base: https://bitbucket.org/squeaky/portable-pypy/downloads
pypy_download_url: "{{ pypy_download_url_base }}/pypy-{{ pypy_version }}-linux_x86_64-portable.tar.bz2"
pypy_tmp_path: "{{tower_dist_dir}}/pypy-{{ pypy_version }}-linux_x86_64-portable.tar.bz2"
pypy_path: "{{noc_root}}/../pypy"
pypy_tmp_path: "{{ tower_dist_dir }}/pypy-{{ pypy_version }}-linux_x86_64-portable.tar.bz2"
pypy_path: "{{ noc_root }}/../pypy"
python_interpreter: python
bi_export_dir: "{{noc_var_lib}}/bi"
bi_export_dir: "{{ noc_var_lib }}/bi"
supervisorctl_key: "{{ lookup('supervisorctl_key', tower_data + '/noc/supervisorctl.key') }}"
django_key: "{{ lookup('django_key', tower_data + '/noc/secret.key') }}"
supervisor_sock_path: /var/run/supervisor_noc.sock
......@@ -147,18 +147,18 @@ ldap_bind_password =
# Users search base
ldap_users_base = ou=Users,ou=nocproject,ou=org
# Filter to search users by username
ldap_users_filter = (&(objectClass=inetOrgPerson)(uid={{user}}))
ldap_users_filter = (&(objectClass=inetOrgPerson)(uid={{ user }}))
# Groups search base
ldap_groups_base = ou=Groups,ou=nocproject,ou=org
# Additionaly check user in group, before permitting to log in
# Set user.is_active flag to false when user is not in a group
ldap_required_group =
# Filter to search user in required group
ldap_required_filter = (|(uniqueMember={{dn}})(member={{user}}))
ldap_required_filter = (|(uniqueMember={{ dn }})(member={{ user }}))
# Grant superuser permissions if user in group
ldap_superuser_group =
# Filter to search user in superusers group
ldap_superuser_filter = (|(uniqueMember={{dn}})(member={{user}}))
ldap_superuser_filter = (|(uniqueMember={{ dn }})(member={{ user }}))
# Use TLS
ldap_start_tls = false
......@@ -175,7 +175,7 @@ ad_bind_password =
# Users search base
ad_users_base = ou=nocproject,ou=org
# Filter to search users by username
ad_users_filter = (&(objectClass=organizationalPerson)(sAMAccountName={{user}}))
ad_users_filter = (&(objectClass=organizationalPerson)(sAMAccountName={{ user }}))
# Groups search base
ad_groups_base = ou=Groups,ou=nocproject,ou=org
# Additionaly check user in group, before permitting to log in
......
......@@ -20,13 +20,13 @@
- name: check if noc_root exists
stat:
path: "{{noc_root}}"
path: "{{ noc_root }}"
register: noc_root_state
- block:
- name: check if noc under mercurial control
stat:
path: "{{noc_root}}/.hg"
path: "{{ noc_root }}/.hg"
register: noc_hg_state
- name: fail install if we are under mercurial
......
......@@ -5,12 +5,12 @@
dest: "{{ noc_etc }}/supervisord.conf"
owner: "root"
mode: "0640"
no_log: "{{tower_show_secrets}}"
no_log: "{{ tower_show_secrets }}"
- name: Build services config
template:
src: "etc/noc_services.conf.j2"
dest: "{{noc_root}}/etc/noc_services.conf"
dest: "{{ noc_root }}/etc/noc_services.conf"
owner: "root"
mode: "0640"
when:
......@@ -22,9 +22,9 @@
src: "etc/tower.yml.j2"
dest: "{{ noc_etc }}/tower.yml"
mode: "0640"
group: "{{noc_group}}"
owner: "{{noc_user}}"
no_log: "{{tower_show_secrets}}"
group: "{{ noc_group }}"
owner: "{{ noc_user }}"
no_log: "{{ tower_show_secrets }}"
when:
- noc_services is defined
- noc_services
......@@ -32,32 +32,32 @@
- name: Generate NOC config for pooled services
template:
src: "etc/pooled.yml.j2"
dest: "{{ noc_etc }}/pool-{{item.name}}.yml"
dest: "{{ noc_etc }}/pool-{{ item.name }}.yml"
mode: "0640"
owner: "{{noc_user}}"
group: "{{noc_group}}"
no_log: "{{tower_show_secrets}}"
owner: "{{ noc_user }}"
group: "{{ noc_group }}"
no_log: "{{ tower_show_secrets }}"
when:
- noc_services is defined
- noc_services
vars:
pool_name: "{{item.name}}"
pool_name: "{{ item.name }}"
with_items:
- "{{noc_all_pools}}"
- "{{ noc_all_pools }}"
- name: Build pools config
template:
src: "etc/pools.yml.j2"
dest: "{{noc_root}}/etc/noc.yml"
owner: "{{noc_user}}"
group: "{{noc_group}}"
dest: "{{ noc_root }}/etc/noc.yml"
owner: "{{ noc_user }}"
group: "{{ noc_group }}"
mode: "0640"
- name: install .env file
template:
src: "env.j2"
dest: "{{noc_root}}/.env"
owner: "{{noc_user}}"
group: "{{noc_group}}"
dest: "{{ noc_root }}/.env"
owner: "{{ noc_user }}"
group: "{{ noc_group }}"
mode: "0644"
no_log: "{{tower_show_secrets}}"
no_log: "{{ tower_show_secrets }}"
---
- name: Create required directories #hack. have to be fixed
file:
path: "{{noc_root}}/lib/python2.7/site-packages/__pycache__"
path: "{{ noc_root }}/lib/python2.7/site-packages/__pycache__"
state: "directory"
owner: "{{ noc_user }}"
mode: 0755
......@@ -9,16 +9,16 @@
- name: Create required directories