Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 74f5fdfe authored by freezed's avatar freezed :mountain:
Browse files

:wrench: SYSTEM Improve hosts & hostname

parent 63e47584
No related branches found
No related tags found
No related merge requests found
......@@ -8,13 +8,17 @@
- name: HOSTNAME | setup
ansible.builtin.hostname:
name: "{{ ansible_hostname }}"
name: "{{ inventory_hostname }}"
- name: IMPORT_TASKS | firewall
ansible.builtin.import_tasks: firewall.yml
- name: HOSTS | setup
ansible.builtin.template:
dest: "/etc/hosts"
src: templates/etc-hosts.j2
backup: true
mode: 0640
- name: IMPORT_TASKS | font
ansible.builtin.import_tasks: font.yml
- name: ANSIBLE | re-gather facts
ansible.builtin.setup:
- name: IMPORT_TASKS | ldp
ansible.builtin.import_tasks: ldp.yml
......
---
- name: "SHELL | set zsh for {{ my_user }}"
when: inventory_hostname in groups.station
ansible.builtin.user:
name: "{{ my_user }}"
shell: /bin/zsh
state: present
#jinja2:lstrip_blocks: True
# ############################################# #
# This file is managed by Ansible #
# Manual edition will be overridden #
# https://lab.frogg.it/freezed/ansible-debian #
# ############################################# #
127.0.0.1 localhost
127.0.1.1 {{ inventory_fqdn }} {{ inventory_hostname }}
{{ ansible_host }} {{ inventory_fqdn }} {{ inventory_hostname }}
{% if inventory_hostname in groups['station'] or inventory_hostname in groups['backup'] %}
# WAN
{% for host in groups['production'] %}
{{ hostvars[host]['ansible_host'] }} {{ hostvars[host]['inventory_fqdn'] }} {{ host }}
{% endfor %}
{% endif %}
{% if inventory_hostname in groups['station'] or inventory_hostname in groups['production'] %}
# BKP
{% for host in groups['backup'] %}
{{ hostvars[host]['ansible_host'] }} {{ hostvars[host]['inventory_fqdn'] }} {{ host }}
{% endfor %}
{% endif %}
{% if inventory_hostname in groups['station'] %}
# DEV
{% for host in groups['devel'] %}
{{ hostvars[host]['ansible_host'] }} {{ hostvars[host]['inventory_fqdn'] }} {{ host }}
{% endfor %}
# LOCAL
{% for host in groups['station'] %}
{{ hostvars[host]['ansible_host'] }} {{ hostvars[host]['inventory_fqdn'] }} {{ host }}
{% endfor %}
{% endif %}
#jinja2:lstrip_blocks: True
# ############################################# #
# This file is managed by Ansible #
# Manual edition will be overridden #
# https://lab.frogg.it/freezed/ansible-debian #
# ############################################# #
{% for host in groups['production'] %}
Host {{ host }}
User {{ hostvars[host]['my_user'] }}
Hostname {{ hostvars[host]['ansible_host'] }}
Port {{ hostvars[host]['ansible_port'] }}
{% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment