Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
425abcff73 | ||
|
|
502cec92f3 | ||
|
|
18a875e842 | ||
|
|
d272730ced | ||
|
|
6178c56838 | ||
|
|
e38d86015f | ||
|
|
463a5fc4af | ||
|
|
a266189b38 | ||
|
|
eddc73850f | ||
|
|
8297204c9c | ||
|
|
d4b3c57cc9 | ||
|
|
50b67ed0cc | ||
|
|
4cb5e89fe9 |
No files matched your search
+4
-2
@@ -1,15 +1,15 @@
|
||||
# .ansible-lint
|
||||
---
|
||||
skip_list:
|
||||
- fqcn[action-core]
|
||||
- command-instead-of-shell
|
||||
- key-order[task]
|
||||
- yaml[line-length]
|
||||
- yaml[colons]
|
||||
- jinja[spacing]
|
||||
- fqcn[action]
|
||||
- name[missing]
|
||||
- yaml[comments]
|
||||
- yaml[commas]
|
||||
- var-naming[pattern]
|
||||
|
||||
warn_list:
|
||||
- literal-compare
|
||||
@@ -18,3 +18,5 @@ warn_list:
|
||||
- yaml[indentation]
|
||||
- risky-file-permissions
|
||||
- risky-shell-pipe
|
||||
- fqcn[action-core]
|
||||
- fqcn[action]
|
||||
@@ -91,9 +91,11 @@
|
||||
|
||||
- include_tasks: tasks/general/software/swap.yml
|
||||
- include_tasks: tasks/general/software/packages.yml
|
||||
when: internet
|
||||
- include_tasks: tasks/general/software/services.yml
|
||||
- include_tasks: tasks/general/software/sendmail.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
|
||||
- include_tasks: tasks/general/software/aur.yml
|
||||
when: internet and ansible_pkg_mgr == "pacman"
|
||||
@@ -107,6 +109,10 @@
|
||||
- include_tasks: tasks/general/acct_mgmt/users.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/sudo.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/doas.yml
|
||||
when: internet
|
||||
|
||||
- include_tasks: tasks/general/software/env-shared.yml
|
||||
when: internet
|
||||
|
||||
- include_tasks: tasks/general/scripts/root.yml
|
||||
- include_tasks: tasks/general/scripts/user.yml
|
||||
@@ -119,6 +125,7 @@
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- include_tasks: tasks/general/software/metasploit.yml
|
||||
when: internet
|
||||
|
||||
when: provision
|
||||
|
||||
@@ -132,15 +139,20 @@
|
||||
|
||||
## Desktop Environments ##
|
||||
- include_tasks: tasks/workstation/freebsd/software/gpu.yml
|
||||
when: ansible_system == "FreeBSD" and bsd_gpu
|
||||
when: ansible_system == "FreeBSD"
|
||||
and bsd_gpu
|
||||
and internet
|
||||
|
||||
# Window Managers without true Desktop Environments #
|
||||
- include_tasks: tasks/workstation/shared/software/dwm.yml
|
||||
when: internet
|
||||
- include_tasks: tasks/workstation/shared/software/i3.yml
|
||||
when: internet
|
||||
|
||||
# Polished Desktop Environments #
|
||||
- include_tasks: tasks/workstation/freebsd/software/gnome.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
|
||||
- name: Main | Workstation | Fancy Desktop Environments
|
||||
block:
|
||||
@@ -149,6 +161,7 @@
|
||||
- include_tasks: tasks/workstation/linux/software/cinnamon.yml
|
||||
- include_tasks: tasks/workstation/linux/software/lxqt.yml
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
# TBD: Implement this: and extra_desktops
|
||||
|
||||
## Software Tasks ##
|
||||
@@ -165,12 +178,15 @@
|
||||
- include_tasks: tasks/workstation/linux/software/brave.yml
|
||||
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
|
||||
- include_tasks: tasks/workstation/freebsd/software/packages.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
|
||||
- include_tasks: tasks/workstation/mac-os/software/brew.yml
|
||||
when: ansible_system == "Darwin"
|
||||
and internet
|
||||
|
||||
## Configuration Tasks ##
|
||||
- name: Main | Workstation Setup | Configuration
|
||||
@@ -203,6 +219,7 @@
|
||||
- include_tasks: tasks/workstation/linux/software/flutter.yml
|
||||
- include_tasks: tasks/workstation/linux/software/android.yml
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
|
||||
when: workstation
|
||||
|
||||
@@ -283,6 +300,7 @@
|
||||
block:
|
||||
|
||||
- include_tasks: tasks/general/software/telegraf.yml
|
||||
when: internet
|
||||
|
||||
- include_tasks: tasks/general/tests/services.yml
|
||||
- include_tasks: tasks/general/tests/lynis.yml
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Install and configure doas.
|
||||
|
||||
- name: General | Software | DoAs | Facts
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
doas_config: |
|
||||
permit persist :wheel as root
|
||||
permit persist :admin as root
|
||||
@@ -11,14 +11,14 @@
|
||||
doas_conf_file_bsd: /usr/local/etc/doas.conf
|
||||
|
||||
- name: General | Software | DoAs | Install
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- doas
|
||||
register: doas_install
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | DoAs | Configure [Linux]
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ doas_conf_file_linux }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
@@ -26,10 +26,11 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
when: not doas_install.failed and ansible_system in ("Linux")
|
||||
|
||||
- name: General | Software | DoAs | Configure [BSD]
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ doas_conf_file_linux }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
@@ -37,10 +38,11 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
when: not doas_install.failed and ansible_system in ("FreeBSD")
|
||||
|
||||
- name: General | Software | DoAs | Configure [Other]
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ item }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
@@ -48,6 +50,7 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
loop:
|
||||
- "{{ doas_conf_file_linux }}"
|
||||
- "{{ doas_conf_file_bsd }}"
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# Create and manage permissions for notify log.
|
||||
|
||||
- name: General | Notify | Update File
|
||||
shell: "{{ item }}"
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
loop:
|
||||
- touch "{{ notify_log_file }}"
|
||||
- chmod 777 "{{ notify_log_file }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc != 0
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
- name: General | Notify | Add Message
|
||||
shell : echo "'Ansible' '{{ notify_message }} @ `date`'" >> "{{ notify_log_file }}"
|
||||
ansible.builtin.shell : echo "'Ansible' '{{ notify_message }} @ `date`'" >> "{{ notify_log_file }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc != 0
|
||||
changed_when: shell_check.rc == 0
|
||||
@@ -2,32 +2,33 @@
|
||||
# Ensure the proper users have sudo access.
|
||||
|
||||
- name: General | Account Management | Sudo | Copy Ansible
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: sudo/sudoers_ansible
|
||||
dest: "{{ sudoers_install_dir }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0440
|
||||
mode: "0440"
|
||||
|
||||
- name: General | Account Management | Sudo | Copy Sudo Group
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: sudo/sudoers_sudo
|
||||
dest: "{{ sudoers_install_dir }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0440
|
||||
mode: "0440"
|
||||
|
||||
# Disable these two lines in openSUSE default configuration.
|
||||
#Defaults targetpw # ask for the password of the target user i.e. root
|
||||
#ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
|
||||
- name: General | Account Management | Sudo | Disable openSUSE Root PW Prompt
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ sudoers_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
loop:
|
||||
- { "key": '^[\#]?Defaults targetpw', "value": '#Defaults targetpw'}
|
||||
- { "key": '^[\#]?ALL ALL\=\(ALL\) ALL', "value": '#ALL ALL=(ALL) ALL'}
|
||||
@@ -4,11 +4,11 @@
|
||||
## Variables ##
|
||||
|
||||
- name: General | Account Management | Users | Use BASH (Default)
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
user_shell: "{{ bash_exec.stdout }}"
|
||||
|
||||
- name: General | Account Management | Users | Allow BASH (Arch)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/shells
|
||||
regexp: "{{ bash_exec.stdout }}"
|
||||
line: "{{ bash_exec.stdout }}"
|
||||
@@ -38,7 +38,7 @@
|
||||
## Root ##
|
||||
|
||||
- name: General | Account Management | Users | Root
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: root
|
||||
shell: "{{ bash_exec.stdout }}"
|
||||
create_home: true
|
||||
@@ -49,7 +49,7 @@
|
||||
## Scheduler ##
|
||||
|
||||
- name: General | Account Management | Users | Ansible
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: ansible
|
||||
comment: Ansible
|
||||
system: true
|
||||
@@ -59,7 +59,7 @@
|
||||
## Superuser ##
|
||||
|
||||
- name: General | Account Management | Users | User
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: "{{ user }}"
|
||||
comment: "{{ user_desc }}"
|
||||
groups:
|
||||
@@ -74,17 +74,19 @@
|
||||
register: user_user
|
||||
|
||||
- name: General | Account Management | Users | User | Test Logging In
|
||||
shell: "echo SUCCESS"
|
||||
ansible.builtin.shell: "echo SUCCESS"
|
||||
args:
|
||||
executable: "{{ user_shell }}"
|
||||
become: true
|
||||
become_user: "{{ user }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
|
||||
## Folders ##
|
||||
|
||||
- name: General | Account Management | Users | Root | Create Folders
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
@@ -95,7 +97,7 @@
|
||||
when: user_root.home != ""
|
||||
|
||||
- name: General | Account Management | Users | User | Create Folders
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
@@ -111,7 +113,7 @@
|
||||
when: user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | User | Create Folders | Coding
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
@@ -122,13 +124,15 @@
|
||||
when: user_user.home != "" and coding
|
||||
|
||||
- name: General | Account Management | Users | Home Permissions
|
||||
shell: "chmod 700 {{ user_user.home }}/../*"
|
||||
ansible.builtin.shell: "chmod 700 {{ user_user.home }}/../*"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
|
||||
## Files ##
|
||||
|
||||
- name: General | Account Management | Users | Files | Profile Variables
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
export_path_additions: export PATH="$HOME/bin:{{ shared_rc_bin }}:$PATH:{{ global_bin }}"
|
||||
export_path_sbin: export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
|
||||
#export_terminal: export TERMINAL="alacritty" # colors look weird.
|
||||
@@ -151,7 +155,7 @@
|
||||
}
|
||||
|
||||
- name: General | Account Management | Users | Files | RC Variables
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
alias_cp: alias cp='cp -v'
|
||||
alias_mv: alias mv='mv -v'
|
||||
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
|
||||
@@ -1225,7 +1229,7 @@
|
||||
|
||||
|
||||
- name: General | Account Management | Users | Files | Common Variable
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
profile_common: |
|
||||
{{ export_path_additions }}
|
||||
{{ export_path_sbin }}
|
||||
@@ -1315,7 +1319,7 @@
|
||||
{{ function_reset_android_studio }}
|
||||
|
||||
- name: General | Account Management | Users | Files | .profile + .xsessionrc
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
block: |
|
||||
{{ profile_common }}
|
||||
@@ -1326,6 +1330,7 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: false
|
||||
mode: "0755"
|
||||
loop:
|
||||
- ".profile"
|
||||
- ".xprofile"
|
||||
@@ -1333,7 +1338,7 @@
|
||||
when: user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Files | .bashrc
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ item }}/.bashrc"
|
||||
block: |
|
||||
{{ rc_common }}
|
||||
@@ -1347,13 +1352,14 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: false
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Files | .zshrc
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ item }}/.zshrc"
|
||||
block: |
|
||||
{{ rc_common }}
|
||||
@@ -1363,13 +1369,14 @@
|
||||
state: present
|
||||
create: true
|
||||
backup: false
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | Files | Ownership
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
owner: "{{ user }}"
|
||||
mode: '0755'
|
||||
@@ -1382,65 +1389,17 @@
|
||||
|
||||
|
||||
- name: General | Account Management | Users | Files | Helper Functions (Reset)
|
||||
shell: "rm -v {{ global_bin }}/*.function"
|
||||
ansible.builtin.shell: "rm -v {{ global_bin }}/*.function"
|
||||
ignore_errors: true
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
- name: General | Account Management | Users | Files | Helper Functions
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ global_bin }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
with_fileglob:
|
||||
- "functions/*.function"
|
||||
|
||||
|
||||
# Shared Environment Setup #
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Download / Update
|
||||
git:
|
||||
repo: https://git.hyperling.com/me/env-shared
|
||||
version: "{{ branch }}"
|
||||
dest: "{{ shared_rc_install_dir }}"
|
||||
clone: true
|
||||
force: true
|
||||
update: true
|
||||
#ignore_errors: true
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .rc_shared
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/rc_shared.sh"
|
||||
dest: "{{ item }}/.rc_shared"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0755
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .vimrc
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/vimrc.vim"
|
||||
dest: "{{ item }}/.vimrc"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0755
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Permissions
|
||||
file:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
owner: "{{ user }}"
|
||||
group: "{{ user }}"
|
||||
mode: '0755'
|
||||
loop:
|
||||
- .rc_shared
|
||||
- .vimrc
|
||||
#ignore_errors: true
|
||||
@@ -8,13 +8,37 @@
|
||||
# $RANDOM / 100 can be up to about 320 seconds, or ~5 minutes.
|
||||
# This prevents multiple systems from hitting it at the exact same time.
|
||||
|
||||
- name: General | Cron | Ansible | Facts
|
||||
set_fact:
|
||||
- name: General | Cron | Ansible | Facts 01
|
||||
ansible.builtin.set_fact:
|
||||
#ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.`date +'%Y%m%d-%H%M%S'`.log"
|
||||
ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.log"
|
||||
|
||||
- name: General | Cron | Ansible | Facts 02
|
||||
ansible.builtin.set_fact:
|
||||
ansible_cron_log_old: "{{ ansible_cron_log }}.old"
|
||||
|
||||
|
||||
- name: General | Cron | Ansible | Log | Delete Old
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_cron_log_old }}"
|
||||
state: absent
|
||||
|
||||
- name: General | Cron | Ansible | Log | Check
|
||||
ansible.builtin.stat:
|
||||
path: "{{ ansible_cron_log }}"
|
||||
register: ansible_cron_log_check
|
||||
|
||||
- name: General | Cron | Ansible | Log | Rename [if >1MB]
|
||||
ansible.builtin.copy:
|
||||
src: "{{ ansible_cron_log }}"
|
||||
dest: "{{ ansible_cron_log_old }}"
|
||||
mode: "0755"
|
||||
when: ansible_cron_log_check.stat.exists
|
||||
and ansible_cron_log_check.stat.size > 1000000
|
||||
|
||||
|
||||
- name: General | Cron | Ansible | Create Subscriber Job
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
user: ansible
|
||||
name: "Ansible Sync"
|
||||
minute: "*/30"
|
||||
@@ -23,7 +47,7 @@
|
||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
|
||||
- name: General | Cron | Ansible | Create Forced Weekly Subscriber Job
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
user: ansible
|
||||
name: "Ansible Weekly Forced Sync"
|
||||
special_time: weekly
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
# 20261002 - Hyperling
|
||||
# Move internet requiring code out of users.yml.
|
||||
|
||||
# Shared Environment Setup #
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Download / Update
|
||||
git:
|
||||
repo: https://git.hyperling.com/me/env-shared
|
||||
version: "{{ branch }}"
|
||||
dest: "{{ shared_rc_install_dir }}"
|
||||
clone: true
|
||||
force: true
|
||||
update: true
|
||||
#ignore_errors: true
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .rc_shared
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/rc_shared.sh"
|
||||
dest: "{{ item }}/.rc_shared"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .vimrc
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/vimrc.vim"
|
||||
dest: "{{ item }}/.vimrc"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Permissions
|
||||
file:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
owner: "{{ user }}"
|
||||
group: "{{ user }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- .rc_shared
|
||||
- .vimrc
|
||||
#ignore_errors: true
|
||||
@@ -2,18 +2,31 @@
|
||||
# 20261002 - Hyperling
|
||||
# Check whether we're connected to the internet and skip certain playbooks if not.
|
||||
|
||||
- name: General | Tests | Internet | Facts
|
||||
- name: General | Tests | Internet | Facts 01
|
||||
ansible.builtin.set_fact:
|
||||
internet: true
|
||||
internet_time: 10
|
||||
|
||||
- name: General | Tests | Internet | Check
|
||||
ansible.builtin.wait_for:
|
||||
host: archlinux.org.com
|
||||
host: archlinux.org
|
||||
port: 443
|
||||
state: started
|
||||
timeout: 15
|
||||
timeout: "{{ internet_time }}"
|
||||
register: internet_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Tests | Internet | Facts
|
||||
- name: General | Tests | Internet | Facts 02
|
||||
ansible.builtin.set_fact:
|
||||
internet: "{{ internet_check is success }}"
|
||||
|
||||
- name: General | Tests | Internet | Message
|
||||
ansible.builtin.debug:
|
||||
msg: "WARNING: Not connected to the Internet, only running for offline playbooks."
|
||||
when: not internet
|
||||
|
||||
- name: General | Tests | Internet | Sleep
|
||||
ansible.builtin.command: "sleep {{ internet_time }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
when: not internet
|
||||
Reference in new issue
Block a user