Fixed some lint errors

- Added missing default parameters
- Added names to tasks
- Configured changed|failed_when options
- Used command instead of shell module
- Changed local_action to delegate_to
- Added line to file ending
dehydrated
Felix Stupp 5 years ago
parent 02e63f5d2a
commit 7ac7806dc7
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -41,6 +41,7 @@
become_user: "{{ username }}" become_user: "{{ username }}"
git: git:
repo: https://github.com/robbyrussell/oh-my-zsh.git repo: https://github.com/robbyrussell/oh-my-zsh.git
version: master
dest: ~/.oh-my-zsh dest: ~/.oh-my-zsh
- name: Configure oh-my-zsh - name: Configure oh-my-zsh

@ -1,6 +1,7 @@
--- ---
- user: - name: Remove temporary privileged user
user:
name: "{{ bootstrap_user }}" name: "{{ bootstrap_user }}"
state: absent state: absent
become: yes become: yes

@ -1,8 +1,9 @@
--- ---
- set_fact: - name: Set variables for shifting back
set_fact:
bootstrap_used: no bootstrap_used: no
ansible_user: '{{ bootstrap_expected_user }}' ansible_user: '{{ bootstrap_expected_user }}'
ansible_become_pass: '{{ bootstrap_expected_become_pass }}' ansible_become_pass: '{{ bootstrap_expected_become_pass }}'
- meta: reset_connection - meta: reset_connection

@ -1,11 +1,13 @@
--- ---
- action: ping - name: Try to ping host with expected credentials
action: ping
ignore_unreachable: true ignore_unreachable: true
ignore_errors: yes ignore_errors: yes
register: pingtest register: pingtest
- meta: clear_host_errors - meta: clear_host_errors
- set_fact: - name: Shift if ping fails
set_fact:
bootstrap_used: yes bootstrap_used: yes
ansible_user: '{{ bootstrap_user }}' ansible_user: '{{ bootstrap_user }}'
ansible_become_pass: '{{ bootstrap_become_pass }}' ansible_become_pass: '{{ bootstrap_become_pass }}'

@ -25,10 +25,10 @@
register: root_user register: root_user
- name: Store ssh public key local - name: Store ssh public key local
local_action: copy:
module: copy
content: "{{ root_user.ssh_public_key }}\n" content: "{{ root_user.ssh_public_key }}\n"
dest: "public_keys/ssh/root@{{ ansible_fqdn }}" dest: "public_keys/ssh/root@{{ ansible_fqdn }}"
delegate_to: localhost
vars: vars:
ansible_become: no ansible_become: no

@ -31,7 +31,7 @@
- vim - vim
- wget - wget
- zsh - zsh
state: latest state: present
allow_unauthenticated: no allow_unauthenticated: no
update_cache: yes update_cache: yes
cache_valid_time: 3600 cache_valid_time: 3600

@ -45,29 +45,29 @@
check_mode: no check_mode: no
- name: Create directory for host keys locally - name: Create directory for host keys locally
local_action: file:
module: file
path: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}" path: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}"
state: directory state: directory
owner: "{{ global_local_user }}" owner: "{{ global_local_user }}"
group: "{{ global_local_user }}" group: "{{ global_local_user }}"
mode: "u=rwx,g=rx,o=rx" mode: "u=rwx,g=rx,o=rx"
delegate_to: localhost
- name: Store ssh host keys locally - name: Store ssh host keys locally
local_action: copy:
module: copy
content: "{{ item.stdout }}\n" content: "{{ item.stdout }}\n"
dest: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}/{{ item.item }}" dest: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}/{{ item.item }}"
owner: "{{ global_local_user }}" owner: "{{ global_local_user }}"
group: "{{ global_local_user }}" group: "{{ global_local_user }}"
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
delegate_to: localhost
loop: "{{ ssh_host_keys.results }}" loop: "{{ ssh_host_keys.results }}"
loop_control: loop_control:
label: "{{ item.item }}" label: "{{ item.item }}"
- name: Generate ssh host key dns fingerprints locally - name: Generate ssh host key dns fingerprints locally
local_action: make:
module: make
chdir: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}" chdir: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}"
file: "{{ playbook_dir }}/helpers/ssh_dns_fingerprints.makefile" file: "{{ playbook_dir }}/helpers/ssh_dns_fingerprints.makefile"
target: dns target: dns
delegate_to: localhost

@ -1,5 +1,7 @@
--- ---
# TODO Change to makefile call
- name: Generate key signing key for zone {{ domain }} - name: Generate key signing key for zone {{ domain }}
command: >- command: >-
dnssec-keygen dnssec-keygen

@ -35,6 +35,7 @@
notify: reload bind9 notify: reload bind9
register: database_stored register: database_stored
# TODO Change to makefile
# TODO test -N=UNIXTIME instead of unix time by ansible # TODO test -N=UNIXTIME instead of unix time by ansible
- name: Sign zone {{ domain }} - name: Sign zone {{ domain }}
shell: >- shell: >-

@ -27,6 +27,9 @@
{{ nextcloud_keyring | quote }} {{ nextcloud_keyring | quote }}
args: args:
chdir: "{{ nextcloud_user_directory }}" chdir: "{{ nextcloud_user_directory }}"
register: receive_public_key
changed_when: receive_public_key.rc != 2
failed_when: receive_public_key.rc != 0 and receive_public_key != 2
- name: Validate signature - name: Validate signature
become_user: "{{ system_user }}" become_user: "{{ system_user }}"

@ -94,7 +94,9 @@
chdir: "{{ nextcloud_installation_directory }}" chdir: "{{ nextcloud_installation_directory }}"
register: nextcloud_apps_install_results register: nextcloud_apps_install_results
changed_when: "'already installed' not in nextcloud_apps_install_results.stdout" changed_when: "'already installed' not in nextcloud_apps_install_results.stdout"
failed_when: nextcloud_apps_install_results.rc != 0 and not (nextcloud_apps_install_results.rc == 1 and 'already installed' in nextcloud_apps_install_results.stdout) failed_when: >-
nextcloud_apps_install_results.rc != 0 and
not (nextcloud_apps_install_results.rc == 1 and 'already installed' in nextcloud_apps_install_results.stdout)
loop: "{{ enabled_apps_list }}" loop: "{{ enabled_apps_list }}"
- name: Add background cron job - name: Add background cron job

@ -1,11 +1,10 @@
--- ---
- name: Run install command - name: Run install command
shell: "{{ install_command }}" command: "{{ install_command }}"
args: args:
chdir: "{{ src }}" chdir: "{{ src }}"
creates: "{{ src }}/node_modules" creates: "{{ src }}/node_modules"
executable: /bin/sh
- name: Register service for node server - name: Register service for node server
template: template:

@ -60,8 +60,8 @@
nvak_dns_slaves: [] nvak_dns_slaves: []
pre_tasks: pre_tasks:
- name: Load ssh host key dns fingerprint for host - name: Load ssh host key dns fingerprint for host
local_action: command: cat "{{ global_ssh_host_key_directory | quote }}/{{ item | quote }}/dns"
module: command cat "{{ global_ssh_host_key_directory | quote }}/{{ item | quote }}/dns" delegate_to: localhost
register: ssh_key_dns_fpr_raw register: ssh_key_dns_fpr_raw
changed_when: False changed_when: False
loop: "{{ groups['all'] }}" loop: "{{ groups['all'] }}"

Loading…
Cancel
Save