Article 5706C Ansible - Update multipath.conf file

Ansible - Update multipath.conf file

by
elalexluna83
from LinuxQuestions.org on (#5706C)
Hello There!
I have lot of servers that use multipath.
e.g.
Code:multipath {
wwid 369834349802938746554637382920111
alias asm_disk1
}
multipath {
wwid 369834349802938746554637382920112
alias asm_disk2
}I want an ansible playbook that add new entries for me. But it is not working right now. (new multipath entry inside a multipath entry)
Code:multipath {
# BEGIN ANSIBLE MANAGED BLOCK
multipath {
wwid 369834349802938746554637382920113
alias asm_disk3
}
# END ANSIBLE MANAGED BLOCK
wwid 369834349802938746554637382920112
alias asm_disk2
}This is my playbook. any ideas how to fix it?

Code:---
- name: Update Multipath
hosts: localhost
become: yes

tasks:
- name:
blockinfile:
path: /etc/multipath.conf
insertafter: 'multipath'
block: |
multipath {
wwid 369834349802938746554637382920113
alias asm_disk3
}
backup: yeslatest?d=yIl2AUoC8zA latest?i=BbT9juijHi0:y_uZ8aemMnY:F7zBnMy latest?i=BbT9juijHi0:y_uZ8aemMnY:V_sGLiP latest?d=qj6IDK7rITs latest?i=BbT9juijHi0:y_uZ8aemMnY:gIN9vFwBbT9juijHi0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments