use become
This commit is contained in:
parent
f4121d3163
commit
44263bce25
@ -17,14 +17,10 @@
|
|||||||
listen:
|
listen:
|
||||||
- "host_reboot"
|
- "host_reboot"
|
||||||
|
|
||||||
- name: Wait for host
|
- name: Waiting for host startup
|
||||||
wait_for:
|
wait_for_connection:
|
||||||
host: "{{ ansible_ssh_host }}"
|
|
||||||
port: 22
|
|
||||||
delay: 5
|
delay: 5
|
||||||
timeout: 300
|
timeout: 300
|
||||||
connection: local
|
|
||||||
become: False
|
|
||||||
listen:
|
listen:
|
||||||
- "network_restart"
|
- "network_restart"
|
||||||
- "host_reboot"
|
- "host_reboot"
|
||||||
|
@ -1,44 +1,47 @@
|
|||||||
---
|
---
|
||||||
- name: Set hostname
|
- name: Setup network
|
||||||
template:
|
block:
|
||||||
src: etc/hostname.j2
|
- name: Set hostname
|
||||||
dest: /etc/hostname
|
template:
|
||||||
owner: root
|
src: etc/hostname.j2
|
||||||
group: root
|
dest: /etc/hostname
|
||||||
mode: 0644
|
owner: root
|
||||||
register: hostname_result
|
group: root
|
||||||
notify:
|
mode: 0644
|
||||||
- host_reboot
|
register: hostname_result
|
||||||
|
notify:
|
||||||
|
- host_reboot
|
||||||
|
|
||||||
- name: Set hosts file
|
- name: Set hosts file
|
||||||
template:
|
template:
|
||||||
src: etc/hosts.j2
|
src: etc/hosts.j2
|
||||||
dest: /etc/hosts
|
dest: /etc/hosts
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: hosts_result
|
register: hosts_result
|
||||||
notify:
|
notify:
|
||||||
- host_reboot
|
- host_reboot
|
||||||
|
|
||||||
- name: Add network interface configuration
|
- name: Add network interface configuration
|
||||||
template:
|
template:
|
||||||
src: etc/sysconfig/network-scrips/ifcfg.j2
|
src: etc/sysconfig/network-scrips/ifcfg.j2
|
||||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.key }}"
|
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.key }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_dict: "{{ network_interfaces }}"
|
with_dict: "{{ network_interfaces }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.key }}"
|
label: "{{ item.key }}"
|
||||||
when: item.key in ansible_interfaces
|
when: item.key in ansible_interfaces
|
||||||
notify:
|
notify:
|
||||||
- network_restart
|
- network_restart
|
||||||
|
|
||||||
- name: Set dns server
|
- name: Set dns server
|
||||||
template:
|
template:
|
||||||
src: etc/resolv.conf.j2
|
src: etc/resolv.conf.j2
|
||||||
dest: /etc/resolv.conf
|
dest: /etc/resolv.conf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
become: True
|
||||||
|
Loading…
Reference in New Issue
Block a user