Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
infrastructure
Commits
b1651b60
Verified
Commit
b1651b60
authored
Jun 12, 2020
by
Frederik Schwan
Committed by
Sven-Hendrik Haase
Jun 17, 2020
Browse files
fix E504 "Do not use ‘local_action’, use ‘delegate_to: localhost’"
parent
a4a4f3e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
playbooks/tasks/sync-ssh-hostkeys.yml
View file @
b1651b60
...
...
@@ -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
l
ocal_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
%}"
l
ineinfile
:
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
...
...
roles/rsync_net/tasks/main.yml
View file @
b1651b60
...
...
@@ -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"
roles/zabbix-agent/tasks/main.yml
View file @
b1651b60
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment