Tasks

main.yml

Synopsis: Main task.

Import tasks if enabled.

[tasks/main.yml]

 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.

[tasks/assert.yml]

 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.

[tasks/debug.yml]

 1---
 2- name: "Debug wpacli_debug={{ wpacli_debug }}"
 3  vars:
 4    msg: |-
 5      ansible_architecture: {{ ansible_architecture }}
 6      ansible_os_family: {{ ansible_os_family }}
 7      ansible_distribution: {{ ansible_distribution }}
 8      ansible_distribution_major_version: {{ ansible_distribution_major_version }}
 9      ansible_distribution_version: {{ ansible_distribution_version }}
10      ansible_distribution_release: {{ ansible_distribution_release }}
11      ansible_python_version: {{ ansible_python_version }}
12
13      wpacli_install: {{ wpacli_install }}
14      wpacli_backup_conf: {{ wpacli_backup_conf }}
15      wpacli_enable: {{ wpacli_enable }}
16      wpacli_assert_enable: {{ wpacli_assert_enable }}
17      wpacli_versions_tested:
18        {{ wpacli_versions_tested | to_nice_yaml(indent=2) | indent(2) }}
19      wpacli_packages:
20        {{ wpacli_packages | to_nice_yaml(indent=2) | indent(2) }}
21      wpacli_program: {{ wpacli_program }}
22
23      freebsd_install_method: {{ freebsd_install_method }}
24      freebsd_use_packages: {{ freebsd_use_packages }}
25      freebsd_install_retries: {{ freebsd_install_retries }}
26      freebsd_install_delay: {{ freebsd_install_delay }}
27
28      wpacli_pid_dir: {{ wpacli_pid_dir }}
29      wpacli_pid_dir_owner: {{ wpacli_pid_dir_owner }}
30      wpacli_pid_dir_group: {{ wpacli_pid_dir_group }}
31      wpacli_pid_dir_mode: {{ wpacli_pid_dir_mode }}
32
33      wpacli_action_script: {{ wpacli_action_script }}
34      wpacli_action_script_template: {{ wpacli_action_script_template }}
35      wpacli_action_script_dir: {{ wpacli_action_script_dir }}
36      wpacli_action_script_dir_owner: {{ wpacli_action_script_dir_owner }}
37      wpacli_action_script_dir_group: {{ wpacli_action_script_dir_group }}
38      wpacli_action_script_dir_mode: {{ wpacli_action_script_dir_mode }}
39      wpacli_action_script_file: {{ wpacli_action_script_file }}
40      wpacli_action_script_owner: {{ wpacli_action_script_owner }}
41      wpacli_action_script_group: {{ wpacli_action_script_group }}
42      wpacli_action_script_mode: {{ wpacli_action_script_mode }}
43      wpacli_action_script_log_to_file: {{ wpacli_action_script_log_to_file }}
44      wpacli_action_script_logfile: {{ wpacli_action_script_logfile }}
45      wpacli_action_script_ntp_set: {{ wpacli_action_script_ntp_set }}
46      wpacli_action_script_ntp_server: {{ wpacli_action_script_ntp_server }}
47      wpacli_action_script_ntpdate_flags: {{ wpacli_action_script_ntpdate_flags }}
48
49      wpacli_ctrl_interface: {{ wpacli_ctrl_interface }}
50      wpacli_rcconf:
51        {{ wpacli_rcconf | to_yaml(indent=2) | indent(2) }}
52
53      fp_wpasupplicant_conf_ctrl_interface: {{ fp_wpasupplicant_conf_ctrl_interface | d('UNDEFINED') }}
54  ansible.builtin.debug:
55    msg: "{{ '{}'.format(msg) }}"
56
57# EOF

packages.yml

Synopsis: Configure packages.

Description of the task.

[tasks/packages.yml]

 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.

[tasks/rcconf.yml]

 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.

[tasks/rc.yml]

 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.

[tasks/wpa-cli.yml]

 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