Tasks
main.yml
Synopsis: Main task.
Import tasks if enabled.
1---
2# tasks for vbotka.freebsd_wpa_cli
3
4- name: Import debug.yml
5 ansible.builtin.import_tasks: debug.yml
6 when: wpacli_debug | bool
7 tags: wpacli_debug
8
9- name: Import assert.yml
10 ansible.builtin.import_tasks: assert.yml
11 tags: [wpacli_assert, always]
12
13- name: Import packages.yml
14 ansible.builtin.import_tasks: packages.yml
15 when: wpacli_install | bool
16 tags: wpacli_packages
17
18- name: Import wpa-cli.yml
19 ansible.builtin.import_tasks: wpa-cli.yml
20 tags: wpacli_wpa_cli
21
22- name: Import rc.yml
23 ansible.builtin.import_tasks: rc.yml
24 tags: wpacli_rc
25
26- name: Import rcconf.yml
27 ansible.builtin.import_tasks: rcconf.yml
28 tags: wpacli_rcconf
29
30# EOF
assert.yml
Synopsis: Configure assert.
Description of the task.
1---
2- name: "Assert: Check FreeBSD version."
3 ansible.builtin.assert:
4 that: ansible_distribution_version in wpacli_versions_tested
5 fail_msg: |
6 [ERR] Not tested with FreeBSD {{ ansible_distribution_version }}.
7 Tested with {{ wpacli_versions_tested }}. End of play.
8 To ignore set wpacli_assert_enable=False
9 success_msg: "[OK] Tested with FreeBSD {{ ansible_distribution_version }}."
10 when: wpacli_assert_enable | bool
11
12# EOF
debug.yml
Synopsis: Configure debug.
Description of the task.
1---
2- name: "Debug wpacli_debug={{ wpacli_debug }}"
3 vars:
4 msg: |-
5 wpacli_role_version: {{ wpacli_role_version }}
6 ansible_architecture: {{ ansible_architecture }}
7 ansible_os_family: {{ ansible_os_family }}
8 ansible_distribution: {{ ansible_distribution }}
9 ansible_distribution_major_version: {{ ansible_distribution_major_version }}
10 ansible_distribution_version: {{ ansible_distribution_version }}
11 ansible_distribution_release: {{ ansible_distribution_release }}
12 ansible_python_version: {{ ansible_python_version }}
13
14 wpacli_install: {{ wpacli_install }}
15 wpacli_backup_conf: {{ wpacli_backup_conf }}
16 wpacli_enable: {{ wpacli_enable }}
17 wpacli_assert_enable: {{ wpacli_assert_enable }}
18 wpacli_versions_tested:
19 {{ wpacli_versions_tested | to_nice_yaml(indent=2) | indent(2) }}
20 wpacli_packages:
21 {{ wpacli_packages | to_nice_yaml(indent=2) | indent(2) }}
22 wpacli_program: {{ wpacli_program }}
23
24 freebsd_install_method: {{ freebsd_install_method }}
25 freebsd_use_packages: {{ freebsd_use_packages }}
26 freebsd_install_retries: {{ freebsd_install_retries }}
27 freebsd_install_delay: {{ freebsd_install_delay }}
28
29 wpacli_pid_dir: {{ wpacli_pid_dir }}
30 wpacli_pid_dir_owner: {{ wpacli_pid_dir_owner }}
31 wpacli_pid_dir_group: {{ wpacli_pid_dir_group }}
32 wpacli_pid_dir_mode: {{ wpacli_pid_dir_mode }}
33
34 wpacli_action_script: {{ wpacli_action_script }}
35 wpacli_action_script_template: {{ wpacli_action_script_template }}
36 wpacli_action_script_dir: {{ wpacli_action_script_dir }}
37 wpacli_action_script_dir_owner: {{ wpacli_action_script_dir_owner }}
38 wpacli_action_script_dir_group: {{ wpacli_action_script_dir_group }}
39 wpacli_action_script_dir_mode: {{ wpacli_action_script_dir_mode }}
40 wpacli_action_script_file: {{ wpacli_action_script_file }}
41 wpacli_action_script_owner: {{ wpacli_action_script_owner }}
42 wpacli_action_script_group: {{ wpacli_action_script_group }}
43 wpacli_action_script_mode: {{ wpacli_action_script_mode }}
44 wpacli_action_script_log_to_file: {{ wpacli_action_script_log_to_file }}
45 wpacli_action_script_logfile: {{ wpacli_action_script_logfile }}
46 wpacli_action_script_ntp_set: {{ wpacli_action_script_ntp_set }}
47 wpacli_action_script_ntp_server: {{ wpacli_action_script_ntp_server }}
48 wpacli_action_script_ntpdate_flags: {{ wpacli_action_script_ntpdate_flags }}
49
50 wpacli_ctrl_interface: {{ wpacli_ctrl_interface }}
51 wpacli_rcconf:
52 {{ wpacli_rcconf | to_yaml(indent=2) | indent(2) }}
53
54 fp_wpasupplicant_conf_ctrl_interface: {{ fp_wpasupplicant_conf_ctrl_interface | d('UNDEFINED') }}
55 ansible.builtin.debug:
56 msg: "{{ '{}'.format(msg) }}"
57
58# EOF
packages.yml
Synopsis: Configure packages.
Description of the task.
1---
2- name: "Packages: Install packages"
3 community.general.pkgng:
4 name: "{{ wpacli_packages }}"
5 register: result
6 retries: "{{ freebsd_install_retries }}"
7 until: result is succeeded
8 delay: "{{ freebsd_install_delay }}"
9 when: freebsd_install_method == 'packages'
10
11- name: "Packages: Install ports"
12 community.general.portinstall:
13 name: "{{ item }}"
14 use_packages: "{{ freebsd_use_packages | d(false) }}"
15 loop: "{{ wpacli_packages }}"
16 register: result
17 retries: "{{ freebsd_install_retries }}"
18 until: result is succeeded
19 delay: "{{ freebsd_install_delay }}"
20 when: freebsd_install_method == 'ports'
21
22# EOF
rcconf.yml
Synopsis: Configure rcconf.
Description of the task.
1---
2- name: "Rcconf: Configure wpa_cli_* in /etc/rc.conf"
3 ansible.builtin.lineinfile:
4 dest: /etc/rc.conf
5 regexp: ^\s*{{ item.key }}\s*=(.*)$
6 line: '{{ item.key }}="{{ item.val }}"'
7 backup: "{{ wpacli_backup_conf }}"
8 loop: "{{ wpacli_rcconf }}"
9 notify: restart netif
10
11# EOF
rc.yml
Synopsis: Configure rc.
Description of the task.
1---
2- name: "Rc: Create wpa_cli rc script /etc/rc.d/wpa_cli"
3 ansible.builtin.template:
4 src: wpa_cli.j2
5 dest: /etc/rc.d/wpa_cli
6 owner: root
7 group: wheel
8 mode: "0555"
9 backup: "{{ wpacli_backup_conf }}"
10 tags: wpacli_rc_script
11
12- name: "Rc: Patch /etc/defaults/rc.conf; add wpa_cli_* default vars"
13 ansible.posix.patch:
14 src: "{{ role_path }}/files/rc.conf.patch"
15 basedir: /etc/defaults
16 tags: wpacli_rc_defaults_patch
17
18- name: "Rc: Patch /etc/network.subr, start/stop wpa_cli"
19 ansible.posix.patch:
20 src: "{{ role_path }}/files/network.subr.patch"
21 basedir: /etc
22 tags: wpacli_rc_networksubr_patch
23
24# EOF
wpa-cli.yml
Synopsis: Configure wpa-cli.
Description of the task.
1---
2- name: "Wpa-cli: Create pid dir {{ wpacli_pid_dir }}"
3 ansible.builtin.file:
4 state: directory
5 path: "{{ wpacli_pid_dir }}"
6 owner: "{{ wpacli_pid_dir_owner }}"
7 group: "{{ wpacli_pid_dir_group }}"
8 mode: "{{ wpacli_pid_dir_mode }}"
9 tags: wpacli_pid_dir
10
11- name: "Wpa-cli: Create {{ wpacli_action_script_dir }}"
12 ansible.builtin.file:
13 state: directory
14 path: "{{ wpacli_action_script_dir }}"
15 owner: "{{ wpacli_action_script_dir_owner }}"
16 group: "{{ wpacli_action_script_dir_group }}"
17 mode: "{{ wpacli_action_script_dir_mode }}"
18 when: wpacli_action_script | bool
19 tags: wpacli_action_script
20
21- name: "Wpa-cli: Create action script {{ wpacli_action_script_dir ~ '/' ~ wpacli_action_script_file }}"
22 ansible.builtin.template:
23 src: "{{ wpacli_action_script_template }}"
24 dest: "{{ wpacli_action_script_dir }}/{{ wpacli_action_script_file }}"
25 owner: "{{ wpacli_action_script_owner }}"
26 group: "{{ wpacli_action_script_group }}"
27 mode: "{{ wpacli_action_script_mode }}"
28 backup: "{{ wpacli_backup_conf }}"
29 when: wpacli_action_script | bool
30 tags: wpacli_action_script
31
32# EOF