-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
215 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
- name: Gathering facts | ||
setup: { } | ||
- name: Package count | ||
shell: wc -l /etc/apk/world | cut -d ' ' -f 1 | ||
register: result | ||
changed_when: false | ||
|
||
- set_fact: | ||
package_count: "{{ result.stdout }}" | ||
|
||
- name: OS Info | ||
debug: | ||
msg: | ||
- "{{ ansible_user_id }}({{ ansible_user_uid }})@{{ ansible_nodename }}" | ||
- "OS: {{ ansible_os_family }} {{ ansible_distribution_version }} {{ ansible_osversion|default('-')}}/{{ansible_osrevision|default('-') }} {{ ansible_machine }}" | ||
- "Host: {{ ansible_model | default(ansible_product_name) | default(ansible_system_vendor) }}" | ||
- "Ansible inventory: {{ inventory_hostname }} ,host: {{ ansible_host }}" | ||
- "CPU: {{ ansible_processor_count|default('-') }}x{{ ansible_processor_cores }}Cx{{ ansible_processor_threads_per_core|default('-') }}T={{ ansible_processor_vcpus }} vcpu {{ (ansible_processor[2]|length > 1)|ternary(ansible_processor[2],ansible_processor) }}" | ||
- "Memory: {{ ansible_memtotal_mb - ansible_memfree_mb }} MB / {{ ansible_memtotal_mb }} MB" | ||
- "Kernel: {{ ansible_kernel }}" | ||
- "Uptime: {{ (ansible_uptime_seconds|default(0)/60/60/24)|int }} days {{ (ansible_uptime_seconds|default(0)/60/60 % 24)|int}} hours {{(ansible_uptime_seconds|default(0)/60 % 60)|int }} minutes" | ||
- "Packages: {{ package_count }} ({{ ansible_pkg_mgr }})" | ||
- "Shell: {{ ansible_user_shell }}" | ||
- "Network: {% if ansible_default_ipv4 is defined %}{{ ansible_default_ipv4.interface }} {{ ansible_default_ipv4.address }} {{ ansible_default_ipv4.netmask }}{% else %}n/a{% endif %}" | ||
- "DNS: {{ ' '.join(ansible_dns.nameservers|default('-')) }}" | ||
- "Python: {{ ansible_python.executable }} {{ ansible_python_version }}" | ||
- "Interfaces: {% if ansible_interfaces is defined %}{{ ', '.join(ansible_interfaces|sort) }}{% else %}n/a{% endif %}" | ||
- "Addresses: {% if ansible_all_ipv4_addresses is defined %}{{ ', '.join(ansible_all_ipv4_addresses|sort) }}{% else %}n/a{% endif %}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
# dest | ||
# src | ||
# conf_files | ||
# skip | ||
|
||
- ansible.builtin.set_fact: | ||
src: "{{ lookup('ansible.builtin.first_found', conf_files|default(_conf_files)) }}" | ||
- block: | ||
- ansible.builtin.set_fact: | ||
src: "{{ lookup('ansible.builtin.first_found', conf_files|default(_conf_files)) }}" | ||
name: conf | find {{dest}} for host {{inventory_hostname}} | ||
rescue: | ||
- debug: | ||
msg: "{{_conf_files}}" | ||
when: src|default(None) == None | ||
vars: | ||
_inv_name: "{{inv_name | default('.')}}" | ||
_conf_files: | ||
- '{{_inv_name}}/{{inventory_hostname}}{{dest}}.j2' | ||
- '{{_inv_name}}/{{inventory_hostname}}{{dest}}' | ||
- '{{_inv_name}}/host/{{dest}}.j2' | ||
- '{{_inv_name}}/host/{{dest}}' | ||
when: src is undefined | ||
|
||
- '{{file_dir}}/{{inventory_hostname}}/{{dest}}.j2' | ||
- '{{file_dir}}/{{inventory_hostname}}/{{dest}}' | ||
- '{{file_dir}}/host/{{dest}}.j2' | ||
- '{{file_dir}}/host/{{dest}}' | ||
|
||
- block: | ||
- copy: | ||
src: "{{src}}" | ||
dest: "{{dest}}" | ||
when: | ||
- "src is not regex('[.]j2$')" | ||
name: conf | copy {{dest}} | ||
name: conf | copy {{src}} to {{dest}} | ||
- template: | ||
src: "{{src}}" | ||
dest: "{{dest}}" | ||
when: | ||
- "src is regex('[.]j2$')" | ||
name: conf | tpl {{dest}} | ||
name: conf | tpl {{src}} to {{dest}} | ||
when: | ||
- 'src is file' | ||
- src|default(None) != None | ||
- src is file | ||
become: true | ||
notify: "{{notify|default([])}}" | ||
|
||
# unset | ||
- set_fact: | ||
src: | ||
dest: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ | |
notify: haproxy.reload | ||
loop: | ||
- /etc/haproxy/haproxy.cfg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- name: tinc | start tincd.{{ tinc_netname }} service | ||
become: true | ||
service: | ||
name: tincd.{{ tinc_netname }} | ||
state: started | ||
enabled: true | ||
when: tinc_netname is defined | ||
|
||
- name: tinc | start tincd.{{ item }} service | ||
become: true | ||
service: | ||
name: tincd.{{ item }} | ||
state: started | ||
enabled: true | ||
when: tinc_netnames is defined | ||
loop: "{{ tinc_netnames }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- name: tinc | start tincd.{{ tinc_netname }} service | ||
become: true | ||
service: | ||
name: tincd.{{ tinc_netname }} | ||
state: stopped | ||
enabled: false | ||
when: tinc_netname is defined | ||
|
||
- name: tinc | start tincd.{{ item }} service | ||
become: true | ||
service: | ||
name: tincd.{{ item }} | ||
state: stopped | ||
enabled: false | ||
when: tinc_netnames is defined | ||
loop: "{{ tinc_netnames }}" |
Oops, something went wrong.