-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest_config_local.yaml
99 lines (91 loc) · 2.68 KB
/
test_config_local.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
- hosts: openwrt
connection: local
user: root
become: no
gather_facts: no
serial: 1
ignore_unreachable: true
vars:
aps: "{{ groups['aps'] }}"
tasks:
- name: Get public IP address
when: upnp.configure_with_external_ip is defined and upnp.configure_with_external_ip
shell: wget -qO- http://ipecho.net/plain
register: external_ip_command
check_mode: false
- name: Set variable for public IP address
when: upnp.configure_with_external_ip is defined and upnp.configure_with_external_ip
set_fact:
external_ip: '{{ external_ip_command.stdout_lines[0] }}'
- name: Hash password
delegate_to: localhost
become: no
shell: openssl passwd -salt 'YRNxiMTL' -1 '{{ ssh_password }}'
register: ssh_password_hashed_command
check_mode: false
- name: Set variable for hashed password
set_fact:
ssh_password_hashed: '{{ ssh_password_hashed_command.stdout_lines[0] }}'
- name: Creating required directories
file:
path: '{{item}}'
recurse: yes
state: directory
with_items:
- etc
- etc/config
- etc/crontabs
- etc/dropbear
loop_control:
label: Creating directory {{ item }}
- name: Copy configuration
template:
src: 'config/{{ item.name }}'
dest: '{{ item.path }}/{{ item.filename | default(item.name) }}'
with_items:
- name: authorized_keys
path: etc/dropbear
- name: dhcp
path: etc/config
- name: dnsmasq.conf
path: etc
- name: ethers
path: etc
- name: firewall
path: etc/config
- name: luci
path: etc/config
- name: network
path: etc/config
- name: shadow
path: etc
- name: sqm
path: etc/config
- name: system
path: etc/config
- name: uhttpd
path: etc/config
- name: upnpd
path: etc/config
- name: wireless
path: etc/config
- name: dawn
path: etc/config
- name: cron
path: etc/crontabs
filename: root
vars:
networks: "{{ common_networks | combine(host_networks | default({}), recursive=True) }}"
loop_control:
label: Copying {{ item.path }}/{{ item.filename | default(item.name) }}
- name: Copy configuration (binary files)
copy:
src: 'certs/{{ item.name }}'
dest: '{{ item.path }}/{{ item.name }}'
with_items:
- name: uhttpd.crt
path: etc
- name: uhttpd.key
path: etc
loop_control:
label: Copying {{ item.path }}/{{ item.name }}