Add a utility directory #16
7 changed files with 67 additions and 0 deletions
4
utils/README.md
Normal file
4
utils/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Utils
|
||||
|
||||
A repository of Ansible Playbooks that are useful, as little script or various
|
||||
utilities, but not used in production.
|
13
utils/re2o_mail_server.yml
Executable file
13
utils/re2o_mail_server.yml
Executable file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
# Deploy Re2o mail service
|
||||
- hosts: mail.auro.re
|
||||
vars:
|
||||
service_repo: https://gitea.auro.re/aurore/re2o-mail-server.git
|
||||
service_name: mail-server
|
||||
service_version: aurore
|
||||
service_config:
|
||||
hostname: re2o-test.adm.auro.re # use test instance for now, should be changed for prod!
|
||||
username: service-user
|
||||
password: "{{ vault_serviceuser_passwd }}"
|
||||
roles:
|
||||
- re2o-service
|
31
utils/reboot_needed_check.yml
Executable file
31
utils/reboot_needed_check.yml
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env ansible-playbook
|
||||
---
|
||||
# Check if a reboot is required by the installation of some packages (ie kernel)
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Make sure local file exist but is empty # weird hack, I know
|
||||
copy:
|
||||
dest: /tmp/ansible_dump_reboot_needed.txt
|
||||
content: ""
|
||||
force: true
|
||||
|
||||
- hosts: all,!unifi,!escalope.adm.auro.re,!loki.adm.auro.re,!viviane.adm.auro.re,!vpn-ovh.adm.auro.re
|
||||
tasks:
|
||||
# Register the output of the file /var/run/reboot-required.pkgs
|
||||
- name: Register if boot is required
|
||||
shell: if [ -e /var/run/reboot-required.pkgs ]; then cat /var/run/reboot-required.pkgs; fi
|
||||
register: result
|
||||
|
||||
- name: DEBUG
|
||||
debug:
|
||||
msg: "{{ ansible_facts['nodename'] }} : {{ result.stdout }}"
|
||||
when: result.stdout != ""
|
||||
|
||||
# Add info line by line
|
||||
- name: Dump all info into the local file
|
||||
delegate_to: localhost
|
||||
lineinfile:
|
||||
path: /tmp/ansible_dump_reboot_needed.txt
|
||||
line: "{{ ansible_facts['nodename'] }} : {{ result.stdout }}"
|
||||
when: result.stdout != ""
|
||||
|
19
utils/version_check.yml
Executable file
19
utils/version_check.yml
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env ansible-playbook
|
||||
---
|
||||
# Check for the distribution
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Delete local tmp file
|
||||
file:
|
||||
path: /tmp/ansible_dump_dist_version.txt
|
||||
state: absent
|
||||
|
||||
- hosts: all,!unifi
|
||||
tasks:
|
||||
# Add info line by line
|
||||
- name: Dump all info into the local file
|
||||
delegate_to: localhost
|
||||
lineinfile:
|
||||
path: /tmp/ansible_dump_dist_version.txt
|
||||
line: "[{{ ansible_facts['nodename'] }}] {{ansible_fqdn}} : {{
|
||||
ansible_distribution }} {{ ansible_distribution_version }}"
|
Loading…
Reference in a new issue