Commit 7206e28d authored by Maciej Delmanowski's avatar Maciej Delmanowski

Fix ansible-lint error E501 in DebOps roles

parent e17c81bc
......@@ -203,6 +203,7 @@
file:
path: '~/.local/share/applications'
state: 'directory'
become: True
become_user: '{{ item.name }}'
no_log: '{{ not (firejail__ansible_log | bool) }}'
when: firejail__deploy_state in ["present"] and item.name != "root"
......@@ -212,6 +213,7 @@
command: firecfg --fix
register: firejail__register_cmd_firecfg_fix
changed_when: ("created" in firejail__register_cmd_firecfg_fix.stdout)
become: True
become_user: '{{ item.name }}'
no_log: '{{ not (firejail__ansible_log | bool) }}'
when: firejail__deploy_state in ["present"] and item.name != "root"
......
......@@ -62,6 +62,7 @@
dest: '{{ debops_api__input_data_repo_dest }}'
update: '{{ debops_api__input_data_repo_update | bool }}'
recursive: True
become: True
become_user: '{{ debops_api__user }}'
tags: [ 'role::debops_api:git' ]
......@@ -83,6 +84,7 @@
update: True
# verify_commit:
# version:
become: True
become_user: '{{ debops_api__user }}'
tags: [ 'role::debops_api:git' ]
......@@ -137,6 +139,7 @@
- name: Run initial DebOps API data build
command: '{{ debops_api__cron_script }}'
when: not debops_api__register_public_api_dir.stat.exists
become: True
become_user: '{{ debops_api__user }}'
# ]]]
......@@ -48,6 +48,7 @@
dest: '{{ librenms__install_path }}'
version: '{{ librenms__install_version }}'
update: False
become: True
become_user: '{{ librenms__user }}'
register: librenms__register_source
no_log: True
......@@ -141,12 +142,14 @@
command: php build-base.php
args:
chdir: '{{ librenms__install_path }}'
become: True
become_user: '{{ librenms__user }}'
when: (librenms__register_database_status|d() and librenms__register_database_status is changed)
tags: [ 'role::librenms:database' ]
- name: Get list of existing users from LibreNMS database
command: mysql -ssNe "select username from users"
become: True
become_user: '{{ librenms__user }}'
register: librenms__register_users
changed_when: False
......@@ -156,6 +159,7 @@
command: 'php adduser.php {{ item }} {{ lookup("password", secret + "/credentials/" + ansible_fqdn + "/librenms/admin/" + item + "/password") }} 10'
args:
chdir: '{{ librenms__install_path }}'
become: True
become_user: '{{ librenms__user }}'
with_items: '{{ librenms__admin_accounts }}'
when: (librenms__admin_accounts|d([]) and (item not in librenms__register_users.stdout_lines))
......@@ -204,6 +208,7 @@
- name: Get list of known devices from LibreNMS database
command: mysql -ssNe "select hostname from devices"
become: True
become_user: '{{ librenms__user }}'
register: librenms__register_devices
changed_when: False
......@@ -213,6 +218,7 @@
command: php addhost.php {{ item }}
args:
chdir: '{{ librenms__install_path }}'
become: True
become_user: '{{ librenms__user }}'
with_items: '{{ librenms__devices }}'
when: (librenms__devices|d([]) and (item not in librenms__register_devices.stdout_lines))
......
......@@ -102,6 +102,7 @@
- '{{ postgresql__roles }}'
- '{{ postgresql_roles|d([]) }}'
- '{{ postgresql__dependent_roles }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: (((item.name|d() and item.name) or (item.role|d() and item.role)) and
......@@ -122,6 +123,7 @@
- '{{ postgresql__databases }}'
- '{{ postgresql_databases|d([]) }}'
- '{{ postgresql__dependent_databases }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: (((item.name|d() and item.name) or (item.database|d() and item.database)) and
......@@ -137,6 +139,7 @@
with_flattened:
- '{{ postgresql__extensions }}'
- '{{ postgresql__dependent_extensions }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: (item.extension|d() and item.database|d())
......@@ -155,6 +158,7 @@
- '{{ postgresql__databases }}'
- '{{ postgresql_databases|d([]) }}'
- '{{ postgresql__dependent_databases }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: (((item.name|d() and item.name) or (item.database|d() and item.database)) and
......@@ -174,6 +178,7 @@
- '{{ postgresql__groups }}'
- '{{ postgresql_groups|d([]) }}'
- '{{ postgresql__dependent_groups }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: ((item.roles|d() and item.roles) and
......@@ -192,6 +197,7 @@
- '{{ postgresql__roles }}'
- '{{ postgresql_roles|d([]) }}'
- '{{ postgresql__dependent_roles }}'
become: True
become_user: '{{ postgresql__user }}'
delegate_to: '{{ postgresql__delegate_to }}'
when: (((item.name|d() and item.name) or (item.role|d() and item.role)) and
......
......@@ -9,6 +9,7 @@
state: 'present'
with_flattened:
- '{{ postgresql_server__clusters }}'
become: True
become_user: '{{ item.user | d(postgresql_server__user) }}'
when: item.name|d()
no_log: True
......@@ -23,6 +24,7 @@
state: 'present'
with_flattened:
- '{{ postgresql_server__clusters }}'
become: True
become_user: '{{ item.user | d(postgresql_server__user) }}'
when: item.name|d()
......@@ -36,5 +38,6 @@
state: 'absent'
with_flattened:
- '{{ postgresql_server__clusters }}'
become: True
become_user: '{{ item.user | d(postgresql_server__user) }}'
when: item.name|d()
......@@ -14,6 +14,7 @@
when: rails_deploy_database_adapter == 'postgresql' and
inventory_hostname == rails_deploy_hosts_master
become: True
become_user: '{{ rails_deploy_postgresql_super_username }}'
- name: Create PostgreSQL database if enabled
......@@ -30,6 +31,7 @@
register: rails_deploy_register_database_created
when: rails_deploy_database_adapter == 'postgresql' and
inventory_hostname == rails_deploy_hosts_master
become: True
become_user: '{{ rails_deploy_postgresql_super_username }}'
- name: Create MySQL user
......@@ -43,6 +45,7 @@
state: 'present'
when: rails_deploy_database_adapter == 'mysql' and
inventory_hostname == rails_deploy_hosts_master
become: True
become_user: '{{ rails_deploy_mysql_super_username }}'
- name: Create MySQL database if enabled
......@@ -57,4 +60,5 @@
register: rails_deploy_register_database_created
when: rails_deploy_database_adapter == 'mysql' and
inventory_hostname == rails_deploy_hosts_master
become: True
become_user: '{{ rails_deploy_mysql_super_username }}'
......@@ -6,6 +6,7 @@
remote={{ rails_deploy_git_remote }} accept_hostkey=yes
register: rails_deploy_register_repo_status
when: rails_deploy_git_location is defined and rails_deploy_git_location
become: True
become_user: '{{ rails_deploy_service }}'
- name: Detect a temporary public deploy page
......@@ -19,6 +20,7 @@
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
changed_when: False
become: True
become_user: '{{ rails_deploy_service }}'
- name: Update gems
......@@ -27,6 +29,7 @@
changed_when: False
when: rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
become: True
become_user: '{{ rails_deploy_service }}'
- name: Restart the background worker asynchronously
......@@ -45,6 +48,7 @@
inventory_hostname == rails_deploy_hosts_master and
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
become: True
become_user: '{{ rails_deploy_service }}'
- name: Store mtime of the config folder
......@@ -65,6 +69,7 @@
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
with_items: '{{ rails_deploy_pre_migrate_shell_commands }}'
become: True
become_user: '{{ rails_deploy_service }}'
- name: Migrate the database
......@@ -76,6 +81,7 @@
(rails_deploy_register_mtime_schema.stat.mtime != ansible_local.rails_deploy[rails_deploy_service].mtime.schema) or
ansible_local.rails_deploy[rails_deploy_service].mtime.schema is undefined))
register: rails_deploy_register_migration
become: True
become_user: '{{ rails_deploy_service }}'
- name: Execute shell commands after migration
......@@ -84,6 +90,7 @@
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
with_items: '{{ rails_deploy_post_migrate_shell_commands }}'
become: True
become_user: '{{ rails_deploy_service }}'
- name: Reload the backend server
......@@ -147,6 +154,7 @@
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
with_items: '{{ rails_deploy_post_restart_shell_commands }}'
become: True
become_user: '{{ rails_deploy_service }}'
- name: Disable the temporary deploy page
......@@ -155,4 +163,5 @@
rails_deploy_register_repo_status is defined and
rails_deploy_register_repo_status is changed
changed_when: False
become: True
become_user: '{{ rails_deploy_service }}'
......@@ -108,6 +108,7 @@
update: '{{ item["_update"] | d(omit) }}'
verify_commit: '{{ item.verify_commit | d(omit) }}'
version: '{{ item.version | d(omit) }}'
become: True
become_user: '{{ item.owner | d("root") }}'
with_flattened:
- '{{ resources__repositories }}'
......
......@@ -34,6 +34,7 @@
command: git rev-parse HEAD
args:
chdir: '{{ roundcube__git_dest }}'
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_current_head
changed_when: False
......@@ -43,6 +44,7 @@
command: git symbolic-ref HEAD refs/heads/master
args:
chdir: '{{ roundcube__git_dest }}'
become: True
become_user: '{{ roundcube__user }}'
changed_when: False
when: roundcube__register_cloned.stat.exists
......@@ -61,6 +63,7 @@
dest: '{{ roundcube__git_dest }}'
bare: True
update: True
become: True
become_user: '{{ roundcube__user }}'
- name: Restore HEAD to previous checkout
......@@ -95,6 +98,7 @@
GIT_WORK_TREE: '{{ roundcube__git_checkout }}'
args:
chdir: '{{ roundcube__git_dest }}'
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_target_tag
changed_when: roundcube__register_target_tag.stdout != roundcube__git_version
......@@ -105,12 +109,14 @@
GIT_WORK_TREE: '{{ roundcube__git_checkout }}'
args:
chdir: '{{ roundcube__git_dest }}'
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_checkout
changed_when: roundcube__register_target_tag.stdout != roundcube__git_version
- name: Read PHP composer template
command: cat {{ roundcube__git_checkout }}/composer.json-dist
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_composer_json
changed_when: False
......@@ -131,6 +137,7 @@
url: '{{ roundcube__composer_phar_url }}'
dest: '{{ roundcube__git_checkout }}'
mode: '0640'
become: True
become_user: '{{ roundcube__user }}'
when: roundcube__composer_phar|bool
......@@ -138,6 +145,7 @@
command: php composer.phar install
args:
chdir: '{{ roundcube__git_checkout }}'
become: True
become_user: '{{ roundcube__user }}'
when: roundcube__composer_phar|bool
register: roundcube__register_composer_phar
......@@ -147,6 +155,7 @@
composer:
command: install
working_dir: '{{ roundcube__git_checkout }}'
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_composer
until: roundcube__register_composer is succeeded
......@@ -157,6 +166,7 @@
args:
chdir: '{{ roundcube__git_checkout }}'
creates: 'program/js/jquery.min.js'
become: True
become_user: '{{ roundcube__user }}'
- name: Enable cleandb.sh Cron job
......
......@@ -81,6 +81,7 @@
command: 'php bin/updatedb.sh --package=roundcube --dir={{ roundcube__git_checkout }}/SQL'
args:
chdir: '{{ roundcube__git_checkout }}'
become: True
become_user: '{{ roundcube__user }}'
register: roundcube__register_updatedb
changed_when: not roundcube__register_updatedb.stdout == ''
......
......@@ -76,5 +76,6 @@
- '{{ ruby__group_user_gems }}'
- '{{ ruby__host_user_gems }}'
- '{{ ruby__dependent_user_gems }}'
become: True
become_user: '{{ item.user | d(item.owner) }}'
when: (item.user|d() or item.owner|d())
......@@ -33,6 +33,7 @@
when: sks_register_database_pre_build is defined and not sks_register_database_pre_build.stat.exists
- name: Build SKS Keyserver database
become: True
become_user: 'debian-sks'
command: /usr/sbin/sks build chdir=/var/lib/sks creates=/var/lib/sks/DB/key
when: sks_autoinit is defined and sks_autoinit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment