Verified Commit b1651b60 authored by Frederik Schwan's avatar Frederik Schwan Committed by Sven-Hendrik Haase
Browse files

fix E504 "Do not use ‘local_action’, use ‘delegate_to: localhost’"

parent a4a4f3e7
......@@ -16,20 +16,20 @@
hosts: localhost
tasks:
- name: store hostkeys
local_action:
module: copy
dest: "{{ playbook_dir }}/../../docs/ssh-hostkeys.txt"
content: "{% for host in query('inventory_hostnames', 'all,!rsync_net,!localhost') | sort %}# {{ host }}\n{{ hostvars[host].ssh_hostkeys.stdout }}\n\n{% endfor %}"
copy:
dest: "{{ playbook_dir }}/../../docs/ssh-hostkeys.txt"
content: "{% for host in query('inventory_hostnames', 'all,!rsync_net,!localhost') | sort %}# {{ host }}\n{{ hostvars[host].ssh_hostkeys.stdout }}\n\n{% endfor %}"
delegate_to: localhost
- name: store known_hosts
local_action:
module: copy
dest: "{{ playbook_dir }}/../../docs/ssh-known_hosts.txt"
content: "{% for host in query('inventory_hostnames', 'all,!rsync_net,!localhost') | sort %}# {{ host }}\n{{ hostvars[host].known_hosts.stdout }}\n\n{% endfor %}"
copy:
dest: "{{ playbook_dir }}/../../docs/ssh-known_hosts.txt"
content: "{% for host in query('inventory_hostnames', 'all,!rsync_net,!localhost') | sort %}# {{ host }}\n{{ hostvars[host].known_hosts.stdout }}\n\n{% endfor %}"
delegate_to: localhost
- name: manually append rsync.net host keys
local_action:
module: lineinfile
path: "{{ playbook_dir }}/../../docs/ssh-known_hosts.txt"
line: "{% for host in query('inventory_hostnames', 'rsync_net') | sort %}# {{ host }}\n{{ hostvars[host].known_host }}\n\n{% endfor %}"
lineinfile:
path: "{{ playbook_dir }}/../../docs/ssh-known_hosts.txt"
line: "{% for host in query('inventory_hostnames', 'rsync_net') | sort %}# {{ host }}\n{{ hostvars[host].known_host }}\n\n{% endfor %}"
delegate_to: localhost
- name: upload known_hosts to all nodes
hosts: all,!rsync_net
......
......@@ -13,12 +13,17 @@
remote_user: root
changed_when: client_ssh_keys.changed
- local_action: tempfile state=file
- name: create tempfile
tempfile: state=file
register: tempfile
delegate_to: localhost
- local_action: copy content="{{ lookup('template', 'authorized_keys.j2')}}" dest="{{ tempfile.path }}"
- name: fill tempfile
copy: content="{{ lookup('template', 'authorized_keys.j2') }}" dest="{{ tempfile.path }}"
delegate_to: localhost
- name: upload authorized_keys file
local_action: command scp "{{ tempfile.path }}" "{{ rsync_net_username }}@{{ inventory_hostname }}":.ssh/authorized_keys
command: scp "{{ tempfile.path }}" "{{ rsync_net_username }}@{{ inventory_hostname }}":.ssh/authorized_keys
delegate_to: localhost
register: scp
changed_when: "scp.rc == 0"
......@@ -3,8 +3,9 @@
# If you do not have python-zabbix-api installed (** ON YOUR LOCAL MACHINE **),
# this will fail. Please install it; it is needed for tasks later in this role.
- name: install python-zabbix-api package on localhost
local_action: pacman name=python-zabbix-api
pacman: name=python-zabbix-api
run_once: true
delegate_to: localhost
- name: install packages
pacman: name=zabbix-agent,python-dbus,perl-json,arch-audit
......@@ -52,8 +53,7 @@
changed_when: false
- name: Set host config in zabbix
local_action:
module: zabbix_host
zabbix_host:
server_url: "https://{{ zabbix_agent_server }}"
login_user: "{{ vault_zabbix_admin_user }}"
login_password: "{{ vault_zabbix_admin_password }}"
......@@ -75,6 +75,7 @@
tls_accept: 2
tls_connect: 2
tls_psk: "{{ zabbix_agent_psk.stdout }}"
delegate_to: localhost
- name: install agent config
template: src=zabbix_agentd.conf dest=/etc/zabbix/zabbix_agentd.conf owner=zabbix-agent group=zabbix-agent mode=600
......
Supports Markdown
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