network: ansible-lint fixes
This commit is contained in:
parent
d833b57877
commit
4b0f5522c8
4 changed files with 79 additions and 61 deletions
|
@ -1,39 +1,51 @@
|
|||
---
|
||||
- name: get interface uuid
|
||||
command:
|
||||
cmd: nmcli -f "DEVICE,UUID,NAME" c show
|
||||
- name: Get interface uuid
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- nmcli
|
||||
- -f
|
||||
- DEVICE,UUID,NAME
|
||||
- c
|
||||
- show
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: interface_uuid
|
||||
|
||||
- name: create ethernet interface configurations
|
||||
template:
|
||||
- name: Create ethernet interface configurations
|
||||
ansible.builtin.template:
|
||||
src: ifcfg-eth.j2
|
||||
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.device }}"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: reload network manager connections
|
||||
notify: Reload network manager connections
|
||||
with_items: "{{ network_interfaces }}"
|
||||
|
||||
- block:
|
||||
- name: install keepalived
|
||||
package:
|
||||
name: keepalived
|
||||
state: installed
|
||||
- name: create keepalived config
|
||||
template:
|
||||
dest: /etc/keepalived/keepalived.conf
|
||||
src: keepalived.conf.j2
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: restart keepalived
|
||||
- name: enable keepalived
|
||||
service:
|
||||
name: keepalived
|
||||
state: started
|
||||
enabled: true
|
||||
- name: Install keepalived
|
||||
ansible.builtin.package:
|
||||
name: keepalived
|
||||
state: installed
|
||||
when:
|
||||
- network_vip_interfaces is defined
|
||||
- network_vip_interfaces != []
|
||||
|
||||
- name: Create keepalived config
|
||||
ansible.builtin.template:
|
||||
dest: /etc/keepalived/keepalived.conf
|
||||
src: keepalived.conf.j2
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
notify: Restart keepalived
|
||||
when:
|
||||
- network_vip_interfaces is defined
|
||||
- network_vip_interfaces != []
|
||||
|
||||
- name: Enable keepalived
|
||||
ansible.builtin.service:
|
||||
name: keepalived
|
||||
state: started
|
||||
enabled: true
|
||||
when:
|
||||
- network_vip_interfaces is defined
|
||||
- network_vip_interfaces != []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue