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