mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
feat(hostname): support partial execution with prepare
and deploy
tags
This commit is contained in:
parent
3803a5931d
commit
7ae06507c1
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
mode: 0644
|
||||
content: |
|
||||
{{ hostname_fqdn }}
|
||||
tags: [ 'deploy', 'deploy-hostname' ]
|
||||
|
||||
- name: Ensure /etc/hosts contains all hostnames and aliases of the server
|
||||
blockinfile:
|
||||
|
@ -20,6 +21,7 @@
|
|||
{{ host.ip }} {{ host.fqdn }} {{ host.alias | default([]) | join(" ") }}
|
||||
{% endfor %}
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK"
|
||||
tags: [ 'deploy', 'deploy-hostname' ]
|
||||
|
||||
# Needed because ansibles `ansible_fqdn` is loaded
|
||||
# from /etc/hostname, not from the running hostname
|
||||
|
@ -28,6 +30,7 @@
|
|||
cmd: "hostname"
|
||||
changed_when: false
|
||||
register: current_hostname
|
||||
tags: [ 'deploy', 'deploy-hostname' ]
|
||||
|
||||
- name: Set hostname via hostnamectl to avoid a reboot
|
||||
command:
|
||||
|
@ -35,3 +38,4 @@
|
|||
when: hostname_fqdn != hostname_current
|
||||
vars:
|
||||
hostname_current: "{{ current_hostname.stdout }}."
|
||||
tags: [ 'deploy', 'deploy-hostname' ]
|
||||
|
|
Loading…
Reference in a new issue