Initial commit
This commit is contained in:
20
roles/gekmihesg.openwrt/tasks/main.yml
Normal file
20
roles/gekmihesg.openwrt/tasks/main.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: pin defaults
|
||||
set_fact:
|
||||
openwrt_ssh: "{{ openwrt_ssh }}"
|
||||
openwrt_scp: "{{ openwrt_scp }}"
|
||||
openwrt_ssh_user: "{{ openwrt_ssh_user }}"
|
||||
openwrt_ssh_host: "{{ openwrt_ssh_host }}"
|
||||
openwrt_user_host: "{{ openwrt_ssh_user | quote }}@{{ openwrt_ssh_host | quote }}"
|
||||
ansible_ssh_transfer_method: "{{ openwrt_ssh_transfer_method }}"
|
||||
ansible_ssh_use_tty: "{{ openwrt_ssh_use_tty }}"
|
||||
ansible_scp_if_ssh: "{{ openwrt_scp_if_ssh }}"
|
||||
ansible_remote_tmp: "{{ openwrt_remote_tmp }}"
|
||||
when: "'openwrt' in group_names"
|
||||
tags: always
|
||||
|
||||
- name: install recommended packages
|
||||
include_tasks: packages.yml
|
||||
when:
|
||||
- "'openwrt' in group_names"
|
||||
- "openwrt_install_recommended_packages | bool"
|
||||
12
roles/gekmihesg.openwrt/tasks/package.yml
Normal file
12
roles/gekmihesg.openwrt/tasks/package.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: "check for command {{ item.key }}"
|
||||
command: "which {{ item.key | quote }}"
|
||||
register: _package
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: "install {{ item.value }} to provide {{ item.key }}"
|
||||
opkg:
|
||||
name: "{{ item.value }}"
|
||||
when: _package.rc
|
||||
40
roles/gekmihesg.openwrt/tasks/packages.yml
Normal file
40
roles/gekmihesg.openwrt/tasks/packages.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: check whether opkg caches need update
|
||||
stat:
|
||||
path: "{{ openwrt_remote_opkg_lists_dir }}"
|
||||
register: _opkg_lists
|
||||
|
||||
- name: get current system time
|
||||
command: date +%s
|
||||
register: _epoch
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
when: _opkg_lists.stat.exists
|
||||
|
||||
- name: update opkg cache
|
||||
opkg:
|
||||
name: opkg
|
||||
update_cache: true
|
||||
register: _update
|
||||
when: not _opkg_lists.stat.exists or
|
||||
_epoch.stdout|int - _opkg_lists.stat.mtime > 86400
|
||||
failed_when: not _opkg_lists.stat.exists and _update.failed
|
||||
changed_when: not _update.failed
|
||||
|
||||
- name: check for openssl
|
||||
command: which openssl
|
||||
register: _openssl
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- include_tasks: package.yml
|
||||
with_dict:
|
||||
base64: coreutils-base64
|
||||
md5sum: coreutils-md5sum
|
||||
sha1sum: coreutils-sha1sum
|
||||
when: _openssl.rc
|
||||
|
||||
- name: avoid re-checking of packages
|
||||
set_fact:
|
||||
openwrt_install_recommended_packages: false
|
||||
Reference in New Issue
Block a user